@@ -245,6 +245,7 @@ NOTE: An error occurred while building plan-preview for applications of the foll
245
245
}
246
246
}
247
247
func TestSortResults (t * testing.T ) {
248
+ t .Parallel ()
248
249
testcases := []struct {
249
250
name string
250
251
results []* model.PlanPreviewCommandResult
@@ -300,6 +301,8 @@ func TestSortResults(t *testing.T) {
300
301
{
301
302
PipedId : "piped-2" ,
302
303
Results : []* model.ApplicationPlanPreviewResult {
304
+ {ApplicationName : "app-3" , Labels : map [string ]string {"env" : "staging" }},
305
+ {ApplicationName : "app-3" , Labels : map [string ]string {"env" : "prod" }},
303
306
{ApplicationName : "app-2" , Labels : map [string ]string {"env" : "staging" }},
304
307
{ApplicationName : "app-2" , Labels : map [string ]string {"env" : "prod" }},
305
308
},
@@ -318,7 +321,35 @@ func TestSortResults(t *testing.T) {
318
321
PipedId : "piped-2" ,
319
322
Results : []* model.ApplicationPlanPreviewResult {
320
323
{ApplicationName : "app-2" , Labels : map [string ]string {"env" : "prod" }},
324
+ {ApplicationName : "app-3" , Labels : map [string ]string {"env" : "prod" }},
321
325
{ApplicationName : "app-2" , Labels : map [string ]string {"env" : "staging" }},
326
+ {ApplicationName : "app-3" , Labels : map [string ]string {"env" : "staging" }},
327
+ },
328
+ },
329
+ },
330
+ },
331
+ {
332
+ name : "sort by multiple label keys" ,
333
+ results : []* model.PlanPreviewCommandResult {
334
+ {
335
+ PipedId : "piped-1" ,
336
+ Results : []* model.ApplicationPlanPreviewResult {
337
+ {ApplicationName : "app-1" , Labels : map [string ]string {"env" : "prod" , "team" : "team-2" }},
338
+ {ApplicationName : "app-1" , Labels : map [string ]string {"env" : "staging" , "team" : "team-1" }},
339
+ {ApplicationName : "app-1" , Labels : map [string ]string {"env" : "prod" , "team" : "team-1" }},
340
+ {ApplicationName : "app-2" , Labels : map [string ]string {"env" : "prod" , "team" : "team-2" }},
341
+ },
342
+ },
343
+ },
344
+ sortLabelKeys : []string {"env" , "team" },
345
+ expected : []* model.PlanPreviewCommandResult {
346
+ {
347
+ PipedId : "piped-1" ,
348
+ Results : []* model.ApplicationPlanPreviewResult {
349
+ {ApplicationName : "app-1" , Labels : map [string ]string {"env" : "prod" , "team" : "team-1" }},
350
+ {ApplicationName : "app-1" , Labels : map [string ]string {"env" : "prod" , "team" : "team-2" }},
351
+ {ApplicationName : "app-2" , Labels : map [string ]string {"env" : "prod" , "team" : "team-2" }},
352
+ {ApplicationName : "app-1" , Labels : map [string ]string {"env" : "staging" , "team" : "team-1" }},
322
353
},
323
354
},
324
355
},
0 commit comments