Skip to content

Commit b628ab9

Browse files
author
Gustavo Bazan
authored
CLOUDP-226164: Fix clusters tests to use the new SDK (#2570)
1 parent 0abff75 commit b628ab9

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

internal/cli/atlas/accesslogs/list_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ func TestAccessLogListClusterName_Run(t *testing.T) {
7272
test.VerifyOutputTemplate(t, listTemplate, expected)
7373
}
7474

75+
func TestListTemplate(t *testing.T) {
76+
test.VerifyOutputTemplate(t, listTemplate, atlasv2.MongoDBAccessLogsList{})
77+
}
78+
7579
func TestAccessLogListHostname_Run(t *testing.T) {
7680
ctrl := gomock.NewController(t)
7781
mockStore := mocks.NewMockAccessLogsLister(ctrl)

internal/cli/atlas/clusters/list_test.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,20 @@ import (
2222
"github.com/golang/mock/gomock"
2323
"github.com/mongodb/mongodb-atlas-cli/internal/flag"
2424
"github.com/mongodb/mongodb-atlas-cli/internal/mocks"
25+
"github.com/mongodb/mongodb-atlas-cli/internal/pointer"
2526
"github.com/mongodb/mongodb-atlas-cli/internal/test"
26-
"go.mongodb.org/atlas/mongodbatlas"
27+
"go.mongodb.org/atlas-sdk/v20231115002/admin"
2728
)
2829

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

33-
expected := mongodbatlas.AdvancedClustersResponse{
34-
Results: []*mongodbatlas.AdvancedCluster{
34+
expected := admin.PaginatedAdvancedClusterDescription{
35+
Results: []admin.AdvancedClusterDescription{
3536
{
36-
Name: "test",
37-
ID: "123",
37+
Name: pointer.Get("test"),
38+
Id: pointer.Get("123"),
3839
},
3940
},
4041
}
@@ -54,6 +55,10 @@ func TestList_Run(t *testing.T) {
5455
}
5556
}
5657

58+
func TestListTemplate(t *testing.T) {
59+
test.VerifyOutputTemplate(t, listTemplate, admin.PaginatedAdvancedClusterDescription{})
60+
}
61+
5762
func TestListBuilder(t *testing.T) {
5863
test.CmdValidator(
5964
t,

internal/cli/atlas/datalakepipelines/create_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ func TestCreate_Run(t *testing.T) {
4747
CreatePipeline(createOpts.ConfigProjectID(), *request).Return(expected, nil).
4848
Times(1)
4949

50-
if err := createOpts.Run(); err != nil {
51-
t.Fatalf("Run() unexpected error: %v", err)
52-
}
50+
require.NoError(t, createOpts.Run())
5351
}
5452

5553
func TestCreateBuilder(t *testing.T) {

test/e2e/atlas/helper_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ const (
4141
metricsEntity = "metrics"
4242
searchEntity = "search"
4343
indexEntity = "index"
44-
datalakeEntity = "datalake"
4544
datafederationEntity = "datafederation"
4645
datalakePipelineEntity = "datalakepipeline"
4746
alertsEntity = "alerts"

0 commit comments

Comments
 (0)