packer/template: Test that builder.rawConfig excludes name

The name isn't actually part of the builder config, so it should be
removed during parsing.
This commit is contained in:
Julian Phillips 2013-07-19 15:35:05 +01:00
parent f415fc18ef
commit dee1bc6c67
1 changed files with 13 additions and 0 deletions

View File

@ -128,6 +128,19 @@ func TestParseTemplate_BuilderWithName(t *testing.T) {
builder, ok := result.Builders["bob"] builder, ok := result.Builders["bob"]
assert.True(ok, "should have bob builder") assert.True(ok, "should have bob builder")
assert.Equal(builder.Type, "amazon-ebs", "builder should be amazon-ebs") assert.Equal(builder.Type, "amazon-ebs", "builder should be amazon-ebs")
rawConfig := builder.rawConfig
if rawConfig == nil {
t.Fatal("missing builder raw config")
}
expected := map[string]interface{}{
"type": "amazon-ebs",
}
if !reflect.DeepEqual(rawConfig, expected) {
t.Fatalf("bad raw: %#v", rawConfig)
}
} }
func TestParseTemplate_BuilderWithConflictingName(t *testing.T) { func TestParseTemplate_BuilderWithConflictingName(t *testing.T) {