Skip to content

Commit

Permalink
Fix up test
Browse files Browse the repository at this point in the history
  • Loading branch information
tgd committed Jan 26, 2024
1 parent bbfb632 commit 700ba32
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* This test demonstrates that:
* <ul>
* <li>For normal tailers the index is not persisted unless the context was properly closed</li>
* <li>For method readers it seems that if a method read operation fails midway the index advancement is still persisted</li>
* <li>For method readers we expect that if there is a failure during the read then the index advancement should not be persisted</li>
* </ul>
*/
public class NamedTailerFaultToleranceTest extends QueueTestCommon {
Expand All @@ -54,8 +54,7 @@ public void namedTailerIndexShouldNotBePersistedMidRead_regularTailer() throws I
/**
* This test creates a method writer and reader. The queue is populated with method writer invocations and then a
* separate process is started that will use a method reader to read 2 messages. The method reader will call System
* exit on its second invocation. Given that this invocation failed we would expect the index to not be advanced
* however it is.
* exit on its second invocation.
*/
@Test
public void namedTailerIndexShouldNotBePersistedMidRead_methodWriter() throws InterruptedException {
Expand All @@ -77,6 +76,7 @@ public void namedTailerIndexShouldNotBePersistedMidRead_methodWriter() throws In
private static void assertNamedTailerIndex(long expected) {
try (ChronicleQueue queue = createQueueInstance(); LongValue indexValue = queue.indexForId(TAILER_NAME)) {
long index = indexValue.getVolatileValue();
log.info("Actual named tailer index={}", index);
assertEquals(expected, index);
}
}
Expand Down Expand Up @@ -125,8 +125,8 @@ public static void main(String[] args) {
AtomicInteger counter = new AtomicInteger(0);

StringConsumer consumer = (s) -> {
log.info("Consumed, data={}", s);
if (counter.get() == 1) {
log.info("Consuming, data={}", s);
if (counter.get() > 1) {
log.info("Calling System.exit(-1) [in separate process pid={}]", Jvm.getProcessId());
System.exit(-1);
}
Expand Down

0 comments on commit 700ba32

Please sign in to comment.