Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Investigating the flaky fileWatcher test #3750

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -15,10 +15,8 @@
*/
package dev.knative.eventing.kafka.broker.core.file;

import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE;
import static java.nio.file.StandardWatchEventKinds.ENTRY_DELETE;
import static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY;
import static java.nio.file.StandardWatchEventKinds.OVERFLOW;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.io.IOException;
Expand All @@ -27,8 +25,8 @@
import java.nio.file.WatchService;
import java.util.Objects;
import java.util.concurrent.CountDownLatch;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static java.nio.file.StandardWatchEventKinds.*;

/**
* This class is responsible for watching a given file and reports update or execute a trigger function.
Expand Down Expand Up @@ -128,6 +126,7 @@ public void run() {
WatchKey key;
try {
key = watcher.take();
Thread.sleep( 50 );
logger.debug("Contract updates");
} catch (InterruptedException e) {
break; // Thread.interrupt was invoked
Expand Down
Expand Up @@ -43,6 +43,7 @@ public void tearDown() throws Exception {
}

@Test
@RepeatedTest(10)
public void testFileModification() throws Exception {
// Set up a counter to track how many times the trigger function is called
AtomicInteger counter = new AtomicInteger(0);
Expand Down