Skip to content

Commit eb65013

Browse files
author
sfang97
committed
Only initialize provider in acceptance tests
1 parent b00e6f6 commit eb65013

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

gitlab/provider_test.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ var testAccProviders map[string]terraform.ResourceProvider
1212
var testAccProvider *schema.Provider
1313

1414
func init() {
15-
testAccProvider = Provider().(*schema.Provider)
16-
if err := testAccProvider.Configure(&terraform.ResourceConfig{}); err != nil {
17-
panic(err)
18-
}
19-
testAccProviders = map[string]terraform.ResourceProvider{
20-
"gitlab": testAccProvider,
15+
if os.Getenv(resource.TestEnvVar) != "" {
16+
testAccProvider = Provider().(*schema.Provider)
17+
if err := testAccProvider.Configure(&terraform.ResourceConfig{}); err != nil {
18+
panic(err)
19+
}
20+
testAccProviders = map[string]terraform.ResourceProvider{
21+
"gitlab": testAccProvider,
22+
}
2123
}
2224
}
2325

0 commit comments

Comments
 (0)