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

refactor: Uses mocks on admin.APIClient instead of custom ClusterService #2056

Merged
merged 2 commits into from Mar 21, 2024

Conversation

EspenAlbert
Copy link
Collaborator

Description

Uses mocks on admin.APIClient instead of custom ClusterService

Link to any related issue(s): CLOUDP-237016

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

@EspenAlbert EspenAlbert marked this pull request as ready for review March 21, 2024 07:35
@EspenAlbert EspenAlbert requested a review from a team as a code owner March 21, 2024 07:35
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

Comment on lines -1 to -2
// Code generated by mockery. DO NOT EDIT.

Copy link
Collaborator

Choose a reason for hiding this comment

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

should we also adjust the mockery configuration? surprised our CI check "Mock generation" did not catch this, but maybe it is because the interface has been removed.

Copy link
Member

Choose a reason for hiding this comment

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

I think so, that file doesn't exist any more

GroupId: projectID,
}
clusters, resp, err := client.List(ctx, params)
clusters, resp, err := client.ListClusters(ctx, projectID).Execute()
Copy link
Member

@lantoli lantoli Mar 21, 2024

Choose a reason for hiding this comment

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

what is the difference beetween List and ListClusters? do they return the same thing just passing the params differently?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

func (a *ClusterServiceFromClient) List(ctx context.Context, options *admin.ListClustersApiParams) (*admin.PaginatedAdvancedClusterDescription, *http.Response, error) {
	return a.client.ClustersApi.ListClustersWithParams(ctx, options).Execute()

👆 This was the old code in the service_advanced_cluster.go. (only named List)

I preferred using ListClusters instead of ListClustersWithParams since the ListClustersApiParams only used GroupId in the admin.ListClustersApiParams

@EspenAlbert EspenAlbert merged commit 9229ae4 into master Mar 21, 2024
45 checks passed
@EspenAlbert EspenAlbert deleted the CLOUDP-237016_advanced_cluster_unit_tests branch March 21, 2024 14:44
oarbusi added a commit that referenced this pull request Mar 22, 2024
…ted (#2052)

* schedule compatibility matrix first day of month

* WIP: test if status can be retrieved

* test

* test echo job status

* change

* Revert "change"

This reverts commit 4b0e49e.

* Revert "test echo job status"

This reverts commit 4a83862.

* test getting outputs of matrix

* result

* send slack

* checkout step

* fix name

* correct json

* formating

* Revert "formating"

This reverts commit f584822.

* format

* try

* Revert "try"

This reverts commit 7029f54.

* use cat

* Revert "use cat"

This reverts commit 9503cd2.

* remove unnecesary double quote

* try cat

* Revert "try cat"

This reverts commit a2df8ff.

* return json

* unify json

* fix

* enrich message

* TEMP: tag oncall on success

* chore: Updates Atlas Go SDK (#2044)

* build(deps): bump go.mongodb.org/atlas-sdk

* fix tags

* undo changes to admin20231001002

* API breaking change fixes

---------

Co-authored-by: lantoli <430982+lantoli@users.noreply.github.com>

* chore: Follow-up to Atlas SDK upgrade (#2051)

* remove unused NewGroup

* unify List call thanks to new API

* refactor: Uses mocks on admin.APIClient for Project+Teams+ClustersAPIs instead of custom service (#2045)

* refactor: Uses mocks on admin.APIClient instead of custom ClusterService (#2056)

* fix: Fixes `network_container` resource update (#2055)

* failing test

* recreate resource if provider_name changes

* fix update

* allow update in place when provider_name changes

* fix regions error handling

* refactor tests checks

* refactor checks in mig tests as well

* fix change check

* use MONGODB_ATLAS_PROJECT_ID (#2060)

* chore: Removes old service from mockery (#2063)

* feat: Allows user to specify to use an existing tag for release (#2053)

* remove TEMP oncall tag on success

* initialize oncall_tag

* send notification when test suite fails

* revert back testing change

* remove temporary trigger of action

* use oncall tag from secrets

* Revert "use oncall tag from secrets"

This reverts commit 5a7944f.

* use SHA

* new line

* make oncall tag a secret

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: lantoli <430982+lantoli@users.noreply.github.com>
Co-authored-by: Espen Albert <EspenAlbert@users.noreply.github.com>
Co-authored-by: maastha <122359335+maastha@users.noreply.github.com>
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

6 participants