github.phpd.cn/hashicorp/packer@v1.3.2/builder/scaleway/artifact_test.go (about) 1 package scaleway 2 3 import ( 4 "testing" 5 6 "github.com/hashicorp/packer/packer" 7 ) 8 9 func TestArtifact_Impl(t *testing.T) { 10 var raw interface{} 11 raw = &Artifact{} 12 if _, ok := raw.(packer.Artifact); !ok { 13 t.Fatalf("Artifact should be artifact") 14 } 15 } 16 17 func TestArtifactId(t *testing.T) { 18 a := &Artifact{"packer-foobar-image", "cc586e45-5156-4f71-b223-cf406b10dd1d", "packer-foobar-snapshot", "cc586e45-5156-4f71-b223-cf406b10dd1c", "ams1", nil} 19 expected := "ams1:cc586e45-5156-4f71-b223-cf406b10dd1d" 20 21 if a.Id() != expected { 22 t.Fatalf("artifact ID should match: %v", expected) 23 } 24 } 25 26 func TestArtifactString(t *testing.T) { 27 a := &Artifact{"packer-foobar-image", "cc586e45-5156-4f71-b223-cf406b10dd1d", "packer-foobar-snapshot", "cc586e45-5156-4f71-b223-cf406b10dd1c", "ams1", nil} 28 expected := "An image was created: 'packer-foobar-image' (ID: cc586e45-5156-4f71-b223-cf406b10dd1d) in region 'ams1' based on snapshot 'packer-foobar-snapshot' (ID: cc586e45-5156-4f71-b223-cf406b10dd1c)" 29 30 if a.String() != expected { 31 t.Fatalf("artifact string should match: %v", expected) 32 } 33 }