Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Removes SchemaConfigModeAttr from resources #1961

Merged
merged 5 commits into from
Feb 23, 2024

Conversation

maastha
Copy link
Collaborator

@maastha maastha commented Feb 20, 2024

Description

In mongodbatlas provider v1.12.3 'schema.SchemaConfigModeAttr' was added to collection attributes to support Terraform versions <1.1.5. This setting is not recommended by Hashicorp and breaks CDKTF.
Effectively, this PR reverts changes made in below PR:
#1572

Breaking change: Removing this setting causes cluster and advanced_cluster resources to be incompatible with Terraform versions <1.1.5.

Note: As of 2023-12-31, the minimum supported version of Terraform by us is 1.2.x.

Link to any related issue(s): https://jira.mongodb.org/browse/CLOUDP-230250

Type of change:

  • Bug fix (non-breaking change which fixes an issue). Please, add the "bug" label to the PR.
  • New feature (non-breaking change which adds functionality). Please, add the "enhancement" label to the PR.
  • Breaking change (fix or feature that would cause existing functionality to not work as expected). Please, add the "breaking change" label to the PR.
  • This change requires a documentation update
  • Documentation fix/enhancement

Required Checklist:

  • I have signed the MongoDB CLA
  • I have read the contribution guidelines
  • I have checked that this change does not generate any credentials and that they are NOT accidentally logged anywhere.
  • I have added tests that prove my fix is effective or that my feature works per HashiCorp requirements
  • I have added any necessary documentation (if appropriate)
  • I have run make fmt and formatted my code
  • If changes include deprecations or removals, I defined an isolated PR with a relevant title as it will be used in the auto-generated changelog.
  • If changes include removal or addition of 3rd party GitHub actions, I updated our internal document. Reach out to the APIx Integration slack channel to get access to the internal document.

Further comments

@maastha maastha force-pushed the CLOUDP-230250-remove-configmode-cluster branch from 5982592 to c421df1 Compare February 22, 2024 13:49
@@ -2,130 +2,141 @@ package cluster_test

Copy link
Collaborator Author

@maastha maastha Feb 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously the file called "resource_cluster_migration_test.go" had tests related to StateUpgrader. That file is now renamed to "resource_cluster_schema_migration_test.go" in this PR.

"resource_cluster_migration_test.go" now contains general migration tests for cluster resource.

@maastha maastha marked this pull request as ready for review February 22, 2024 15:31
@maastha maastha requested a review from a team as a code owner February 22, 2024 15:31
),
},
mig.TestStepCheckEmptyPlan(config),
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not against but it looks like adding steps after mig one is like mixing mig and acc test together

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intention is here is to not only ensure that plans are empty but also that updates and everything work as expected.

)

func TestAccClusterRSClusterMigrateState_empty_advancedConfig(t *testing.T) {
v0State := map[string]any{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add to tests in this file: acc.SkipInUnitTest(t) , so they don't run in unit test, as we're not using resource.ParallelTest ... it won't have TF_ACC variable into account and will always run the tests. (it's true that these tests don't take a lot of time but still better run only when acc)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

"github.com/mongodb/terraform-provider-mongodbatlas/internal/service/cluster"
)

func TestAccClusterRSClusterMigrateState_empty_advancedConfig(t *testing.T) {
Copy link
Member

@lantoli lantoli Feb 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we're using "migration" here in a different way as in the typical migration tests. in fact for instance these tests execute in acc not in mig GH actions because the test names

not a strong opinion but don't know if calling the files "migration" is confusing, maybe i would put these tests together with the regular test file, or maybe just call the file resource_cluster_schema_test

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can rename these to resource_cluster_state_upgrader_test to be more specific, does that address your concerns?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated to resource_cluster_state_upgrader_test let me know in case of concerns

Copy link
Member

@lantoli lantoli Feb 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removing "migrate/migration" from the filename works for me, thanks!

Copy link
Member

@AgustinBettati AgustinBettati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great that migration tests are now organised in cluster resource

@maastha maastha changed the title fix: Removes SchemaConfigModeAttr from cluster and advanced_cluster resources fix: Removes SchemaConfigModeAttr from resources Feb 23, 2024
@@ -1537,44 +1537,6 @@ func TestAccClusterRSCluster_basicAWS_PausedToUnpaused(t *testing.T) {
})
}

func TestAccClusterRSCluster_withDefaultBiConnectorAndAdvancedConfiguration_maintainsBackwardCompatibility(t *testing.T) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved to _migration_test.go

Copy link
Member

@lantoli lantoli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx for addressing my comments!

@maastha maastha merged commit ca76f3a into master Feb 23, 2024
44 checks passed
@maastha maastha deleted the CLOUDP-230250-remove-configmode-cluster branch February 23, 2024 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants