Skip to content

Commit

Permalink
CLOUDP-226164: Fix clusters tests to use the new SDK (#2570)
Browse files Browse the repository at this point in the history
  • Loading branch information
gssbzn authored Jan 26, 2024
1 parent 0abff75 commit b628ab9
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
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

0 comments on commit b628ab9

Please sign in to comment.