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: Converting a test case to a migration test #2081
test: Converting a test case to a migration test #2081
Conversation
}) | ||
defaultAssertions(test) | ||
}) | ||
// ConvertToMigrationTestUseExternalProvider |
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.
Put both unit test for: ConvertToMigrationTest
and ConvertToMigrationTestUseExternalProvider
in the same test as they are reusing some internal functions.
However, would love to see suggestions of how to make this test cleaner
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.
it's quite a big test, don't know if some nested tests could be extracted to functions, or if a table-based test would help here
internal/service/searchindex/resource_search_index_migration_test.go
Outdated
Show resolved
Hide resolved
internal/service/searchindex/resource_search_index_migration_test.go
Outdated
Show resolved
Hide resolved
@@ -11,18 +11,19 @@ import ( | |||
"github.com/mongodb/terraform-provider-mongodbatlas/internal/testutil/acc" | |||
) | |||
|
|||
func TestAccSearchIndex_basic(t *testing.T) { | |||
func basicTestCase(tb testing.TB) *resource.TestCase { |
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.
it's great for this example. In some cases we might want to pass projectID so we get the execution project in acc tests but global project in mig, but that's specific to the tests so no changes needed in the infra
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.
great job!
…est.go Co-authored-by: Leo Antoli <430982+lantoli@users.noreply.github.com>
* 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
support converting a test case to a migration test
Link to any related issue(s): CLOUDP-239310
Type of change:
Required Checklist:
Further comments
Introduces two helper functions:
ConvertToMigrationTest
: default way of creating a new test case from an existing basic testConvertToMigrationTestUseExternalProvider
: when the test case requires a specific version oraws
providerresource_privatelink_endpoint_service_migration_test.go
resource_encryption_at_rest_migration_test.go