Skip to content

fix: flaky per resource event source test #1845

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

Merged
merged 1 commit into from
Apr 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public void run() {
var primary = resourceCache.get(primaryID);
if (primary.isEmpty()) {
log.warn("No resource in cache for resource ID: {}", primaryID);
// no new execution is scheduled in this case, a on delete event should be received shortly
// no new execution is scheduled in this case, an on delete event should be received shortly
} else {
var actualResources = primary.map(p -> getAndCacheResource(p, false));
scheduleNextExecution(primary.get(), actualResources.orElse(null));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,12 @@ void deleteEventCancelsTheScheduling() {
.pollInterval(Duration.ofMillis(20))
.untilAsserted(() -> verify(supplier,times(1)).fetchResources(any()));

when(resourceCache.get(any())).thenReturn(Optional.empty());
source.onResourceDeleted(testCustomResource);

// check if not called again.
await().pollDelay(Duration.ofMillis(PERIOD))
.atMost(Duration.ofMillis((2* PERIOD)))
// check if not called again
await().pollDelay(Duration.ofMillis(2*PERIOD))
.atMost(Duration.ofMillis((4* PERIOD)))
.untilAsserted(() -> verify(supplier,times(1)).fetchResources(any()));
}

Expand Down