Skip to content

Commit

Permalink
Revert "Generate DCL tests to service packages (#8349)" (#8427)
Browse files Browse the repository at this point in the history
This reverts commit 353dbb9.
  • Loading branch information
zli82016 authored Jul 22, 2023
1 parent 8ad92ee commit 63eca84
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
3 changes: 1 addition & 2 deletions tpgtools/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,7 @@ func generateResourceTestFile(res *Resource) {
fmt.Printf("%v", string(formatted))
} else {
outname := fmt.Sprintf("resource_%s_%s_generated_test.go", res.ProductName(), res.Name())
parentDir := getParentDir(res)
err = ioutil.WriteFile(path.Join(parentDir, outname), formatted, 0644)
err := ioutil.WriteFile(path.Join(*oPath, terraformResourceDirectory, outname), formatted, 0644)
if err != nil {
glog.Exit(err)
}
Expand Down
12 changes: 6 additions & 6 deletions tpgtools/templates/test_file.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
//
// ----------------------------------------------------------------------------

package {{$.Package}}_test
package google

import (
"context"
Expand Down Expand Up @@ -58,15 +58,15 @@ func TestAcc{{$.PathType}}_{{$s.TestSlug}}(t *testing.T) {
{{- range $contextkey, $contextvalue := $s.ExpandContext }}
"{{$contextkey}}" : {{$contextvalue}},
{{- end }}
"random_suffix": acctest.RandString(t, 10),
"random_suffix": RandString(t, 10),
}

acctest.VcrTest(t, resource.TestCase{
VcrTest(t, resource.TestCase{
PreCheck: func() { acctest.AccTestPreCheck(t) },
{{ if $s.HasGAEquivalent -}}
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
ProtoV5ProviderFactories: ProtoV5ProviderFactories(t),
{{- else }}
ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t),
ProtoV5ProviderFactories: ProtoV5ProviderBetaFactories(t),
{{- end }}
{{ if true -}}
CheckDestroy: testAccCheck{{$.PathType}}DestroyProducer(t),
Expand Down Expand Up @@ -122,7 +122,7 @@ func testAccCheck{{$.PathType}}DestroyProducer(t *testing.T) func(s *terraform.S
continue
}

config := acctest.GoogleProviderConfig(t)
config := GoogleProviderConfig(t)

billingProject := ""
if config.BillingProject != "" {
Expand Down

0 comments on commit 63eca84

Please sign in to comment.