mirror of
https://github.com/hashicorp/packer.git
synced 2026-09-23 00:11:41 -04:00
packer/rpc: test warnings with builders
This commit is contained in:
@@ -30,7 +30,14 @@ func TestBuilderPrepare(t *testing.T) {
|
||||
|
||||
// Test Prepare
|
||||
config := 42
|
||||
bClient.Prepare(config)
|
||||
warnings, err := bClient.Prepare(config)
|
||||
if err != nil {
|
||||
t.Fatalf("bad: %s", err)
|
||||
}
|
||||
if len(warnings) > 0 {
|
||||
t.Fatalf("bad: %#v", warnings)
|
||||
}
|
||||
|
||||
if !b.PrepareCalled {
|
||||
t.Fatal("should be called")
|
||||
}
|
||||
@@ -40,6 +47,22 @@ func TestBuilderPrepare(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuilderPrepare_Warnings(t *testing.T) {
|
||||
b, bClient := builderRPCClient(t)
|
||||
|
||||
expected := []string{"foo"}
|
||||
b.PrepareWarnings = expected
|
||||
|
||||
// Test Prepare
|
||||
warnings, err := bClient.Prepare(nil)
|
||||
if err != nil {
|
||||
t.Fatalf("bad: %s", err)
|
||||
}
|
||||
if !reflect.DeepEqual(warnings, expected) {
|
||||
t.Fatalf("bad: %#v", warnings)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuilderRun(t *testing.T) {
|
||||
b, bClient := builderRPCClient(t)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user