Skip to content
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
1 change: 1 addition & 0 deletions internal/cli/alerts/acknowledge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ func TestAcknowledgeOpts_Run(t *testing.T) {
opts := tt.opts
wantErr := tt.wantErr
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
ackReq := opts.newAcknowledgeRequest()
if wantErr {
mockStore.
Expand Down
1 change: 1 addition & 0 deletions internal/cli/atlas/dbusers/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ func TestCreateOpts_validate(t *testing.T) {
fields := tt.fields
wantErr := tt.wantErr
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
opts := &CreateOpts{
x509Type: fields.x509Type,
awsIamType: fields.awsIamType,
Expand Down
1 change: 1 addition & 0 deletions internal/cli/atlas/logs/download_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ func TestDownloadOpts_initDefaultOut(t *testing.T) {
out := tt.fields.out
want := tt.want
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
opts := &DownloadOpts{
name: logName,
}
Expand Down
1 change: 1 addition & 0 deletions internal/cli/global_opts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ func TestGenerateAliases(t *testing.T) {
want := tt.want
args := tt.args
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
got := GenerateAliases(args.use, args.extra...)
assert.Equal(t, got, want)
})
Expand Down
1 change: 1 addition & 0 deletions internal/cli/output_opts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ func TestOutputOpts_outputTypeAndValue(t *testing.T) {
}
want := tt.want
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
_, got := opts.outputTypeAndValue()
if got != want {
t.Errorf("parseTemplate() got = %v, want %v", got, want)
Expand Down
2 changes: 2 additions & 0 deletions internal/convert/automation_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
func TestFromAutomationConfig(t *testing.T) {
name := "cluster_1"
t.Run("replica set", func(t *testing.T) {
t.Parallel()
config := fixture.AutomationConfigWithOneReplicaSet(name, false)
expected := []*ClusterConfig{
{
Expand Down Expand Up @@ -82,6 +83,7 @@ func TestFromAutomationConfig(t *testing.T) {
}
})
t.Run("sharded cluster", func(t *testing.T) {
t.Parallel()
config := fixture.AutomationConfigWithOneShardedCluster(name, false)
expected := []*ClusterConfig{
{
Expand Down
1 change: 1 addition & 0 deletions internal/convert/cluster_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -958,6 +958,7 @@ func TestClusterConfig_PatchAutomationConfig(t *testing.T) {
current := tc.current
expected := tc.expected
t.Run(name, func(t *testing.T) {
t.Parallel()
if err := changes.PatchAutomationConfig(current); err != nil {
t.Fatalf("PatchAutomationConfig() unexpected error: %v\n", err)
}
Expand Down
136 changes: 82 additions & 54 deletions internal/convert/custom_db_role_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,35 +30,49 @@ func TestBuildAtlasInheritedRoles(t *testing.T) {
}

tests := []test{
{input: []string{"admin"}, want: []mongodbatlas.InheritedRole{
{
Role: "admin",
Db: "admin",
}},
{
input: []string{"admin"},
want: []mongodbatlas.InheritedRole{
{
Role: "admin",
Db: "admin",
},
},
},
{input: []string{"admin@test"}, want: []mongodbatlas.InheritedRole{
{
Role: "admin",
Db: "test",
}},
{
input: []string{"admin@test"},
want: []mongodbatlas.InheritedRole{
{
Role: "admin",
Db: "test",
},
},
},
{input: []string{"admin@test", "something"}, want: []mongodbatlas.InheritedRole{
{
Role: "admin",
Db: "test",
{
input: []string{"admin@test", "something"},
want: []mongodbatlas.InheritedRole{
{
Role: "admin",
Db: "test",
},
{
Role: "something",
Db: "admin",
},
},
{
Role: "something",
Db: "admin",
}},
},
}

for _, tc := range tests {
got := BuildAtlasInheritedRoles(tc.input)
if err := deep.Equal(tc.want, got); err != nil {
t.Fatalf("expected: %v, got: %v", tc.want, got)
}
input := tc.input
want := tc.want
t.Run("", func(t *testing.T) {
t.Parallel()
got := BuildAtlasInheritedRoles(input)
if err := deep.Equal(want, got); err != nil {
t.Fatalf("expected: %v, got: %v", want, got)
}
})
}
}

Expand All @@ -71,51 +85,65 @@ func TestBuildAtlasActions(t *testing.T) {
cluster := true

tests := []test{
{input: []string{"clusterName"}, want: []mongodbatlas.Action{
{
Action: "clusterName",
Resources: []mongodbatlas.Resource{
{
Cluster: &cluster,
{
input: []string{"clusterName"},
want: []mongodbatlas.Action{
{
Action: "clusterName",
Resources: []mongodbatlas.Resource{
{
Cluster: &cluster,
},
},
},
},
}},
{input: []string{"clusterName@testdb.collection"}, want: []mongodbatlas.Action{
{
Action: "clusterName",
Resources: []mongodbatlas.Resource{
{
Db: "testdb",
Collection: "collection",
},
{
input: []string{"clusterName@testdb.collection"},
want: []mongodbatlas.Action{
{
Action: "clusterName",
Resources: []mongodbatlas.Resource{
{
Db: "testdb",
Collection: "collection",
},
},
},
},
}},
{input: []string{"clusterName", "name@DATA_LAKE"}, want: []mongodbatlas.Action{
{
Action: "clusterName",
Resources: []mongodbatlas.Resource{
{
Cluster: &cluster,
},
{
input: []string{"clusterName", "name@DATA_LAKE"},
want: []mongodbatlas.Action{
{
Action: "clusterName",
Resources: []mongodbatlas.Resource{
{
Cluster: &cluster,
},
},
},
},
{
Action: "name",
Resources: []mongodbatlas.Resource{
{
Db: "DATA_LAKE",
{
Action: "name",
Resources: []mongodbatlas.Resource{
{
Db: "DATA_LAKE",
},
},
},
},
}},
},
}

for _, tc := range tests {
got := BuildAtlasActions(tc.input)
if err := deep.Equal(tc.want, got); err != nil {
t.Fatalf("expected: %v, got: %v", tc.want, got)
}
input := tc.input
want := tc.want
t.Run("", func(t *testing.T) {
t.Parallel()
got := BuildAtlasActions(input)
if err := deep.Equal(want, got); err != nil {
t.Fatalf("expected: %v, got: %v", want, got)
}
})
}
}
1 change: 1 addition & 0 deletions internal/convert/rs_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ func TestRSConfig_protocolVer(t *testing.T) {
expected := tc.wantedProtocolVersion
wantErr := tc.wantErr
t.Run(name, func(t *testing.T) {
t.Parallel()
ver, err := m.protocolVer()
if (err != nil) != wantErr {
t.Fatalf("protocolVer() unexpected error: %v\n", err)
Expand Down
Loading