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

[fix][test] fix test testSyncNormalPositionWhenTBRecover #22120

Merged
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 @@ -217,14 +217,14 @@ public void testSyncNormalPositionWhenTBRecover(boolean clientEnableTransaction,
position = topicTransactionBuffer.getMaxReadPosition();
assertEquals(position, PositionImpl.EARLIEST);

// change to None state can recover
field.set(topicTransactionBuffer, TopicTransactionBufferState.State.None);

// invoke recover
Method method = TopicTransactionBuffer.class.getDeclaredMethod("recover");
method.setAccessible(true);
method.invoke(topicTransactionBuffer);

// change to None state can recover
field.set(topicTransactionBuffer, TopicTransactionBufferState.State.None);

// recover success again
checkTopicTransactionBufferState(clientEnableTransaction, topicTransactionBuffer);

Expand All @@ -236,13 +236,15 @@ public void testSyncNormalPositionWhenTBRecover(boolean clientEnableTransaction,
private void checkTopicTransactionBufferState(boolean clientEnableTransaction,
TopicTransactionBuffer topicTransactionBuffer) {
// recover success
Awaitility.await().until(() -> {
Awaitility.await().untilAsserted(() -> {
if (clientEnableTransaction) {
// recover success, client enable transaction will change to Ready State
return topicTransactionBuffer.getStats(false, false).state.equals(Ready.name());
assertEquals(topicTransactionBuffer.getStats(false, false).state,
Ready.name());
} else {
// recover success, client disable transaction will change to NoSnapshot State
return topicTransactionBuffer.getStats(false, false).state.equals(NoSnapshot.name());
assertEquals(topicTransactionBuffer.getStats(false, false).state,
NoSnapshot.name());
}
});
}
Expand Down
Loading