Skip to content

Commit b03ab39

Browse files
authored
chore: Allows use of preview provider 2.0.0 (#3133)
* remove advanced_cluster_tpf_move test group * remove allowPreviewProviderV2AdvancedCluster and related * remove safety-net test, no needed any more
1 parent ad84807 commit b03ab39

File tree

5 files changed

+4
-56
lines changed

5 files changed

+4
-56
lines changed

.github/workflows/acceptance-tests-runner.yml

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -397,9 +397,7 @@ jobs:
397397
with:
398398
terraform_version: ${{ inputs.terraform_version }}
399399
terraform_wrapper: false
400-
- name: Prepare new advanced_cluster
401-
run: make tools enable-preview-provider-v2
402-
- name: Unit tests # delete after allowPreviewProviderV2AdvancedCluster is removed
400+
- name: Unit tests
403401
run: go test -v ./internal/testutil/acc/advanced_cluster_preview_provider_v2_test.go
404402
- name: Mocked Acceptance Tests
405403
env:
@@ -415,39 +413,7 @@ jobs:
415413
./internal/service/advancedcluster
416414
./internal/service/advancedclustertpf
417415
run: make testacc
418-
419-
advanced_cluster_tpf_move:
420-
needs: [ change-detection, get-provider-version ]
421-
if: ${{ (needs.change-detection.outputs.advanced_cluster_tpf == 'true' || inputs.test_group == 'advanced_cluster_tpf') && inputs.terraform_version == '1.10.x' && inputs.reduced_tests == false }}
422-
env:
423-
MONGODB_ATLAS_PREVIEW_PROVIDER_V2_ADVANCED_CLUSTER: 'true'
424-
strategy:
425-
max-parallel: 2
426-
fail-fast: false
427-
matrix:
428-
terraform_version: ['1.8.x', '1.9.x'] # TF supported versions for MoveState apart from latest one, 1.10.x
429-
name: advanced_cluster_tpf_move-${{ matrix.terraform_version }}
430-
runs-on: ubuntu-latest
431-
permissions: {}
432-
steps:
433-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
434-
with:
435-
ref: ${{ inputs.ref || github.ref }}
436-
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34
437-
with:
438-
go-version-file: 'go.mod'
439-
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd
440-
with:
441-
terraform_version: ${{ matrix.terraform_version }}
442-
terraform_wrapper: false
443-
- name: Prepare new advanced_cluster
444-
run: make tools enable-preview-provider-v2
445-
- name: Acceptance Tests
446-
env:
447-
ACCTEST_REGEX_RUN: '^TestAccAdvancedCluster_move'
448-
ACCTEST_PACKAGES: ./internal/service/advancedclustertpf
449-
run: make testacc
450-
416+
451417
assume_role:
452418
needs: [ change-detection, get-provider-version ]
453419
if: ${{ needs.change-detection.outputs.assume_role == 'true' || inputs.test_group == 'assume_role' }}

Makefile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,6 @@ check-changelog-entry-file: ## Check a changelog entry file in a PR
191191
jira-release-version: ## Update Jira version in a release
192192
go run ./tools/jira-release-version/*.go
193193

194-
.PHONY: enable-preview-provider-v2
195-
enable-preview-provider-v2: ## Enable Preview Provider V2
196-
make change-lines filename=./internal/config/preview_provider_v2.go find="allowPreviewProviderV2AdvancedCluster = false" new="allowPreviewProviderV2AdvancedCluster = true"
197-
198194
.PHONY: delete-lines ${filename} ${delete}
199195
delete-lines:
200196
rm -f file.tmp

contributing/testing-best-practices.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Acceptance and migration tests can reuse projects and clusters in order to be mo
7272
**Experimental** framework for hooking into the HTTP Client used by the Terraform provider and capture/replay traffic.
7373
- Works by mutating a `terraform-plugin-testing/helper/resource.TestCase`
7474
- Limited to `TestAccMockable*` tests in [`resource_advanced_cluster_test.go`](../internal/service/advancedcluster/resource_advanced_cluster_test.go):
75-
- Remember to run `make enable-preview-provider-v2` and `export MONGODB_ATLAS_PREVIEW_PROVIDER_V2_ADVANCED_CLUSTER=true` for the TPF implementation to be used and the tests to work.
75+
- Remember to run `export MONGODB_ATLAS_PREVIEW_PROVIDER_V2_ADVANCED_CLUSTER=true` for the TPF implementation to be used and the tests to work.
7676
- Enabled test cases should always be named with `TestAccMockable` prefix, e.g.: `TestAccMockableAdvancedCluster_tenantUpgrade`
7777
- To create a new `TestAccMockable` you would need to (see [example commit](https://github.com/mongodb/terraform-provider-mongodbatlas/commit/939244fcab95eca9c4c93993fc1b5118ab8bfddb#diff-f9c590f9ffc351d041a26ff474f91404ff394cbfb83f1e135b415998476ca62aR128))
7878
- (1) Write the normal acceptance test

internal/config/preview_provider_v2.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ import (
66
)
77

88
const PreviewProviderV2AdvancedClusterEnvVar = "MONGODB_ATLAS_PREVIEW_PROVIDER_V2_ADVANCED_CLUSTER"
9-
const allowPreviewProviderV2AdvancedCluster = false // Don't allow in master branch yet, not in const block to allow automatic change
109

1110
// Environment variable is read only once to avoid possible changes during runtime
1211
var previewProviderV2AdvancedCluster, _ = strconv.ParseBool(os.Getenv(PreviewProviderV2AdvancedClusterEnvVar))
1312

1413
func PreviewProviderV2AdvancedCluster() bool {
15-
return allowPreviewProviderV2AdvancedCluster && previewProviderV2AdvancedCluster
14+
return previewProviderV2AdvancedCluster
1615
}

internal/config/preview_provider_v2_test.go

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)