Skip to content

Commit ffd0a27

Browse files
authored
[7.1.0] Remove unnecessary test assertions to fix flakiness. (#21354)
After df07d27, the tree artifact contents are traversed in nondeterministic order. These test cases only care whether the exception was propagated. PiperOrigin-RevId: 606983523 Change-Id: I62441b5a0ae48d202947684f87f8928a63b9d070
1 parent a7a89fe commit ffd0a27

File tree

1 file changed

+2
-25
lines changed

1 file changed

+2
-25
lines changed

src/test/java/com/google/devtools/build/lib/skyframe/TreeArtifactValueTest.java

+2-25
Original file line numberDiff line numberDiff line change
@@ -476,20 +476,10 @@ public void visitTree_throwsOnSymlinkPointingOutsideTree() throws Exception {
476476
Path treeDir = scratch.dir("tree");
477477
scratch.file("outside");
478478
scratch.resolve("tree/link").createSymbolicLink(PathFragment.create("../outside"));
479-
List<Pair<PathFragment, Dirent.Type>> children = new ArrayList<>();
480479

481480
Exception e =
482481
assertThrows(
483-
IOException.class,
484-
() ->
485-
TreeArtifactValue.visitTree(
486-
treeDir,
487-
(child, type) -> {
488-
synchronized (children) {
489-
children.add(Pair.of(child, type));
490-
}
491-
}));
492-
assertThat(children).containsExactly(Pair.of(PathFragment.create(""), Dirent.Type.DIRECTORY));
482+
IOException.class, () -> TreeArtifactValue.visitTree(treeDir, (child, type) -> {}));
493483
assertThat(e).hasMessageThat().contains("/tree/link pointing to ../outside");
494484
}
495485

@@ -498,23 +488,10 @@ public void visitTree_throwsOnSymlinkTraversingOutsideThenBackInsideTree() throw
498488
Path treeDir = scratch.dir("tree");
499489
scratch.file("tree/file");
500490
scratch.resolve("tree/link").createSymbolicLink(PathFragment.create("../tree/file"));
501-
List<Pair<PathFragment, Dirent.Type>> children = new ArrayList<>();
502491

503492
Exception e =
504493
assertThrows(
505-
IOException.class,
506-
() ->
507-
TreeArtifactValue.visitTree(
508-
treeDir,
509-
(child, type) -> {
510-
synchronized (children) {
511-
children.add(Pair.of(child, type));
512-
}
513-
}));
514-
assertThat(children)
515-
.containsExactly(
516-
Pair.of(PathFragment.create(""), Dirent.Type.DIRECTORY),
517-
Pair.of(PathFragment.create("file"), Dirent.Type.FILE));
494+
IOException.class, () -> TreeArtifactValue.visitTree(treeDir, (child, type) -> {}));
518495
assertThat(e).hasMessageThat().contains("/tree/link pointing to ../tree/file");
519496
}
520497

0 commit comments

Comments
 (0)