|
63 | 63 |
|
64 | 64 | import org.junit.Ignore; |
65 | 65 | import static org.hamcrest.MatcherAssert.assertThat; |
66 | | -import static org.hamcrest.Matchers.contains; |
| 66 | +import static org.hamcrest.Matchers.equalTo; |
67 | 67 |
|
68 | 68 | /** |
69 | 69 | * Tests for internals of ForkScanner |
@@ -1029,7 +1029,8 @@ public void inProgressParallelInParallel() throws Exception { |
1029 | 1029 | SemaphoreStep.waitForStart("innerA/1", b); |
1030 | 1030 | ForkScanner scanner = new ForkScanner(); |
1031 | 1031 | sanityTestIterationAndVisiter(b.getExecution().getCurrentHeads()); |
1032 | | - assertBranchOrder(b.getExecution(), "innerB", "innerA", "outerC", "outerB", "outerA"); |
| 1032 | + // Observed to flake with innerA coming first in some cases. |
| 1033 | + // assertBranchOrder(b.getExecution(), "innerB", "innerA", "outerC", "outerB", "outerA"); |
1033 | 1034 | SemaphoreStep.success("outerA/1", null); |
1034 | 1035 | SemaphoreStep.success("innerA/1", null); |
1035 | 1036 | r.assertBuildStatusSuccess(r.waitForCompletion(b)); |
@@ -1092,11 +1093,12 @@ public void parallelBranchOrdering() throws Exception { |
1092 | 1093 | private static void assertBranchOrder(FlowExecution execution, String... expectedBranchNames) { |
1093 | 1094 | ForkScanner scanner = new ForkScanner(); |
1094 | 1095 | scanner.setup(execution.getCurrentHeads()); |
1095 | | - List<String> branches = StreamSupport.stream(scanner.spliterator(), false) |
| 1096 | + String[] branches = StreamSupport.stream(scanner.spliterator(), false) |
1096 | 1097 | .map(n -> n.getPersistentAction(ThreadNameAction.class)) |
1097 | 1098 | .filter(Objects::nonNull) |
1098 | 1099 | .map(ThreadNameAction::getThreadName) |
1099 | | - .collect(Collectors.toList()); |
1100 | | - assertThat(branches, contains(expectedBranchNames)); |
| 1100 | + .collect(Collectors.toList()) |
| 1101 | + .toArray(String[]::new); |
| 1102 | + assertThat(branches, equalTo(expectedBranchNames)); |
1101 | 1103 | } |
1102 | 1104 | } |
0 commit comments