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 search_deployment resource with new SDK #1853

Merged
merged 12 commits into from Jan 22, 2024

Conversation

lantoli
Copy link
Member

@lantoli lantoli commented Jan 18, 2024

Description

Updates search_deployment resource with new SDK.

  • Testing improved, creation of migration test and config for it
  • Removed helper method for new SDK migration: NonEmptyToPtr

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

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.

Further comments

@lantoli lantoli force-pushed the CLOUDP-222717_search_deployment branch from bd227e4 to 38d0749 Compare January 21, 2024 10:12
@@ -56,11 +56,3 @@ func IsStringPresent(strPtr *string) bool {
func MongoDBRegionToAWSRegion(region string) string {
return strings.ReplaceAll(strings.ToLower(region), "_", "-")
}

// NonEmptyToPtr accepts an array or slice and returns a pointer to it, except if it's empty, in that case it returns nil.
func NonEmptyToPtr[T any](v []T) *[]T {
Copy link
Member Author

Choose a reason for hiding this comment

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

not used any more

@@ -251,7 +251,7 @@ func TestProjectDataSourceSDKToResourceTFModel(t *testing.T) {
project: &projectSDK,
projectProps: project.AdditionalProperties{
Teams: &admin.PaginatedTeamRole{
Results: conversion.NonEmptyToPtr(teamRolesSDK),
Results: &teamRolesSDK,
Copy link
Member Author

Choose a reason for hiding this comment

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

leftover

@lantoli lantoli marked this pull request as ready for review January 21, 2024 12:45
@lantoli lantoli requested a review from a team as a code owner January 21, 2024 12:45
@lantoli lantoli force-pushed the CLOUDP-222717_search_deployment branch from aa0663d to 1b0f560 Compare January 22, 2024 10:12
@@ -237,7 +237,7 @@ func TestAccConfigRSAlertConfiguration_withThresholdUpdated(t *testing.T) {
ImportStateIdFunc: importStateProjectIDFunc(resourceName),
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"project_id", "matcher.0.field_name"},
ImportStateVerifyIgnore: []string{"project_id", "updated", "matcher.0.field_name"},
Copy link
Member Author

@lantoli lantoli Jan 22, 2024

Choose a reason for hiding this comment

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

add "updated" to fix flaky test as sometimes updated time differs 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.

LGTM

"github.com/mongodb/terraform-provider-mongodbatlas/internal/testutil/mig"
)

func TestAccMigrationSearchDeployment_basic(t *testing.T) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nice!

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would keep into account that we also have the file data_source_search_deployment_schema.go, so changing the resource schema file to schema_search_deployment.go can cause confusion.

Copy link
Member Author

Choose a reason for hiding this comment

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

i missed that, ok I'll revert the rename

@lantoli lantoli merged commit cdfaef8 into master Jan 22, 2024
35 checks passed
@lantoli lantoli deleted the CLOUDP-222717_search_deployment branch January 22, 2024 20:53
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.

None yet

3 participants