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

Code changes for the new Clippy version and running test on Windows #1704

Merged
merged 13 commits into from
May 6, 2024

Conversation

utpilla
Copy link
Contributor

@utpilla utpilla commented May 2, 2024

Changes

After these changes, the commands specified in the test.sh file run successfully on Windows:

cargo test --workspace --all-features "$@" -- --test-threads=1

# See https://github.com/rust-lang/cargo/issues/5364
cargo test --manifest-path=opentelemetry/Cargo.toml --no-default-features

# Run global tracer provider test in single thread
cargo test --manifest-path=opentelemetry/Cargo.toml --all-features -- --ignored --test-threads=1

cargo test --manifest-path=opentelemetry/Cargo.toml --all-features
cargo test --manifest-path=opentelemetry-jaeger/Cargo.toml --all-features -- --test-threads=1
cargo test --manifest-path=opentelemetry-zipkin/Cargo.toml --all-features

@utpilla utpilla marked this pull request as ready for review May 3, 2024 00:20
@utpilla utpilla requested a review from a team May 3, 2024 00:20
@@ -1,3 +1,5 @@
#![cfg(unix)]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These tests use use std::os::unix::fs::PermissionsExt which cannot be used on Windows.

@utpilla utpilla changed the title Update tests Code changes for the new Clippy version and running test on Windows May 3, 2024
@@ -435,9 +435,11 @@ mod tests {
})
.expect("callback registration should succeed");

_ = meter_provider.force_flush();
Copy link
Contributor

Choose a reason for hiding this comment

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

why force_flush here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just to trigger the callback code deterministically. This lets us assert things on the receiver end with certainty instead of waiting for interval * 2 milliseconds and hoping that the sender sends the data in that time.

@@ -129,6 +129,7 @@ impl CollectorHttpClient {
}

#[cfg(test)]
#[allow(dead_code)]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is to suppress the clippy warning for the struct not being constructed. Check this for more details: https://github.com/open-telemetry/opentelemetry-rust/actions/runs/8943870592/job/24569519425?pr=1704

Copy link
Member

@lalitb lalitb May 5, 2024

Choose a reason for hiding this comment

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

I think the issue is that this module test_http_client is always defined, while used only when the feature rt-tokio is enabled. Should we define this module only when the rt-tokio is enabled?

#[cfg(test)]
#[cfg(feature = "rt-tokio")]
pub(crate) mod test_http_client {
    ..
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good idea. Covered this in #1711

@TommyCpp TommyCpp mentioned this pull request May 6, 2024
4 tasks
Copy link
Member

@lalitb lalitb left a comment

Choose a reason for hiding this comment

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

LGTM apart from the nit comment. Thanks for fixing the rust toolchain upgrade issues also :)

Copy link
Contributor

@TommyCpp TommyCpp left a comment

Choose a reason for hiding this comment

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

👍 Thanks for the fix

@cijothomas cijothomas merged commit a99438a into open-telemetry:main May 6, 2024
15 checks passed
@utpilla utpilla mentioned this pull request May 6, 2024
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.

4 participants