Skip to content

Commit 5b843fb

Browse files
test: change the exposed otlp testcontainer port to test the endpoint configuration
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
1 parent d47f1c6 commit 5b843fb

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

tests/common/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ pub(crate) fn default_test_config() -> Config {
120120
log_level: "info".to_owned(),
121121
log_fmt: "json".to_owned(),
122122
log_no_color: false,
123+
otlp_endpoint: None,
123124
daemon: false,
124125
daemon_pid_file: "policy_server.pid".to_owned(),
125126
daemon_stdout_file: None,

tests/integration_test.rs

+10-3
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ async fn test_otel() {
773773
traces_output_file_path.to_str().unwrap(),
774774
"/tmp/traces.json",
775775
))
776-
.with_mapped_port(4317, 4317.into())
776+
.with_mapped_port(1337, 4317.into())
777777
.with_cmd(vec!["--config=/etc/otel-collector-config.yaml"])
778778
.with_startup_timeout(Duration::from_secs(30))
779779
.start()
@@ -783,8 +783,15 @@ async fn test_otel() {
783783
let mut config = default_test_config();
784784
config.metrics_enabled = true;
785785
config.log_fmt = "otlp".to_string();
786-
setup_metrics().unwrap();
787-
setup_tracing(&config.log_level, &config.log_fmt, config.log_no_color).unwrap();
786+
config.otlp_endpoint = Some("http://localhost:1337".to_string());
787+
setup_metrics(config.otlp_endpoint.as_deref()).unwrap();
788+
setup_tracing(
789+
&config.log_level,
790+
&config.log_fmt,
791+
config.log_no_color,
792+
config.otlp_endpoint.as_deref(),
793+
)
794+
.unwrap();
788795

789796
let app = app(config).await;
790797

0 commit comments

Comments
 (0)