-
Notifications
You must be signed in to change notification settings - Fork 62
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 flaky testCreateTopics #733
Conversation
5784be8
to
19c6a3f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@brandboat 感謝修正,可否協助在 docs 補充說明 post 回傳的結果可能不是最新的狀態
@@ -134,10 +134,20 @@ void testCreateTopics() { | |||
topicName0, topicName1))); | |||
var topics = handler.post(request); | |||
Assertions.assertEquals(2, topics.topics.size()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果確定是 sync 太慢,那這一行應該也是有風險?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
這倒不會,如果沒來得及取得 topic 細節資訊,回傳的資訊僅會包含request 的 topic names
Assertions.assertEquals(2, t1.partitions.size()); | ||
// the topic creation is not synced, so we have to wait the creation. | ||
if (topics.topics.get(0).partitions.isEmpty()) { | ||
Utils.sleep(Duration.ofSeconds(2)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
改成 post 後等待一段時間再使用 admin 撈資料如何?這樣就不用 if-else
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已經更新在最新的 commit 中,感謝審閱
19c6a3f
to
b38c6ea
Compare
resolve #722
類似的解法已經有在 testCreateTopicWithReplicas 提供
https://github.com/skiptests/astraea/blob/7596f590ae0f0ec370a6e257c10cc2aeb5fb5bf4/app/src/test/java/org/astraea/app/web/TopicHandlerTest.java#L244-L254