diff options
Diffstat (limited to 'src/test/java/com/google')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/pkgcache/TargetPatternEvaluatorIOTest.java | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/pkgcache/TargetPatternEvaluatorIOTest.java b/src/test/java/com/google/devtools/build/lib/pkgcache/TargetPatternEvaluatorIOTest.java index fc83dfce58..37a992d405 100644 --- a/src/test/java/com/google/devtools/build/lib/pkgcache/TargetPatternEvaluatorIOTest.java +++ b/src/test/java/com/google/devtools/build/lib/pkgcache/TargetPatternEvaluatorIOTest.java @@ -13,8 +13,10 @@ // limitations under the License. package com.google.devtools.build.lib.pkgcache; +import com.google.common.collect.ImmutableSet; import com.google.common.truth.Truth; import com.google.devtools.build.lib.clock.BlazeClock; +import com.google.devtools.build.lib.events.EventKind; import com.google.devtools.build.lib.vfs.Dirent; import com.google.devtools.build.lib.vfs.FileStatus; import com.google.devtools.build.lib.vfs.FileSystem; @@ -86,9 +88,15 @@ public class TargetPatternEvaluatorIOTest extends AbstractTargetPatternEvaluator this.transformer = createInconsistentFileStateTransformer("parent/badstat"); // When we find all the targets beneath parent in keep_going mode, we get the valid target - // parent:parent, even though processing badstat threw an InconsistentFilesystemException. + // parent:parent, even though processing badstat threw an InconsistentFilesystemException, Truth.assertThat(parseListKeepGoing("//parent/...").getFirst()) .containsExactlyElementsIn(labels("//parent:parent")); + + // And the TargetPatternEvaluator reported the expected ERROR event to the handler. + assertContainsEvent( + "Failed to get information about path, for parent/badstat, skipping: Inconsistent " + + "filesystem operations", + ImmutableSet.of(EventKind.ERROR)); } /** @@ -109,9 +117,15 @@ public class TargetPatternEvaluatorIOTest extends AbstractTargetPatternEvaluator this.transformer = createBadDirectoryListingTransformer("parent/badstat"); // When we find all the targets beneath parent in keep_going mode, we get the valid target - // parent:parent, even though processing badstat threw an InconsistentFilesystemException. + // parent:parent, even though processing badstat threw an IOException, Truth.assertThat(parseListKeepGoing("//parent/...").getFirst()) .containsExactlyElementsIn(labels("//parent:parent")); + + // And the TargetPatternEvaluator reported the expected ERROR event to the handler. + assertContainsEvent( + "Failed to list directory contents, for parent/badstat, skipping: Path ended in " + + "parent/badstat, so readdir failed", + ImmutableSet.of(EventKind.ERROR)); } private Transformer createInconsistentFileStateTransformer(final String badPathSuffix) { |