Fix tests and add more

This commit is contained in:
Luke Farnell 2017-05-16 13:02:04 -04:00 committed by Matthew Hooker
parent 22ab1494c4
commit 078c139ef1
No known key found for this signature in database
GPG Key ID: 7B5F933D9CE8C6A1
1 changed files with 21 additions and 3 deletions

View File

@ -15,7 +15,16 @@ func TestArtifact_Impl(t *testing.T) {
}
func TestArtifactId(t *testing.T) {
a := &Artifact{"packer-foobar", 42, "sfo", nil}
a := &Artifact{"packer-foobar", 42, []string{"sfo", "tor1"}, nil}
expected := "sfo,tor1:42"
if a.Id() != expected {
t.Fatalf("artifact ID should match: %v", expected)
}
}
func TestArtifactIdWithoutMultipleRegions(t *testing.T) {
a := &Artifact{"packer-foobar", 42, []string{"sfo"}, nil}
expected := "sfo:42"
if a.Id() != expected {
@ -24,8 +33,17 @@ func TestArtifactId(t *testing.T) {
}
func TestArtifactString(t *testing.T) {
a := &Artifact{"packer-foobar", 42, "sfo", nil}
expected := "A snapshot was created: 'packer-foobar' (ID: 42) in region 'sfo'"
a := &Artifact{"packer-foobar", 42, []string{"sfo", "tor1"}, nil}
expected := "A snapshot was created: 'packer-foobar' (ID: 42) in regions 'sfo,tor1'"
if a.String() != expected {
t.Fatalf("artifact string should match: %v", expected)
}
}
func TestArtifactStringWithoutMultipleRegions(t *testing.T) {
a := &Artifact{"packer-foobar", 42, []string{"sfo"}, nil}
expected := "A snapshot was created: 'packer-foobar' (ID: 42) in regions 'sfo'"
if a.String() != expected {
t.Fatalf("artifact string should match: %v", expected)