Skip to content

Commit

Permalink
Review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Shocktrooper committed Mar 31, 2022
1 parent a29f12a commit 45a79cd
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 29 deletions.
2 changes: 1 addition & 1 deletion GNUmakefile
Expand Up @@ -20,7 +20,7 @@ endif
test: ## Run unit tests.
go test $(TESTARGS) $(PROVIDER_SRC_DIR)

TFPROVIDERLINTX_CHECKS = -XAT001=false -XR003=false -XS002=false
TFPROVIDERLINTX_CHECKS = -XR003=false -XS002=false

fmt: tool-golangci-lint tool-tfproviderlintx tool-terraform tool-shfmt ## Format files and fix issues.
gofmt -w -s .
Expand Down
23 changes: 12 additions & 11 deletions internal/provider/resource_gitlab_group_share_group_test.go
Expand Up @@ -115,21 +115,22 @@ func testAccCheckGitlabShareGroupDestroy(s *terraform.State) error {
if err != nil {
return fmt.Errorf("[ERROR] cannot get Group ID and ShareGroupId from input: %v", rs.Primary.ID)
}
}
}

// Get Main Group
group, _, err := testGitlabClient.Groups.GetGroup(groupId, nil)
if err != nil {
return err
}
// Get Main Group
group, _, err := testGitlabClient.Groups.GetGroup(groupId, nil)
if err != nil {
return err
}

// Make sure that SharedWithGroups attribute on the main group does not contain the shared group id at all
for _, sharedGroup := range group.SharedWithGroups {
if sharedGroupId == sharedGroup.GroupID {
return fmt.Errorf("GitLab Group Share %d still exists", sharedGroupId)
// Make sure that SharedWithGroups attribute on the main group does not contain the shared group id at all
for _, sharedGroup := range group.SharedWithGroups {
if sharedGroupId == sharedGroup.GroupID {
return fmt.Errorf("GitLab Group Share %d still exists", sharedGroupId)
}
}
}
}

return nil
}

Expand Down
18 changes: 9 additions & 9 deletions internal/provider/resource_gitlab_project_share_group_test.go
Expand Up @@ -120,17 +120,17 @@ func testAccCheckGitlabProjectShareGroupDestroy(s *terraform.State) error {
if err != nil {
return fmt.Errorf("[ERROR] cannot get project ID and group ID from input: %v", rs.Primary.ID)
}
}
}

proj, _, err := testGitlabClient.Projects.GetProject(projectId, nil)
if err != nil {
return err
}
proj, _, err := testGitlabClient.Projects.GetProject(projectId, nil)
if err != nil {
return err
}

for _, v := range proj.SharedWithGroups {
if groupId == v.GroupID {
return fmt.Errorf("GitLab Project Share %d still exists", groupId)
for _, v := range proj.SharedWithGroups {
if groupId == v.GroupID {
return fmt.Errorf("GitLab Project Share %d still exists", groupId)
}
}
}
}

Expand Down
10 changes: 2 additions & 8 deletions internal/provider/resource_gitlab_project_test.go
Expand Up @@ -768,10 +768,7 @@ func TestAccGitlabProject_transfer(t *testing.T) {
}

func TestAccGitlabProject_imprtURL(t *testing.T) {
// Since we do some manual setup in this test, we need to handle the test skip first.
if os.Getenv(resource.EnvTfAcc) == "" {
t.Skip(fmt.Sprintf("Acceptance tests skipped unless env '%s' set", resource.EnvTfAcc))
}
testAccCheck(t)

rInt := acctest.RandInt()

Expand Down Expand Up @@ -895,10 +892,7 @@ func testAccCheckGitlabProjectMirroredAttributes(project *gitlab.Project, want *
}

func TestAccGitlabProject_ImprtURLMirrored(t *testing.T) {
// Since we do some manual setup in this test, we need to handle the test skip first.
if os.Getenv(resource.EnvTfAcc) == "" {
t.Skip(fmt.Sprintf("Acceptance tests skipped unless env '%s' set", resource.EnvTfAcc))
}
testAccCheck(t)

var mirror gitlab.Project
rInt := acctest.RandInt()
Expand Down

0 comments on commit 45a79cd

Please sign in to comment.