mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 19:17:10 +00:00
test(sidecarassets): cover placeholder build path
This commit is contained in:
1 parent
6a575665e1
commit
c576462b7a
1 file changed
+27
@@ -0,0 +1,27 @@
|
||||
//go:build !withsidecar
|
||||
|
||||
package sidecarassets
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestStubBuild_IsPlaceholder(t *testing.T) {
|
||||
if !IsPlaceholder() {
|
||||
t.Error("default build (no -tags withsidecar) must report a placeholder")
|
||||
}
|
||||
if EmbeddedSize() != 0 {
|
||||
t.Errorf("placeholder build must embed no JAR, got %d bytes", EmbeddedSize())
|
||||
}
|
||||
}
|
||||
|
||||
func TestStubBuild_ExtractErrors(t *testing.T) {
|
||||
_, err := Extract(t.TempDir())
|
||||
if err == nil {
|
||||
t.Fatal("Extract must fail when no JAR is embedded")
|
||||
}
|
||||
if !strings.Contains(err.Error(), "withsidecar") {
|
||||
t.Errorf("error should tell the user to rebuild with -tags withsidecar, got %v", err)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user