Skip to content

Commit

Permalink
Align test cases with mock data
Browse files Browse the repository at this point in the history
  • Loading branch information
1riatsila1 committed Aug 22, 2024
1 parent 02676fd commit 06a2213
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
12 changes: 12 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,30 @@ lint-provider:

golangci-lint run

fmt-provider:
gofmt -w pkg/config-api-provider

test-provider:
cd {{ CONFIG_API_PROVIDER_DIR }} && TF_ACC=1 go test -v ./test/... -race -covermode=atomic -coverprofile=.coverage

coverage-provider:
cd {{ CONFIG_API_PROVIDER_DIR }} && go tool cover -html=.coverage -o=.coverage.html

test:
just test-client
just test-provider

coverage:
just coverage-client
coverage-provider

lint:
just lint-client
just lint-provider

fmt:
just fmt-client
just fmt-provider

clean:
find . -name ".coverage*" -type f -delete
Expand Down
8 changes: 4 additions & 4 deletions pkg/config-api-provider/test/group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ type Fetcher interface {
func TestGroupResource(t *testing.T) {
createGroupConfig := `
resource "uxi_group" "test_group" {
name = "test_name"
parent_uid = "9999"
name = "temporary_name"
parent_uid = "temporary_parent_uid"
}`

resource.Test(t, resource.TestCase{
Expand All @@ -24,8 +24,8 @@ func TestGroupResource(t *testing.T) {
{
Config: providerConfig + createGroupConfig,
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("uxi_group.test_group", "name", "test_name"),
resource.TestCheckResourceAttr("uxi_group.test_group", "parent_uid", "9999"),
resource.TestCheckResourceAttr("uxi_group.test_group", "name", "temporary_name"),
resource.TestCheckResourceAttr("uxi_group.test_group", "parent_uid", "temporary_parent_uid"),
resource.TestCheckResourceAttrSet("uxi_group.test_group", "id"),
resource.TestCheckResourceAttrSet("uxi_group.test_group", "last_updated"),
),
Expand Down

0 comments on commit 06a2213

Please sign in to comment.