Unverified Commit 0fe29f58 authored by Jesús S Guerrero's avatar Jesús S Guerrero Committed by GitHub

Raise an exception when invalid subshard name (#113222)

parent 563e0a4a
...@@ -1972,7 +1972,7 @@ List<T> _selectIndexOfTotalSubshard<T>(List<T> tests, {String subshardKey = kSub ...@@ -1972,7 +1972,7 @@ List<T> _selectIndexOfTotalSubshard<T>(List<T> tests, {String subshardKey = kSub
foundError(<String>[ foundError(<String>[
'${red}Invalid subshard name "$subshardName". Expected format "[int]_[int]" ex. "1_3"', '${red}Invalid subshard name "$subshardName". Expected format "[int]_[int]" ex. "1_3"',
]); ]);
return <T>[]; throw Exception('Invalid subshard name: $subshardName');
} }
// One-indexed. // One-indexed.
final int index = int.parse(match.group(1)!); final int index = int.parse(match.group(1)!);
......
...@@ -144,5 +144,13 @@ void main() { ...@@ -144,5 +144,13 @@ void main() {
expectExitCode(result, 1); expectExitCode(result, 1);
expect(result.stdout, contains('Invalid subshard name')); expect(result.stdout, contains('Invalid subshard name'));
}); });
test('exits with code 255 when invalid SUBSHARD name', () async {
final ProcessResult result = await runScript(
<String, String>{'SHARD': kTestHarnessShardName, 'SUBSHARD': 'invalid_name'},
);
expectExitCode(result, 255);
expect(result.stdout, contains('Invalid subshard name'));
});
}); });
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment