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: Unifies SDK connection getting in tests #1864

Merged
merged 5 commits into from
Jan 23, 2024
Merged

Conversation

lantoli
Copy link
Member

@lantoli lantoli commented Jan 22, 2024

Description

Unifies SDK connection getting in tests.

Before this PR, SDK connection in tests is got in different ways, not all of them work for migration tests. Here we get the connection in the same way independently of the test type.

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

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

@lantoli lantoli marked this pull request as ready for review January 23, 2024 07:38
@lantoli lantoli requested a review from a team as a code owner January 23, 2024 07:38
@@ -311,7 +310,7 @@ func TestAccConfigRSAlertConfiguration_importBasic(t *testing.T) {
ImportStateIdFunc: importStateProjectIDFunc(resourceName),
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"project_id"},
ImportStateVerifyIgnore: []string{"project_id", "updated"},
Copy link
Member Author

Choose a reason for hiding this comment

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

fix flaky test where updated attribute sometimes differ in a second

Copy link
Collaborator

@oarbusi oarbusi left a comment

Choose a reason for hiding this comment

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

nice!!

…ot differ in a second.

example:

 error=
  | ImportStateVerify attributes not equivalent. Difference is shown below. The - symbol indicates attributes missing after import.
  |
  | \u00a0\u00a0map[string]string{
  | -\u00a0\t"updated": "2024-01-23T01:33:43Z",
  | +\u00a0\t"updated": "2024-01-23T01:33:42Z",
  | \u00a0\u00a0}
@lantoli lantoli force-pushed the CLOUDP-224848_test_conn branch from 306bacd to c8e6874 Compare January 23, 2024 10:16
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.

LGTM, small comment

Comment on lines 457 to 459
// muxedProviderFactoryFn creates mux provider using existing sdk v2 provider passed as parameter and creating new instance of framework provider.
// Used in testing where existing sdk v2 provider has to be used.
func MuxedProviderFactoryFn(sdkV2Provider *sdkv2schema.Provider) func() tfprotov6.ProviderServer {
func muxedProviderFactoryFn(sdkV2Provider *sdkv2schema.Provider) func() tfprotov6.ProviderServer {
Copy link
Member

Choose a reason for hiding this comment

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

Since this function receiving an existing sdkV2Provider is no longer needed, could we define this logic directly in MuxedProviderFactory() and remove this function?

Copy link
Member Author

Choose a reason for hiding this comment

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

thx, good idea, done

@lantoli lantoli merged commit c58ff01 into master Jan 23, 2024
34 of 35 checks passed
@lantoli lantoli deleted the CLOUDP-224848_test_conn branch January 23, 2024 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants