Fix tests and add more
This commit is contained in:
parent
22ab1494c4
commit
078c139ef1
|
@ -15,7 +15,16 @@ func TestArtifact_Impl(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestArtifactId(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"
|
expected := "sfo:42"
|
||||||
|
|
||||||
if a.Id() != expected {
|
if a.Id() != expected {
|
||||||
|
@ -24,8 +33,17 @@ func TestArtifactId(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestArtifactString(t *testing.T) {
|
func TestArtifactString(t *testing.T) {
|
||||||
a := &Artifact{"packer-foobar", 42, "sfo", nil}
|
a := &Artifact{"packer-foobar", 42, []string{"sfo", "tor1"}, nil}
|
||||||
expected := "A snapshot was created: 'packer-foobar' (ID: 42) in region 'sfo'"
|
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 {
|
if a.String() != expected {
|
||||||
t.Fatalf("artifact string should match: %v", expected)
|
t.Fatalf("artifact string should match: %v", expected)
|
||||||
|
|
Loading…
Reference in New Issue