Skip to content

Commit

Permalink
update group tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vmanilo committed Nov 19, 2023
1 parent 2509320 commit c2dda25
Show file tree
Hide file tree
Showing 11 changed files with 290 additions and 294 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
pull_request:
branches:
- main
- fix/update-acctests
paths-ignore:
- 'README.md'

Expand All @@ -15,6 +16,7 @@ on:
- 'README.md'
branches:
- main
- fix/update-acctests

# Ensures only 1 action runs per PR and previous is canceled on new trigger
concurrency:
Expand Down Expand Up @@ -118,7 +120,7 @@ jobs:
name: Matrix Acceptance Tests
needs: build
runs-on: ubuntu-latest
if: "!github.event.pull_request.head.repo.fork"
# if: "!github.event.pull_request.head.repo.fork"
timeout-minutes: 15
strategy:
fail-fast: false
Expand Down Expand Up @@ -169,7 +171,7 @@ jobs:

cleanup:
name: Cleanup
if: "!github.event.pull_request.head.repo.fork"
# if: "!github.event.pull_request.head.repo.fork"
needs: tests-acceptance
runs-on: ubuntu-latest
timeout-minutes: 15
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

func TestAccDatasourceTwingateConnectors_basic(t *testing.T) {
t.Run("Test Twingate Datasource : Acc Connectors Basic", func(t *testing.T) {
acctests.SetPageLimit(1)
acctests.SetPageLimit(t, 1)

networkName1 := test.RandomName()
networkName2 := test.RandomName()
Expand Down
2 changes: 1 addition & 1 deletion twingate/internal/test/acctests/datasource/groups_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func testTwingateGroupsDoesNotExists(name string) string {
}

func TestAccDatasourceTwingateGroupsWithFilters_basic(t *testing.T) {
acctests.SetPageLimit(1)
acctests.SetPageLimit(t, 1)
groupName := test.RandomName()

const theDatasource = "data.twingate_groups.out_dgs2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

func TestAccDatasourceTwingateRemoteNetworks_read(t *testing.T) {
t.Run("Test Twingate Datasource : Acc Remote Networks Read", func(t *testing.T) {
acctests.SetPageLimit(1)
acctests.SetPageLimit(t, 1)

prefix := acctest.RandString(10)
networkName1 := test.RandomName(prefix)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var (

func TestAccDatasourceTwingateResources_basic(t *testing.T) {
t.Run("Test Twingate Datasource : Acc Resources Basic", func(t *testing.T) {
acctests.SetPageLimit(1)
acctests.SetPageLimit(t, 1)
networkName := test.RandomName()
resourceName := test.RandomResourceName()
const theDatasource = "data.twingate_resources.out_drs1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

func TestAccDatasourceTwingateSecurityPoliciesBasic(t *testing.T) {
t.Run("Test Twingate Datasource : Acc Security Policies - basic", func(t *testing.T) {
acctests.SetPageLimit(1)
acctests.SetPageLimit(t, 1)

securityPolicies, err := acctests.ListSecurityPolicies()
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ func filterDatasourceServices(prefix string, configs []terraformServiceConfig) s

func TestAccDatasourceTwingateServicesAllCursors(t *testing.T) {
t.Run("Test Twingate Datasource : Acc Services - All Cursors", func(t *testing.T) {
acctests.SetPageLimit(1)
acctests.SetPageLimit(t, 1)
prefix := test.Prefix() + acctest.RandString(4)
const (
theDatasource = "data.twingate_service_accounts.out"
Expand Down
2 changes: 1 addition & 1 deletion twingate/internal/test/acctests/datasource/users_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

func TestAccDatasourceTwingateUsers_basic(t *testing.T) {
t.Run("Test Twingate Datasource : Acc Users Basic", func(t *testing.T) {
acctests.SetPageLimit(1)
acctests.SetPageLimit(t, 1)
resource.Test(t, resource.TestCase{
ProtoV6ProviderFactories: acctests.ProviderFactories,
PreCheck: func() { acctests.PreCheck(t) },
Expand Down
6 changes: 2 additions & 4 deletions twingate/internal/test/acctests/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,8 @@ var ProviderFactories = map[string]func() (tfprotov6.ProviderServer, error){ //n
},
}

func SetPageLimit(limit int) {
if err := os.Setenv(client.EnvPageLimit, strconv.Itoa(limit)); err != nil {
log.Fatal("failed to set page limit", err)
}
func SetPageLimit(t *testing.T, limit int) {

Check failure on line 94 in twingate/internal/test/acctests/helper.go

View workflow job for this annotation

GitHub Actions / Unit Tests

test helper function should start from t.Helper() (thelper)

Check failure on line 94 in twingate/internal/test/acctests/helper.go

View workflow job for this annotation

GitHub Actions / Unit Tests

test helper function should start from t.Helper() (thelper)
t.Setenv(client.EnvPageLimit, strconv.Itoa(limit))
}

const WaitDuration = 500 * time.Millisecond
Expand Down
Loading

0 comments on commit c2dda25

Please sign in to comment.