Skip to content

Commit 14aa31f

Browse files
committed
Fix breaking changes introduce in SDK v2.11.0 upgrade
1 parent 3b1ef6c commit 14aa31f

File tree

4 files changed

+10
-22
lines changed

4 files changed

+10
-22
lines changed

internal/provider/helper_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ func isRunningInCE() (bool, error) {
6666
func testAccCheck(t *testing.T) {
6767
t.Helper()
6868

69-
if os.Getenv(resource.TestEnvVar) == "" {
70-
t.Skip(fmt.Sprintf("Acceptance tests skipped unless env '%s' set", resource.TestEnvVar))
69+
if os.Getenv(resource.EnvTfAcc) == "" {
70+
t.Skip(fmt.Sprintf("Acceptance tests skipped unless env '%s' set", resource.EnvTfAcc))
7171
}
7272
}
7373

@@ -318,8 +318,8 @@ type testAccGitlabProjectContext struct {
318318
// testAccGitlabProjectStart initializes the GitLab client and creates a test project. Remember to
319319
// call testAccGitlabProjectContext.finish() when finished with the testAccGitlabProjectContext.
320320
func testAccGitlabProjectStart(t *testing.T) testAccGitlabProjectContext {
321-
if os.Getenv(resource.TestEnvVar) == "" {
322-
t.Skip(fmt.Sprintf("Acceptance tests skipped unless env '%s' set", resource.TestEnvVar))
321+
if os.Getenv(resource.EnvTfAcc) == "" {
322+
t.Skip(fmt.Sprintf("Acceptance tests skipped unless env '%s' set", resource.EnvTfAcc))
323323
return testAccGitlabProjectContext{}
324324
}
325325

internal/provider/provider_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ var testGitlabConfig = Config{
3434
var testGitlabClient *gitlab.Client
3535

3636
func init() {
37-
if os.Getenv(resource.TestEnvVar) != "" {
37+
if os.Getenv(resource.EnvTfAcc) != "" {
3838
client, err := testGitlabConfig.Client()
3939
if err != nil {
4040
panic("failed to create test client: " + err.Error()) // lintignore: R009 // TODO: Resolve this tfproviderlint issue

internal/provider/resource_gitlab_project_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -694,8 +694,8 @@ func TestAccGitlabProject_transfer(t *testing.T) {
694694
// lintignore: AT002 // not a Terraform import test
695695
func TestAccGitlabProject_importURL(t *testing.T) {
696696
// Since we do some manual setup in this test, we need to handle the test skip first.
697-
if os.Getenv(resource.TestEnvVar) == "" {
698-
t.Skip(fmt.Sprintf("Acceptance tests skipped unless env '%s' set", resource.TestEnvVar))
697+
if os.Getenv(resource.EnvTfAcc) == "" {
698+
t.Skip(fmt.Sprintf("Acceptance tests skipped unless env '%s' set", resource.EnvTfAcc))
699699
}
700700

701701
rInt := acctest.RandInt()
@@ -822,8 +822,8 @@ func testAccCheckGitlabProjectMirroredAttributes(project *gitlab.Project, want *
822822
// lintignore: AT002 // not a Terraform import test
823823
func TestAccGitlabProject_importURLMirrored(t *testing.T) {
824824
// Since we do some manual setup in this test, we need to handle the test skip first.
825-
if os.Getenv(resource.TestEnvVar) == "" {
826-
t.Skip(fmt.Sprintf("Acceptance tests skipped unless env '%s' set", resource.TestEnvVar))
825+
if os.Getenv(resource.EnvTfAcc) == "" {
826+
t.Skip(fmt.Sprintf("Acceptance tests skipped unless env '%s' set", resource.EnvTfAcc))
827827
}
828828

829829
var mirror gitlab.Project

main.go

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
package main
22

33
import (
4-
"context"
54
"flag"
6-
"log"
75

86
"github.com/gitlabhq/terraform-provider-gitlab/internal/provider"
97
"github.com/hashicorp/terraform-plugin-sdk/v2/plugin"
@@ -16,21 +14,11 @@ var (
1614
)
1715

1816
func main() {
19-
2017
var debugMode bool
2118

2219
flag.BoolVar(&debugMode, "debug", false, "set to true to run the provider with support for debuggers like delve")
2320
flag.Parse()
2421

25-
opts := &plugin.ServeOpts{ProviderFunc: provider.New(version)}
26-
27-
if debugMode {
28-
err := plugin.Debug(context.Background(), "registry.terraform.io/providers/gitlabhq/gitlab", opts)
29-
if err != nil {
30-
log.Fatal(err.Error())
31-
}
32-
return
33-
}
34-
22+
opts := &plugin.ServeOpts{ProviderFunc: provider.New(version), Debug: debugMode, ProviderAddr: "registry.terraform.io/providers/gitlabhq/gitlab"}
3523
plugin.Serve(opts)
3624
}

0 commit comments

Comments
 (0)