-
Notifications
You must be signed in to change notification settings - Fork 178
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
test: Introduces shared cluster resource for running search index tests #2086
Conversation
func configBasic(projectIDStr, indexName, databaseName, clusterNameStr, clusterTerraformStr string, explicitType bool) string { | ||
func configBasic(projectID, indexName, databaseName, clusterName string, explicitType bool) string { | ||
var indexType string | ||
if explicitType { | ||
indexType = `type="search"` | ||
} | ||
return clusterTerraformStr + fmt.Sprintf(` | ||
return fmt.Sprintf(` |
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.
cluster is now created outside of the terraform configuration so no need to receive the cluster config (clusterTerraformStr
).
} | ||
} | ||
|
||
func clusterReq(name, projectID string) admin.AdvancedClusterDescription { |
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.
i like it, and later we can make it more configurable
_, _, err := ConnV2().ClustersApi.CreateCluster(context.Background(), projectID, &req).Execute() | ||
require.NoError(tb, err, "Cluster creation failed: %s, err: %s", name, err) | ||
|
||
stateConf := advancedcluster.CreateStateChangeConfig(context.Background(), ConnV2(), projectID, name, 1*time.Hour) |
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.
what is this for?
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.
This is needed so that we wait for the cluster creation to complete. If this is not included tests will start running against a cluster that is not yet available.
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.
I like it!
…alled instantly after delete is called
if err == nil && searchIndex != nil { | ||
if err == nil && searchIndex != nil && searchIndex.Status != "IN_PROGRESS" { // index can be in progess for some seconds after delete is called |
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.
This change was needed because a cluster definition is no longer present in the config, so the check destroy is called instantly after acceptance tests deletes the search index. When the cluster config was defined the delete operation would take several minutes and leave room for the search index to fully delete.
internal/testutil/acc/atlas.go
Outdated
{ | ||
RegionConfigs: &[]admin.CloudRegionConfig{ | ||
{ | ||
ProviderName: admin.PtrString("AWS"), |
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.
nit: use constants for the strings "AWS", "US_WEST_2" and "M10"
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.
Nice!
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.
Nice 👍
Tested with MONGODB_ATLAS_CLUSTER_NAME
locally, and it works 👏
merging the PR, failing test in cluster are cloud-dev related, had a successful pass before latest commit which only did a refactor. |
* master: test: Introduces shared cluster resource for running search index tests (#2086) doc: Generates v1.15.3 (#2095) chore: Bump github.com/zclconf/go-cty from 1.14.3 to 1.14.4 (#2089) chore: Bump github.com/mongodb-forks/digest from 1.0.5 to 1.1.0 (#2087) chore: Bump github.com/hashicorp/hcl/v2 from 2.20.0 to 2.20.1 (#2091) chore: Bump tj-actions/verify-changed-files (#2092) chore: Bump github.com/aws/aws-sdk-go from 1.51.3 to 1.51.8 (#2088) test: Converting a test case to a migration test (#2081) chore: Fixes Slack notification button to GH action run text (#2093) doc: Specifies that upgrades From Replica Sets to Multi-Sharded Instances of cluster and advanced cluster might lead to error (#2080) doc: Fixes import command in third_party_integration doc (#2083)
Description
Link to any related issue(s): CLOUDP-239134
Defines mechanism for sharing a single cluster in a test execution. Applied new
acc.ClusterNameExecution(t)
for search index resource.Type of change:
Required Checklist:
Further comments