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

[metasrv] Fix flaky test #6242 #6248

Merged
merged 3 commits into from
Jun 27, 2022
Merged

[metasrv] Fix flaky test #6242 #6248

merged 3 commits into from
Jun 27, 2022

Conversation

ariesdevil
Copy link
Contributor

I hereby agree to the terms of the CLA available at: https://databend.rs/dev/policies/cla/

Summary

Fix flaky test #6242

Changelog

  • Bug Fix

Related Issues

Fixes #6242

@vercel
Copy link

vercel bot commented Jun 27, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
databend ✅ Ready (Inspect) Visit Preview Jun 27, 2022 at 9:58AM (UTC)

@mergify
Copy link
Contributor

mergify bot commented Jun 27, 2022

Thanks for the contribution!
I have applied any labels matching special text in your PR Changelog.

Please review the labels and make any necessary changes.

@mergify mergify bot added the pr-bugfix this PR patches a bug in codebase label Jun 27, 2022
Copy link
Member

@Xuanwo Xuanwo left a comment

Choose a reason for hiding this comment

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

Most LGTM with some optional style-related suggestions.

metasrv/tests/it/grpc/metasrv_grpc_api.rs Show resolved Hide resolved
metasrv/tests/it/grpc/metasrv_grpc_api.rs Outdated Show resolved Hide resolved
@drmingdrmer
Copy link
Member

BTW, it's quite annoying to wait/sleep in testing code. Is it possible for raft to implement something like notify or watch (test only)? @drmingdrmer

@Xuanwo
I guess raft_node.wait(Some(Duration::from_secs(10))).metrics(|x| condition_satisfied(x)) is what you want. It will return once the condition defined in metrics() is satisfied or the timeout expired.

The other sleep() is to wait for the background task to update the endpoints list.
There are no corresponding metrics for this state. Thus it has to sleep.

Indeed it will be better to use a sleep-check for-loop here at line 413 @ariesdevil :

        tokio::time::sleep(Duration::from_secs(15)).await;
        let res = client.get_endpoints().await?;
        let res: HashSet<String> = HashSet::from_iter(res.into_iter());
        assert!(
            res.contains(&addr3),
            "endpoints should contains new addr when add node"
        );

@Xuanwo
Copy link
Member

Xuanwo commented Jun 27, 2022

I guess raft_node.wait(Some(Duration::from_secs(10))).metrics(|x| condition_satisfied(x)) is what you want. It will return once the condition defined in metrics() is satisfied or the timeout expired.

Thanks for the explanation!

@ariesdevil ariesdevil marked this pull request as draft June 27, 2022 07:01
@ariesdevil
Copy link
Contributor Author

@Mergifyio update

@mergify
Copy link
Contributor

mergify bot commented Jun 27, 2022

update

✅ Branch has been successfully updated

@Xuanwo
Copy link
Member

Xuanwo commented Jun 27, 2022

Waiting for test_stateless_standalone_linux

@ariesdevil
Copy link
Contributor Author

Waiting for test_stateless_standalone_linux

no runner quq...

mergify bot added a commit that referenced this pull request Jun 27, 2022
mergify bot added a commit that referenced this pull request Jun 27, 2022
@BohuTANG BohuTANG merged commit dfdb94d into databendlabs:main Jun 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need-review pr-bugfix this PR patches a bug in codebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: Flaky test about grpc::metasrv_grpc_api::test_auto_sync_addr
5 participants