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

CLOUDP-226164: Fix clusters tests to use the new SDK #2570

Merged
merged 1 commit into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions internal/cli/atlas/accesslogs/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ func TestAccessLogListClusterName_Run(t *testing.T) {
test.VerifyOutputTemplate(t, listTemplate, expected)
}

func TestListTemplate(t *testing.T) {
test.VerifyOutputTemplate(t, listTemplate, atlasv2.MongoDBAccessLogsList{})
}

func TestAccessLogListHostname_Run(t *testing.T) {
ctrl := gomock.NewController(t)
mockStore := mocks.NewMockAccessLogsLister(ctrl)
Expand Down
15 changes: 10 additions & 5 deletions internal/cli/atlas/clusters/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,20 @@ import (
"github.com/golang/mock/gomock"
"github.com/mongodb/mongodb-atlas-cli/internal/flag"
"github.com/mongodb/mongodb-atlas-cli/internal/mocks"
"github.com/mongodb/mongodb-atlas-cli/internal/pointer"
"github.com/mongodb/mongodb-atlas-cli/internal/test"
"go.mongodb.org/atlas/mongodbatlas"
"go.mongodb.org/atlas-sdk/v20231115002/admin"
)

func TestList_Run(t *testing.T) {
ctrl := gomock.NewController(t)
mockStore := mocks.NewMockClusterLister(ctrl)

expected := mongodbatlas.AdvancedClustersResponse{
Results: []*mongodbatlas.AdvancedCluster{
expected := admin.PaginatedAdvancedClusterDescription{
Results: []admin.AdvancedClusterDescription{
{
Name: "test",
ID: "123",
Name: pointer.Get("test"),
Id: pointer.Get("123"),
},
},
}
Expand All @@ -54,6 +55,10 @@ func TestList_Run(t *testing.T) {
}
}

func TestListTemplate(t *testing.T) {
test.VerifyOutputTemplate(t, listTemplate, admin.PaginatedAdvancedClusterDescription{})
}

func TestListBuilder(t *testing.T) {
test.CmdValidator(
t,
Expand Down
4 changes: 1 addition & 3 deletions internal/cli/atlas/datalakepipelines/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ func TestCreate_Run(t *testing.T) {
CreatePipeline(createOpts.ConfigProjectID(), *request).Return(expected, nil).
Times(1)

if err := createOpts.Run(); err != nil {
t.Fatalf("Run() unexpected error: %v", err)
}
require.NoError(t, createOpts.Run())
}

func TestCreateBuilder(t *testing.T) {
Expand Down
1 change: 0 additions & 1 deletion test/e2e/atlas/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ const (
metricsEntity = "metrics"
searchEntity = "search"
indexEntity = "index"
datalakeEntity = "datalake"
datafederationEntity = "datafederation"
datalakePipelineEntity = "datalakepipeline"
alertsEntity = "alerts"
Expand Down
Loading