File tree Expand file tree Collapse file tree 3 files changed +18
-18
lines changed Expand file tree Collapse file tree 3 files changed +18
-18
lines changed Original file line number Diff line number Diff line change @@ -11,13 +11,14 @@ build:
1111install : build
1212 mkdir -p $(PROVIDER_DIR )
1313 mv ${BINARY} $(PROVIDER_DIR )
14- cp .terraformrc ~
1514
1615test :
1716 go test -v $(TESTARGS ) -cover -timeout=120s -parallel=4 ./...
1817
1918testacc : install
19+ cp .terraformrc ~
2020 TF_ACC=1 go test -v $(TESTARGS ) -cover -timeout 120m ./...
21+ rm ~ /.terraformrc
2122
2223docs :
2324 go generate ./...
Original file line number Diff line number Diff line change @@ -38,17 +38,22 @@ func Provider() *schema.Provider {
3838
3939func providerConfigure (p * schema.Provider ) schema.ConfigureContextFunc {
4040 return func (_ context.Context , d * schema.ResourceData ) (interface {}, diag.Diagnostics ) {
41- config := & Config {
42- clientConfig : go_deploygate.ClientConfig {
43- ApiKey : d .Get ("api_key" ).(string ),
44- },
45- }
41+ config , err := initConfig (d )
42+ return config , diag .FromErr (err )
43+ }
44+ }
4645
47- err := config .initClient ()
48- if err != nil {
49- return nil , diag .FromErr (err )
50- }
46+ func initConfig (d * schema.ResourceData ) (* Config , error ) {
47+ config := & Config {
48+ clientConfig : go_deploygate.ClientConfig {
49+ ApiKey : d .Get ("api_key" ).(string ),
50+ },
51+ }
5152
52- return config , nil
53+ err := config .initClient ()
54+ if err != nil {
55+ return nil , err
5356 }
57+
58+ return config , nil
5459}
Original file line number Diff line number Diff line change @@ -10,7 +10,6 @@ import (
1010
1111 "github.com/dnaeon/go-vcr/cassette"
1212 "github.com/dnaeon/go-vcr/recorder"
13- go_deploygate "github.com/fnaoto/go_deploygate"
1413 "github.com/hashicorp/terraform-plugin-sdk/v2/diag"
1514 "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
1615 "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
@@ -63,13 +62,8 @@ func initProvider(t *testing.T) map[string]*schema.Provider {
6362
6463func providerConfigureVCR (p * schema.Provider , t * testing.T ) schema.ConfigureContextFunc {
6564 return func (_ context.Context , d * schema.ResourceData ) (interface {}, diag.Diagnostics ) {
66- config := & Config {
67- clientConfig : go_deploygate.ClientConfig {
68- ApiKey : d .Get ("api_key" ).(string ),
69- },
70- }
65+ config , err := initConfig (d )
7166
72- err := config .initClient ()
7367 if err != nil {
7468 return nil , diag .FromErr (err )
7569 }
You can’t perform that action at this time.
0 commit comments