github.com/aclaygray/packer@v1.3.2/post-processor/vagrant/google_test.go (about) 1 package vagrant 2 3 import ( 4 "strings" 5 "testing" 6 7 "github.com/hashicorp/packer/packer" 8 ) 9 10 func TestGoogleProvider_impl(t *testing.T) { 11 var _ Provider = new(GoogleProvider) 12 } 13 14 func TestGoogleProvider_KeepInputArtifact(t *testing.T) { 15 p := new(GoogleProvider) 16 17 if !p.KeepInputArtifact() { 18 t.Fatal("should keep input artifact") 19 } 20 } 21 22 func TestGoogleProvider_ArtifactId(t *testing.T) { 23 p := new(GoogleProvider) 24 ui := testUi() 25 artifact := &packer.MockArtifact{ 26 IdValue: "packer-1234", 27 } 28 29 vagrantfile, _, err := p.Process(ui, artifact, "foo") 30 if err != nil { 31 t.Fatalf("should not have error: %s", err) 32 } 33 result := `google.image = "packer-1234"` 34 if !strings.Contains(vagrantfile, result) { 35 t.Fatalf("wrong substitution: %s", vagrantfile) 36 } 37 }