Skip to content

Commit 2b5912a

Browse files
committed
Make tests more readable
Signed-off-by: Vishal Anarase <[email protected]>
1 parent 4dc0e85 commit 2b5912a

File tree

1 file changed

+28
-16
lines changed

1 file changed

+28
-16
lines changed

cli/pkg/workspace/plugin/create_test.go

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -192,16 +192,18 @@ func TestCreate(t *testing.T) {
192192
},
193193
{
194194
name: "create with create-context only",
195-
config: clientcmdapi.Config{CurrentContext: "test",
196-
Contexts: map[string]*clientcmdapi.Context{"test": {Cluster: "test", AuthInfo: "test"}},
197-
Clusters: map[string]*clientcmdapi.Cluster{"test": {Server: "https://test/clusters/root:foo"}},
195+
config: clientcmdapi.Config{
196+
CurrentContext: "test",
197+
Contexts: map[string]*clientcmdapi.Context{
198+
"test": {Cluster: "test", AuthInfo: "test"},
199+
},
200+
Clusters: map[string]*clientcmdapi.Cluster{
201+
"test": {Server: "https://test/clusters/root:foo"},
202+
},
198203
AuthInfos: map[string]*clientcmdapi.AuthInfo{"test": {Token: "test"}},
199204
},
200-
existingWorkspaces: []string{"test"},
201-
createContextName: "bar",
202-
useAfterCreation: false,
203-
markReady: true,
204-
expected: &clientcmdapi.Config{CurrentContext: "test",
205+
expected: &clientcmdapi.Config{
206+
CurrentContext: "test",
205207
Contexts: map[string]*clientcmdapi.Context{
206208
"test": {Cluster: "test", AuthInfo: "test"},
207209
"bar": {Cluster: "bar", AuthInfo: "test"},
@@ -212,19 +214,25 @@ func TestCreate(t *testing.T) {
212214
},
213215
AuthInfos: map[string]*clientcmdapi.AuthInfo{"test": {Token: "test"}},
214216
},
217+
existingWorkspaces: []string{"test"},
218+
createContextName: "bar",
219+
useAfterCreation: false,
220+
markReady: true,
215221
},
216222
{
217223
name: "create with create-context and enter",
218-
config: clientcmdapi.Config{CurrentContext: "test",
219-
Contexts: map[string]*clientcmdapi.Context{"test": {Cluster: "test", AuthInfo: "test"}},
220-
Clusters: map[string]*clientcmdapi.Cluster{"test": {Server: "https://test/clusters/root:foo"}},
224+
config: clientcmdapi.Config{
225+
CurrentContext: "test",
226+
Contexts: map[string]*clientcmdapi.Context{
227+
"test": {Cluster: "test", AuthInfo: "test"},
228+
},
229+
Clusters: map[string]*clientcmdapi.Cluster{
230+
"test": {Server: "https://test/clusters/root:foo"},
231+
},
221232
AuthInfos: map[string]*clientcmdapi.AuthInfo{"test": {Token: "test"}},
222233
},
223-
existingWorkspaces: []string{"test"},
224-
createContextName: "bar",
225-
useAfterCreation: true,
226-
markReady: true,
227-
expected: &clientcmdapi.Config{CurrentContext: "bar",
234+
expected: &clientcmdapi.Config{
235+
CurrentContext: "bar",
228236
Contexts: map[string]*clientcmdapi.Context{
229237
"test": {Cluster: "test", AuthInfo: "test"},
230238
"bar": {Cluster: "bar", AuthInfo: "test"},
@@ -235,6 +243,10 @@ func TestCreate(t *testing.T) {
235243
},
236244
AuthInfos: map[string]*clientcmdapi.AuthInfo{"test": {Token: "test"}},
237245
},
246+
existingWorkspaces: []string{"test"},
247+
createContextName: "bar",
248+
useAfterCreation: true,
249+
markReady: true,
238250
},
239251
}
240252
for _, tt := range tests {

0 commit comments

Comments
 (0)