Skip to content

Commit

Permalink
ci: fix tenant settings test assertions and run acceptance tests in s…
Browse files Browse the repository at this point in the history
…eries (#131)
  • Loading branch information
Christopher Dickson authored Feb 15, 2024
1 parent acc0f02 commit a6e3f7f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
32 changes: 16 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ name: Tests
on:
pull_request:
paths-ignore:
- 'README.md'
- "README.md"
push:
branches:
- 'main'
- "main"
tags:
- 'v*'
- "v*"
env:
AWS_REGION: "us-west-2"

Expand All @@ -31,7 +31,7 @@ jobs:
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
with:
go-version: '1.20'
go-version: "1.20"
cache: true
- run: go mod download
- run: go build -v .
Expand Down Expand Up @@ -62,15 +62,15 @@ jobs:
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
with:
go-version: '1.20'
go-version: "1.20"
cache: true
- run: go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs generate --provider-name cdo --rendered-provider-name "CDO Provider" --rendered-website-dir ../docs
- name: git diff
run: |
git diff --compact-summary --exit-code || \
(echo; echo "Unexpected difference in directories after docs generation. Run 'go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs generate --provider-name cdo --rendered-provider-name \"CDO Provider\" --rendered-website-dir ../docs' command from the provider directory and commit."; exit 1)
# Run unit tests
# Run unit tests
unit-test:
name: Terraform Client Unit Tests
needs: build
Expand All @@ -85,7 +85,7 @@ jobs:
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
with:
go-version: '1.20'
go-version: "1.20"
cache: true
- name: Run Go Test
run: go test ./...
Expand All @@ -100,36 +100,36 @@ jobs:
run:
working-directory: provider
timeout-minutes: 15
concurrency: "ci" # fixed group so that it never parallel, even in different PR
concurrency: "ci" # fixed group so that it never parallel, even in different PR
strategy:
fail-fast: false
max-parallel: 1 # acceptance tests create real infra, so no parallel run is enabled
max-parallel: 1 # acceptance tests create real infra, so no parallel run is enabled
matrix:
# list whatever Terraform versions here you would like to support
terraform:
- '1.3.*'
- '1.4.*'
- '1.5.*'
- "1.3.*"
- "1.4.*"
- "1.5.*"
steps:
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
with:
go-version: '1.20'
go-version: "1.20"
cache: true
- uses: hashicorp/setup-terraform@a1502cd9e758c50496cc9ac5308c4843bcd56d36 # v3.0.0
with:
terraform_version: ${{ matrix.terraform }}
terraform_wrapper: false
- run: go mod download
- run: cat .github-action.env >> $GITHUB_ENV # https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables
- run: cat .github-action.env >> $GITHUB_ENV # https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables
- env:
TF_ACC: "1"
ACC_TEST_CISCO_CDO_API_TOKEN: ${{ secrets.ACC_TEST_CISCO_CDO_API_TOKEN }}
IOS_RESOURCE_PASSWORD: ${{ secrets.IOS_RESOURCE_PASSWORD }}
ASA_RESOURCE_SDC_PASSWORD: ${{ secrets.ASA_RESOURCE_SDC_PASSWORD }}
DUO_ADMIN_PANEL_RESOURCE_INTEGRATION_KEY: ${{ secrets.DUO_ADMIN_PANEL_RESOURCE_INTEGRATION_KEY }}
DUO_ADMIN_PANEL_RESOURCE_SECRET_KEY: ${{ secrets.DUO_ADMIN_PANEL_RESOURCE_SECRET_KEY }}
run: go test -v -cover ./...
run: go test -v -cover -p 1 -run "TestAcc.*" ./...
timeout-minutes: 10
tag-release-version:
name: "Tag Release Version"
Expand All @@ -149,4 +149,4 @@ jobs:
if: github.ref == 'refs/heads/main'
needs: [tag-release-version]
uses: ./.github/workflows/module-release.yml
secrets: inherit
secrets: inherit
2 changes: 1 addition & 1 deletion provider/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ export
.PHONY: testacc
testacc:
TF_ACC=1 \
go test ./... -v $(TESTARGS) -timeout 120m -count 1
go test ./... -v $(TESTARGS) -timeout 120m -count 1 -p 1 -run "TestAcc.*"
6 changes: 3 additions & 3 deletions provider/internal/tenantsettings/data_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ func TestAccTenantSettingsDataSource(t *testing.T) {
resource.TestCheckResourceAttr("data.cdo_tenant_settings.test", "id", acctest.Env.TenantSettingsTenantUid()),
resource.TestCheckResourceAttr("data.cdo_tenant_settings.test", "change_request_support_enabled", "false"),
resource.TestCheckResourceAttr("data.cdo_tenant_settings.test", "auto_accept_device_changes_enabled", "false"),
resource.TestCheckResourceAttr("data.cdo_tenant_settings.test", "web_analytics_enabled", "true"),
resource.TestCheckResourceAttr("data.cdo_tenant_settings.test", "web_analytics_enabled", "false"),
resource.TestCheckResourceAttr("data.cdo_tenant_settings.test", "scheduled_deployments_enabled", "false"),
resource.TestCheckResourceAttr("data.cdo_tenant_settings.test", "deny_cisco_support_access_to_tenant_enabled", "false"),
resource.TestCheckResourceAttr("data.cdo_tenant_settings.test", "multi_cloud_defense_enabled", "true"),
resource.TestCheckResourceAttr("data.cdo_tenant_settings.test", "auto_discover_on_prem_fmcs_enabled", "true"),
resource.TestCheckResourceAttr("data.cdo_tenant_settings.test", "multi_cloud_defense_enabled", "false"),
resource.TestCheckResourceAttr("data.cdo_tenant_settings.test", "auto_discover_on_prem_fmcs_enabled", "false"),
resource.TestCheckResourceAttr("data.cdo_tenant_settings.test", "conflict_detection_interval", string(settings.ConflictDetectionIntervalEvery24Hours)),
),
},
Expand Down

0 comments on commit a6e3f7f

Please sign in to comment.