Unverified Commit 8712f63d authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Split tools_tests subshards into separate shards to support sub-sub-sharding (#75033)

parent 13fe079b
This diff is collapsed.
...@@ -8,6 +8,7 @@ import 'package:file/file.dart' as fs; ...@@ -8,6 +8,7 @@ import 'package:file/file.dart' as fs;
import 'package:file/memory.dart'; import 'package:file/memory.dart';
import 'package:mockito/mockito.dart'; import 'package:mockito/mockito.dart';
import 'package:path/path.dart' as path; import 'package:path/path.dart' as path;
import 'package:process/process.dart';
import '../test.dart'; import '../test.dart';
import 'common.dart'; import 'common.dart';
...@@ -80,4 +81,44 @@ void main() { ...@@ -80,4 +81,44 @@ void main() {
expect(actualHash, kSampleHash); expect(actualHash, kSampleHash);
}); });
}); });
group('test.dart script', () {
const ProcessManager processManager = LocalProcessManager();
Future<ProcessResult> runScript(
[Map<String, String> environment, List<String> otherArgs = const <String>[]]) async {
final String dart = path.absolute(
path.join('..', '..', 'bin', 'cache', 'dart-sdk', 'bin', 'dart'));
final ProcessResult scriptProcess = processManager.runSync(<String>[
dart,
'test.dart',
...otherArgs,
], environment: environment);
return scriptProcess;
}
test('subshards tests correctly', () async {
ProcessResult result = await runScript(
<String, String>{'SHARD': 'smoke_tests', 'SUBSHARD': '1_3'},
);
expect(result.exitCode, 0);
// There are currently 6 smoke tests. This shard should contain test 1 and 2.
expect(result.stdout, contains('Selecting subshard 1 of 3 (range 1-2 of 6)'));
result = await runScript(
<String, String>{'SHARD': 'smoke_tests', 'SUBSHARD': '5_6'},
);
expect(result.exitCode, 0);
// This shard should contain only test 5.
expect(result.stdout, contains('Selecting subshard 5 of 6 (range 5-5 of 6)'));
});
test('exits with code 1 when SUBSHARD index greater than total', () async {
final ProcessResult result = await runScript(
<String, String>{'SHARD': 'smoke_tests', 'SUBSHARD': '100_99'},
);
expect(result.exitCode, 1);
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