-
Notifications
You must be signed in to change notification settings - Fork 208
test: Updates importIgnoredFields function to handle dynamic replication specs #2977
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
Changes from 1 commit
24b0e97
a3c5dc5
2426d2e
08b40ee
781aa1a
29fe715
f64edbb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1190,7 +1190,7 @@ func TestAccMockableAdvancedCluster_replicasetAdvConfigUpdate(t *testing.T) { | |
| Config: configBasicReplicaset(t, projectID, clusterName, fullUpdate), | ||
| Check: checksUpdate, | ||
| }, | ||
| acc.TestStepImportCluster(resourceName, importIgnoredFields()...), | ||
| acc.TestStepImportCluster(resourceName, importIgnoredFields(1)...), | ||
| }, | ||
| }) | ||
| } | ||
|
|
@@ -1233,7 +1233,7 @@ func TestAccMockableAdvancedCluster_shardedAddAnalyticsAndAutoScaling(t *testing | |
| Config: configSharded(t, projectID, clusterName, true), | ||
| Check: checksUpdated, | ||
| }, | ||
| acc.TestStepImportCluster(resourceName, importIgnoredFields()...), | ||
| acc.TestStepImportCluster(resourceName, importIgnoredFields(2)...), | ||
| }, | ||
| }) | ||
| } | ||
|
|
@@ -2782,13 +2782,17 @@ func configFCVPinning(t *testing.T, orgID, projectName, clusterName string, pinn | |
| `, orgID, projectName, clusterName, mongoDBMajorVersion, pinnedFCVAttr)) + dataSourcesTFNewSchema | ||
| } | ||
|
|
||
| func importIgnoredFields() []string { | ||
| func importIgnoredFields(replicationSpecs int) []string { | ||
| if config.AdvancedClusterV2Schema() { | ||
| return []string{} | ||
|
||
| } | ||
| return []string{ | ||
| "replication_specs.0.region_configs.0.read_only_specs", | ||
| "replication_specs.0.region_configs.0.analytics_specs", | ||
| "replication_specs.0.region_configs.0.electable_specs.0.ebs_volume_type", | ||
| ignored := []string{} | ||
|
||
| for i := range replicationSpecs { | ||
| ignored = append(ignored, | ||
| fmt.Sprintf("replication_specs.%d.region_configs.0.read_only_specs", i), | ||
| fmt.Sprintf("replication_specs.%d.region_configs.0.analytics_specs", i), | ||
| fmt.Sprintf("replication_specs.%d.region_configs.0.electable_specs.0.ebs_volume_type", i), | ||
| ) | ||
| } | ||
| return ignored | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why these ignored methods and why adding now the int?
I am not seeing a lot of documentation and this code is going to be very hard to follow and understand why in few months
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note that it has a
AdvancedClusterV2Schemaclause. It's because SDKv2 doesn't fill those fields (we talked about this in yesterday's meeting) so we don't want to check those attributes only for TPF. Maybe a better param name would be replicationSpecCount, to specify how many replicationSpecs are, so we want to ignore those attribute changes in import tests, as we know they happen because SDKv2 and TPF fill them differently.these attribute checks are new to TPF, were not being done in SDKv2
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doc added and refactor, please see the latest code