Skip to content

Commit

Permalink
test: change the exposed otlp testcontainer port to test the endpoint…
Browse files Browse the repository at this point in the history
… configuration

Signed-off-by: Fabrizio Sestito <[email protected]>
  • Loading branch information
fabriziosestito committed Dec 5, 2024
1 parent 36f9935 commit 896e93d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ pub(crate) fn default_test_config() -> Config {
log_level: "info".to_owned(),
log_fmt: "json".to_owned(),
log_no_color: false,
otlp_endpoint: None,
daemon: false,
daemon_pid_file: "policy_server.pid".to_owned(),
daemon_stdout_file: None,
Expand Down
13 changes: 10 additions & 3 deletions tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ async fn test_otel() {
traces_output_file_path.to_str().unwrap(),
"/tmp/traces.json",
))
.with_mapped_port(4317, 4317.into())
.with_mapped_port(1337, 4317.into())
.with_cmd(vec!["--config=/etc/otel-collector-config.yaml"])
.with_startup_timeout(Duration::from_secs(30))
.start()
Expand All @@ -783,8 +783,15 @@ async fn test_otel() {
let mut config = default_test_config();
config.metrics_enabled = true;
config.log_fmt = "otlp".to_string();
setup_metrics().unwrap();
setup_tracing(&config.log_level, &config.log_fmt, config.log_no_color).unwrap();
config.otlp_endpoint = Some("http://localhost:1337".to_string());
setup_metrics(config.otlp_endpoint.as_deref()).unwrap();
setup_tracing(
&config.log_level,
&config.log_fmt,
config.log_no_color,
config.otlp_endpoint.as_deref(),
)
.unwrap();

let app = app(config).await;

Expand Down

0 comments on commit 896e93d

Please sign in to comment.