Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudsmith-iduffy committed Dec 1, 2024
1 parent 96f4951 commit a2b1e36
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions cloudsmith/resource_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package cloudsmith
import (
"fmt"
"os"
"regexp"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
Expand Down Expand Up @@ -32,7 +33,7 @@ func TestAccService_basic(t *testing.T) {
testAccServiceCheckExists("cloudsmith_service.test"),
// check a sample of computed properties have been set correctly
resource.TestCheckResourceAttr("cloudsmith_service.test", "description", ""),
resource.TestCheckResourceAttr("cloudsmith_service.test", "slug", "tf-test-service"),
resource.TestMatchResourceAttr("cloudsmith_service.test", "slug", regexp.MustCompile("^tf-test-service.*$")),
resource.TestCheckResourceAttrSet("cloudsmith_service.test", "key"),
resource.TestCheckResourceAttr("cloudsmith_service.test", "role", "Member"),
resource.TestCheckNoResourceAttr("cloudsmith_service.test", "team.#"),
Expand Down Expand Up @@ -60,13 +61,15 @@ func TestAccService_basic(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
testAccServiceCheckExists("cloudsmith_service.test"),
resource.TestCheckResourceAttrSet("cloudsmith_service.test", "team.#"),
resource.TestCheckTypeSetElemNestedAttrs("cloudsmith_service.test", "team.*", map[string]string{
"slug": "tf-test-team-svc",
"role": "Member",

resource.TestMatchTypeSetElemNestedAttrs("cloudsmith_service.test", "team.*", map[string]*regexp.Regexp{
"slug": regexp.MustCompile("^tf-test-service(-[^2].*)?$"),
"role": regexp.MustCompile("^Member$"),
}),
resource.TestCheckTypeSetElemNestedAttrs("cloudsmith_service.test", "team.*", map[string]string{
"slug": "tf-test-team-svc-2",
"role": "Manager",

resource.TestMatchTypeSetElemNestedAttrs("cloudsmith_service.test", "team.*", map[string]*regexp.Regexp{
"slug": regexp.MustCompile("^tf-test-service-2.*$"),
"role": regexp.MustCompile("^Manager$"),
}),
),
},
Expand Down

0 comments on commit a2b1e36

Please sign in to comment.