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 flaky testCreateTopics #733

Merged
merged 1 commit into from
Sep 20, 2022
Merged

Conversation

brandboat
Copy link
Member

Copy link
Contributor

@chia7712 chia7712 left a 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());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果確定是 sync 太慢,那這一行應該也是有風險?

Copy link
Member Author

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));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

改成 post 後等待一段時間再使用 admin 撈資料如何?這樣就不用 if-else

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已經更新在最新的 commit 中,感謝審閱

@chia7712 chia7712 merged commit 80655dc into opensource4you:main Sep 20, 2022
@brandboat brandboat deleted the bugfix/fix-flaky branch September 21, 2022 02:24
garyparrot pushed a commit to garyparrot/astraea that referenced this pull request Sep 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix flaky testCreateTopics
2 participants