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 matching_status_* test failures #662

Merged
merged 4 commits into from
Jan 26, 2024

Conversation

YuanYuYuan
Copy link
Contributor

@YuanYuYuan YuanYuYuan commented Jan 25, 2024

Since we don't avoid the multicast port usage while testing. Sometimes the CI test on the main branch would fail due to the conflict of

cargo nextest run --exclude zenoh-examples --exclude zenoh-plugin-example --workspace -E 'test(=zenoh_session_multicast) | test(zenoh_matching_status)'

The same error happens frequently on the tokio branch. That's why we found it. And it's better to have Result to verbose the failure.


let publisher1 = ztimeout!(session1
.declare_publisher("zenoh_matching_status_any_test")
.allowed_destination(Locality::Any)
.res_async())
.unwrap();
.res_async())?;
Copy link
Member

Choose a reason for hiding this comment

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

In case of tests it's better to use unwrap() because the error message will tell exactly at which line the test has panicked. If ? is used, it's then harder to identify which is the line that fails.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay. Then I understand why we have our customized zerror since it prints more information than common errors.

#[cfg(feature = "unstable")]
#[test]
fn zenoh_matching_status_any() {
fn zenoh_matching_status_any() -> Result<()> {
Copy link
Member

Choose a reason for hiding this comment

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

Based on my comment below on unwrap(), there is no need to return a Result.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

};
let config2 = zenoh::config::client([Locator::from_str(locator)?]);

let session1 = ztimeout!(zenoh::open(config1).res_async())?;
Copy link
Member

Choose a reason for hiding this comment

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

Use unwrap() instead of ?.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Member

@Mallets Mallets left a comment

Choose a reason for hiding this comment

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

See my comments above.

@YuanYuYuan
Copy link
Contributor Author

@Mallets I've reverted the changes, can you help review this?

@YuanYuYuan YuanYuYuan force-pushed the fix/matching_status_tests branch from 3357fef to a1fdb49 Compare January 26, 2024 03:45
@Mallets Mallets merged commit 561c02d into eclipse-zenoh:main Jan 26, 2024
8 checks passed
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