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

chore: Updates mongodbatlas_advanced_cluster tests to expect temporary SERVICE_UNAVAILABLE error when migrating from old to new schema #2523

Merged
merged 3 commits into from
Aug 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package advancedcluster_test
import (
"fmt"
"os"
"regexp"
"testing"

"github.com/hashicorp/terraform-plugin-testing/helper/resource"
Expand Down Expand Up @@ -104,6 +105,11 @@ func TestMigAdvancedCluster_shardedMigrationFromOldToNewSchema(t *testing.T) {
Config: configShardedTransitionOldToNewSchema(orgID, projectName, clusterName, false),
Check: checkShardedTransitionOldToNewSchema(false),
},
{
ProtoV6ProviderFactories: acc.TestAccProviderV6Factories,
Config: configShardedTransitionOldToNewSchema(orgID, projectName, clusterName, true),
ExpectError: regexp.MustCompile("SERVICE_UNAVAILABLE"),
Copy link
Member

Choose a reason for hiding this comment

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

just to keep in mind, after service unavailable response migration is run asynchronously. We might have the risk following patch is done before migration is completed, so we should keep an eye on these tests and potentially add some delay before the 3rd step is run.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

do you have an idea of how we can add a delay in the test steps? I couldn't find anything relevant on this

Copy link
Collaborator

Choose a reason for hiding this comment

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

@maastha
I have done this before using a custom check.
See this example

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks @EspenAlbert , @AgustinBettati does this work for you? lmk I'll update, afaik there's no built-in way to do this so I'm okay with the approach suggested by Espen.

Copy link
Member

Choose a reason for hiding this comment

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

was imagining something along those lines 👍 , thanks Espen for sharing

},
{
ProtoV6ProviderFactories: acc.TestAccProviderV6Factories,
Config: configShardedTransitionOldToNewSchema(orgID, projectName, clusterName, true),
Expand All @@ -129,6 +135,11 @@ func TestMigAdvancedCluster_geoShardedMigrationFromOldToNewSchema(t *testing.T)
Config: configGeoShardedTransitionOldToNewSchema(orgID, projectName, clusterName, false),
Check: checkGeoShardedTransitionOldToNewSchema(false),
},
{
ProtoV6ProviderFactories: acc.TestAccProviderV6Factories,
Config: configShardedTransitionOldToNewSchema(orgID, projectName, clusterName, true),
ExpectError: regexp.MustCompile("SERVICE_UNAVAILABLE"),
},
{
ProtoV6ProviderFactories: acc.TestAccProviderV6Factories,
Config: configGeoShardedTransitionOldToNewSchema(orgID, projectName, clusterName, true),
Expand Down