@@ -30,35 +30,49 @@ func TestBuildAtlasInheritedRoles(t *testing.T) {
3030 }
3131
3232 tests := []test {
33- {input : []string {"admin" }, want : []mongodbatlas.InheritedRole {
34- {
35- Role : "admin" ,
36- Db : "admin" ,
37- }},
33+ {
34+ input : []string {"admin" },
35+ want : []mongodbatlas.InheritedRole {
36+ {
37+ Role : "admin" ,
38+ Db : "admin" ,
39+ },
40+ },
3841 },
39- {input : []string {"admin@test" }, want : []mongodbatlas.InheritedRole {
40- {
41- Role : "admin" ,
42- Db : "test" ,
43- }},
42+ {
43+ input : []string {"admin@test" },
44+ want : []mongodbatlas.InheritedRole {
45+ {
46+ Role : "admin" ,
47+ Db : "test" ,
48+ },
49+ },
4450 },
45- {input : []string {"admin@test" , "something" }, want : []mongodbatlas.InheritedRole {
46- {
47- Role : "admin" ,
48- Db : "test" ,
51+ {
52+ input : []string {"admin@test" , "something" },
53+ want : []mongodbatlas.InheritedRole {
54+ {
55+ Role : "admin" ,
56+ Db : "test" ,
57+ },
58+ {
59+ Role : "something" ,
60+ Db : "admin" ,
61+ },
4962 },
50- {
51- Role : "something" ,
52- Db : "admin" ,
53- }},
5463 },
5564 }
5665
5766 for _ , tc := range tests {
58- got := BuildAtlasInheritedRoles (tc .input )
59- if err := deep .Equal (tc .want , got ); err != nil {
60- t .Fatalf ("expected: %v, got: %v" , tc .want , got )
61- }
67+ input := tc .input
68+ want := tc .want
69+ t .Run ("" , func (t * testing.T ) {
70+ t .Parallel ()
71+ got := BuildAtlasInheritedRoles (input )
72+ if err := deep .Equal (want , got ); err != nil {
73+ t .Fatalf ("expected: %v, got: %v" , want , got )
74+ }
75+ })
6276 }
6377}
6478
@@ -71,51 +85,65 @@ func TestBuildAtlasActions(t *testing.T) {
7185 cluster := true
7286
7387 tests := []test {
74- {input : []string {"clusterName" }, want : []mongodbatlas.Action {
75- {
76- Action : "clusterName" ,
77- Resources : []mongodbatlas.Resource {
78- {
79- Cluster : & cluster ,
88+ {
89+ input : []string {"clusterName" },
90+ want : []mongodbatlas.Action {
91+ {
92+ Action : "clusterName" ,
93+ Resources : []mongodbatlas.Resource {
94+ {
95+ Cluster : & cluster ,
96+ },
8097 },
8198 },
8299 },
83- }},
84- {
input : []
string {
"[email protected] " },
want : []mongodbatlas.
Action {
85- {
86- Action : "clusterName" ,
87- Resources : []mongodbatlas.Resource {
88- {
89- Db : "testdb" ,
90- Collection : "collection" ,
100+ },
101+ {
102+ input : []
string {
"[email protected] " },
103+ want : []mongodbatlas.Action {
104+ {
105+ Action : "clusterName" ,
106+ Resources : []mongodbatlas.Resource {
107+ {
108+ Db : "testdb" ,
109+ Collection : "collection" ,
110+ },
91111 },
92112 },
93113 },
94- }},
95- {input : []string {"clusterName" , "name@DATA_LAKE" }, want : []mongodbatlas.Action {
96- {
97- Action : "clusterName" ,
98- Resources : []mongodbatlas.Resource {
99- {
100- Cluster : & cluster ,
114+ },
115+ {
116+ input : []string {"clusterName" , "name@DATA_LAKE" },
117+ want : []mongodbatlas.Action {
118+ {
119+ Action : "clusterName" ,
120+ Resources : []mongodbatlas.Resource {
121+ {
122+ Cluster : & cluster ,
123+ },
101124 },
102125 },
103- },
104- {
105- Action : "name" ,
106- Resources : []mongodbatlas. Resource {
107- {
108- Db : "DATA_LAKE" ,
126+ {
127+ Action : "name" ,
128+ Resources : []mongodbatlas. Resource {
129+ {
130+ Db : "DATA_LAKE" ,
131+ } ,
109132 },
110133 },
111134 },
112- }} ,
135+ },
113136 }
114137
115138 for _ , tc := range tests {
116- got := BuildAtlasActions (tc .input )
117- if err := deep .Equal (tc .want , got ); err != nil {
118- t .Fatalf ("expected: %v, got: %v" , tc .want , got )
119- }
139+ input := tc .input
140+ want := tc .want
141+ t .Run ("" , func (t * testing.T ) {
142+ t .Parallel ()
143+ got := BuildAtlasActions (input )
144+ if err := deep .Equal (want , got ); err != nil {
145+ t .Fatalf ("expected: %v, got: %v" , want , got )
146+ }
147+ })
120148 }
121149}
0 commit comments