|
|
|
|
@ -190,7 +190,46 @@ func TestBuilderPrepare_StateTimeout(t *testing.T) {
|
|
|
|
|
if err == nil {
|
|
|
|
|
t.Fatal("should have error")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestBuilderPrepare_SnapshotTimeout(t *testing.T) {
|
|
|
|
|
var b Builder
|
|
|
|
|
config := testConfig()
|
|
|
|
|
|
|
|
|
|
// Test default
|
|
|
|
|
warnings, err := b.Prepare(config)
|
|
|
|
|
if len(warnings) > 0 {
|
|
|
|
|
t.Fatalf("bad: %#v", warnings)
|
|
|
|
|
}
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Fatalf("should not have error: %s", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if b.config.SnapshotTimeout != 60*time.Minute {
|
|
|
|
|
t.Errorf("invalid: %s", b.config.SnapshotTimeout)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Test set
|
|
|
|
|
config["snapshot_timeout"] = "15m"
|
|
|
|
|
b = Builder{}
|
|
|
|
|
warnings, err = b.Prepare(config)
|
|
|
|
|
if len(warnings) > 0 {
|
|
|
|
|
t.Fatalf("bad: %#v", warnings)
|
|
|
|
|
}
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Fatalf("should not have error: %s", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Test bad
|
|
|
|
|
config["snapshot_timeout"] = "badstring"
|
|
|
|
|
b = Builder{}
|
|
|
|
|
warnings, err = b.Prepare(config)
|
|
|
|
|
if len(warnings) > 0 {
|
|
|
|
|
t.Fatalf("bad: %#v", warnings)
|
|
|
|
|
}
|
|
|
|
|
if err == nil {
|
|
|
|
|
t.Fatal("should have error")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestBuilderPrepare_PrivateNetworking(t *testing.T) {
|
|
|
|
|
|