@@ -489,6 +489,8 @@ impl GenResmokeTaskServiceImpl {
489
489
}
490
490
}
491
491
492
+ test_list. shuffle ( & mut thread_rng ( ) ) ;
493
+
492
494
Ok ( test_list)
493
495
}
494
496
@@ -513,8 +515,7 @@ impl GenResmokeTaskServiceImpl {
513
515
multiversion_tags : Option < String > ,
514
516
) -> Result < Vec < SubSuite > > {
515
517
let origin_suite = multiversion_name. unwrap_or ( & params. suite_name ) ;
516
- let mut test_list = self . get_test_list ( params, multiversion_name) ?;
517
- test_list. shuffle ( & mut thread_rng ( ) ) ;
518
+ let test_list = self . get_test_list ( params, multiversion_name) ?;
518
519
let n_suites = min ( test_list. len ( ) , self . config . n_suites ) ;
519
520
let tasks_per_suite = test_list. len ( ) / n_suites;
520
521
@@ -1088,7 +1089,8 @@ mod tests {
1088
1089
// a single test. The second 2 tests and the third 3 tests. We will set the test runtimes
1089
1090
// to make this happen.
1090
1091
let n_suites = 3 ;
1091
- let test_list: Vec < String > = ( 0 ..6 )
1092
+ let n_tests = 6 ;
1093
+ let test_list: Vec < String > = ( 0 ..n_tests)
1092
1094
. into_iter ( )
1093
1095
. map ( |i| format ! ( "test_{}.js" , i) )
1094
1096
. collect ( ) ;
@@ -1103,8 +1105,13 @@ mod tests {
1103
1105
"test_5" . to_string( ) => build_mock_test_runtime( "test_5.js" , 34.0 ) ,
1104
1106
} ,
1105
1107
} ;
1106
- let gen_resmoke_service =
1107
- build_mocked_service ( test_list, task_history. clone ( ) , n_suites, vec ! [ ] , vec ! [ ] ) ;
1108
+ let gen_resmoke_service = build_mocked_service (
1109
+ test_list. clone ( ) ,
1110
+ task_history. clone ( ) ,
1111
+ n_suites,
1112
+ vec ! [ ] ,
1113
+ vec ! [ ] ,
1114
+ ) ;
1108
1115
1109
1116
let params = ResmokeGenParams {
1110
1117
..Default :: default ( )
@@ -1115,15 +1122,14 @@ mod tests {
1115
1122
. unwrap ( ) ;
1116
1123
1117
1124
assert_eq ! ( sub_suites. len( ) , n_suites) ;
1118
- let suite_0 = & sub_suites[ 0 ] ;
1119
- assert ! ( suite_0. test_list. contains( & "test_0.js" . to_string( ) ) ) ;
1120
- let suite_1 = & sub_suites[ 1 ] ;
1121
- assert ! ( suite_1. test_list. contains( & "test_1.js" . to_string( ) ) ) ;
1122
- assert ! ( suite_1. test_list. contains( & "test_2.js" . to_string( ) ) ) ;
1123
- let suite_2 = & sub_suites[ 2 ] ;
1124
- assert ! ( suite_2. test_list. contains( & "test_3.js" . to_string( ) ) ) ;
1125
- assert ! ( suite_2. test_list. contains( & "test_4.js" . to_string( ) ) ) ;
1126
- assert ! ( suite_2. test_list. contains( & "test_5.js" . to_string( ) ) ) ;
1125
+ let all_tests: Vec < String > = sub_suites
1126
+ . iter ( )
1127
+ . flat_map ( |s| s. test_list . clone ( ) )
1128
+ . collect ( ) ;
1129
+ assert_eq ! ( all_tests. len( ) , n_tests) ;
1130
+ for test_name in test_list {
1131
+ assert ! ( all_tests. contains( & test_name. to_string( ) ) ) ;
1132
+ }
1127
1133
}
1128
1134
1129
1135
#[ test]
@@ -1216,8 +1222,13 @@ mod tests {
1216
1222
task_name : "my task" . to_string ( ) ,
1217
1223
test_map : hashmap ! { } ,
1218
1224
} ;
1219
- let gen_resmoke_service =
1220
- build_mocked_service ( test_list, task_history. clone ( ) , n_suites, vec ! [ ] , vec ! [ ] ) ;
1225
+ let gen_resmoke_service = build_mocked_service (
1226
+ test_list. clone ( ) ,
1227
+ task_history. clone ( ) ,
1228
+ n_suites,
1229
+ vec ! [ ] ,
1230
+ vec ! [ ] ,
1231
+ ) ;
1221
1232
1222
1233
let params = ResmokeGenParams {
1223
1234
..Default :: default ( )
@@ -1237,6 +1248,9 @@ mod tests {
1237
1248
. flat_map ( |s| s. test_list . clone ( ) )
1238
1249
. collect ( ) ;
1239
1250
assert_eq ! ( all_tests. len( ) , n_tests) ;
1251
+ for test_name in test_list {
1252
+ assert ! ( all_tests. contains( & test_name. to_string( ) ) ) ;
1253
+ }
1240
1254
}
1241
1255
1242
1256
// tests for get_test_list.
0 commit comments