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 test in BalancerHandlerTest #717

Merged

Conversation

garyparrot
Copy link
Collaborator

@garyparrot garyparrot commented Sep 15, 2022

Source: https://github.com/skiptests/astraea/actions/runs/3060745599/jobs/4939630645#step:5:509

BalancerHandlerTest 裡面有一段邏輯在確保被改變的 topics 數量是 2 個,但是經常發生數量是 0 的情況。

被改變的數量是0的源頭是找不到可用的計劃,目前測試裡面是使用 ReplicaSizeCost 來找計劃,而且目前邏輯直接拿第一個計劃來當做結果,加上計劃完全隨機產生,直覺上這樣測試不太能總是通過。

這個 PR 採用的修正是,使用一個總是回傳更好分數的 ClusterCost,確保更好的計劃被提出這件事總是成立。這樣做對確認 BalancerHandler 回傳的結果是否正確不影響。

@chia7712
Copy link
Contributor

@garyparrot 你貼的連結裡面失敗的設施是 TopicHandlerTest ,跟你的描述好像不太一樣?

@garyparrot
Copy link
Collaborator Author

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.

感謝回報和修復,這個解法很棒,+1

@garyparrot garyparrot merged commit 2c915f2 into opensource4you:main Sep 16, 2022
@garyparrot garyparrot deleted the fix-flaky-test-balancer-handler branch September 16, 2022 01:48
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.

2 participants