Skip to content

Commit

Permalink
Improve test
Browse files Browse the repository at this point in the history
  • Loading branch information
arunpandianp committed Feb 4, 2025
1 parent 373a716 commit 55f2d45
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -473,11 +473,15 @@ public void testFailWork() {
for (long cacheToken : Arrays.asList(5L, 6L)) {
WorkId workId =
WorkId.builder().setWorkToken(++workToken).setCacheToken(cacheToken).build();
activeWorkState.failWorkForKey(
ImmutableList.of(WorkIdWithShardingKey.create(shardingKey, workId)));
boolean shouldFail = ThreadLocalRandom.current().nextBoolean();
if (shouldFail) {
activeWorkState.failWorkForKey(
ImmutableList.of(WorkIdWithShardingKey.create(shardingKey, workId)));
}
LinkedHashMap<WorkId, ExecutableWork> workIdExecutableWorkLinkedHashMap =
readOnlyActiveWork.get(shardingKey);
assertTrue(workIdExecutableWorkLinkedHashMap.get(workId).work().isFailed());
assertEquals(
shouldFail, workIdExecutableWorkLinkedHashMap.get(workId).work().isFailed());
}
}
}
Expand Down

0 comments on commit 55f2d45

Please sign in to comment.