OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 /// Checks that all active test steps in [buildGroups] can be read from http. | 5 /// Checks that all active test steps in [buildGroups] can be read from http. |
6 | 6 |
7 import 'package:args/args.dart'; | 7 import 'package:args/args.dart'; |
8 import 'package:expect/expect.dart'; | 8 import 'package:expect/expect.dart'; |
| 9 import 'package:gardening/src/bot.dart'; |
9 import 'package:gardening/src/buildbot_data.dart'; | 10 import 'package:gardening/src/buildbot_data.dart'; |
10 import 'package:gardening/src/buildbot_structures.dart'; | 11 import 'package:gardening/src/buildbot_structures.dart'; |
11 import 'package:gardening/src/client.dart'; | |
12 import 'package:gardening/src/util.dart'; | 12 import 'package:gardening/src/util.dart'; |
13 | 13 |
14 main(List<String> args) async { | 14 main(List<String> args) async { |
15 ArgParser argParser = createArgParser(); | 15 ArgParser argParser = createArgParser(); |
16 ArgResults argResults = argParser.parse(args); | 16 ArgResults argResults = argParser.parse(args); |
17 processArgResults(argResults); | 17 processArgResults(argResults); |
18 bool useLogdog = argResults['logdog']; | 18 bool useLogdog = argResults['logdog']; |
19 | 19 |
20 BuildbotClient client = | 20 Bot bot = new Bot(logdog: useLogdog); |
21 useLogdog ? new LogdogBuildbotClient() : new HttpBuildbotClient(); | |
22 | 21 |
23 List<String> failingUris = <String>[]; | 22 List<String> failingUris = <String>[]; |
| 23 List<BuildUri> buildUris = <BuildUri>[]; |
24 for (BuildGroup buildGroup in buildGroups) { | 24 for (BuildGroup buildGroup in buildGroups) { |
25 for (BuildSubgroup buildSubgroup in buildGroup.subgroups) { | 25 for (BuildSubgroup buildSubgroup in buildGroup.subgroups) { |
26 if (!useLogdog && !buildSubgroup.isActive) continue; | 26 if (!useLogdog && !buildSubgroup.isActive) continue; |
27 List<BuildUri> buildUris = | 27 buildUris.addAll(buildSubgroup.createUris(bot.mostRecentBuildNumber)); |
28 buildSubgroup.createUris(client.mostRecentBuildNumber); | 28 } |
29 for (BuildUri buildUri in buildUris) { | 29 } |
30 BuildResult result = await client.readResult(buildUri); | 30 List<BuildResult> buildResults = await bot.readResults(buildUris); |
31 if (result == null) { | 31 for (int index = 0; index < buildResults.length; index++) { |
32 failingUris.add('$buildUri'); | 32 BuildUri buildUri = buildUris[index]; |
33 } | 33 BuildResult result = buildResults[index]; |
34 } | 34 if (result == null) { |
| 35 failingUris.add('$buildUri'); |
35 } | 36 } |
36 } | 37 } |
37 // TODO(johnniwinther): Find out why these steps cannot be read. | 38 // TODO(johnniwinther): Find out why these steps cannot be read. |
38 Expect.setEquals([ | 39 Expect.setEquals([ |
39 '/builders/pkg-mac10.11-release-be/builds/-2/' | 40 '/builders/pkg-mac10.11-release-be/builds/-1/' |
40 'steps/third_party/pkg_tested unit tests', | 41 'steps/third_party/pkg_tested unit tests', |
41 '/builders/pkg-linux-release-be/builds/-2/steps/' | 42 '/builders/pkg-linux-release-be/builds/-1/steps/' |
42 'third_party/pkg_tested unit tests', | 43 'third_party/pkg_tested unit tests', |
43 '/builders/pkg-win7-release-be/builds/-2/steps/' | 44 '/builders/pkg-win7-release-be/builds/-1/steps/' |
44 'third_party/pkg_tested unit tests', | 45 'third_party/pkg_tested unit tests', |
45 ], failingUris, "Unexpected failing buildbot uris: $failingUris"); | 46 ], failingUris, |
| 47 "Unexpected failing buildbot uris:\n ${failingUris.join('\n ')}"); |
46 | 48 |
47 client.close(); | 49 bot.close(); |
48 } | 50 } |
OLD | NEW |