Skip to content

test: Improve OTLP Builder test #2817

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

Merged
merged 4 commits into from
Mar 17, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions opentelemetry-otlp/src/exporter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@
#[cfg(feature = "logs")]
#[cfg(any(feature = "http-proto", feature = "http-json"))]
#[test]
#[ignore = "Unstable due to interference from env variable tests. Re-enable after https://github.com/open-telemetry/opentelemetry-rust/issues/2818 is resolved."]
fn export_builder_error_invalid_http_endpoint() {
use std::time::Duration;

Expand All @@ -358,15 +359,20 @@
.with_export_config(ex_config)
.build();

assert!(matches!(
exporter_result,
Err(crate::exporter::ExporterBuildError::InvalidUri(_, _))
));
assert!(
matches!(
exporter_result,

Check warning on line 364 in opentelemetry-otlp/src/exporter/mod.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-otlp/src/exporter/mod.rs#L362-L364

Added lines #L362 - L364 were not covered by tests
Err(crate::exporter::ExporterBuildError::InvalidUri(_, _))
),
"Expected InvalidUri error, but got {:?}",

Check warning on line 367 in opentelemetry-otlp/src/exporter/mod.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-otlp/src/exporter/mod.rs#L367

Added line #L367 was not covered by tests
exporter_result
);
}

#[cfg(feature = "grpc-tonic")]
#[test]
fn export_builder_error_invalid_grpc_endpoint() {
#[tokio::test]
#[ignore = "Unstable due to interference from env variable tests. Re-enable after https://github.com/open-telemetry/opentelemetry-rust/issues/2818 is resolved."]
async fn export_builder_error_invalid_grpc_endpoint() {

Check warning on line 375 in opentelemetry-otlp/src/exporter/mod.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-otlp/src/exporter/mod.rs#L375

Added line #L375 was not covered by tests
use std::time::Duration;

use crate::{ExportConfig, LogExporter, Protocol, WithExportConfig};
Expand Down