fix: default url for telemetry should include protocol

closes: https://github.com/influxdata/influxdb/issues/25502
praveen/fix-telemetry-url-panic
Praveen Kumar 2024-11-04 11:20:58 +00:00
parent aa70a73487
commit 7939a56c5f
No known key found for this signature in database
GPG Key ID: CB9E05780A79EA5A
2 changed files with 14 additions and 1 deletions

View File

@ -267,7 +267,7 @@ pub struct Config {
#[clap(
long = "telemetry-endpoint",
env = "INFLUXDB3_TELEMETRY_ENDPOINT",
default_value = "localhost",
default_value = "http://127.0.0.1:9999",
action
)]
pub telemetry_endpoint: String,

View File

@ -132,6 +132,19 @@ mod tests {
mock.assert_async().await;
}
#[test_log::test(test)]
#[should_panic]
fn test_sender_creation_with_invalid_url_panics() {
let client = reqwest::Client::new();
let _ = TelemetrySender::new(client, "localhost");
}
#[test_log::test(test)]
fn test_sender_creation_with_valid_url_succeeds() {
let client = reqwest::Client::new();
let _ = TelemetrySender::new(client, "http://localhost");
}
#[test]
fn test_url_join() {
let url = Url::parse("https://foo.com/boo/1.html").unwrap();