From c5a491239905a1cd4c4b11640827de0149d3ecdb Mon Sep 17 00:00:00 2001 From: Joe-Blount Date: Tue, 11 Jul 2023 10:43:09 -0500 Subject: [PATCH] chore: add compactor tracing test case --- .../tests/end_to_end_cases/tracing.rs | 52 +++++++++++++++++++ test_helpers_end_to_end/src/config.rs | 1 + 2 files changed, 53 insertions(+) diff --git a/influxdb_iox/tests/end_to_end_cases/tracing.rs b/influxdb_iox/tests/end_to_end_cases/tracing.rs index c3a159ab16..51a51b4109 100644 --- a/influxdb_iox/tests/end_to_end_cases/tracing.rs +++ b/influxdb_iox/tests/end_to_end_cases/tracing.rs @@ -194,3 +194,55 @@ pub async fn test_tracing_create_ingester_query_trace() { // wait for the UDP server to shutdown udp_capture.stop().await; } + +#[tokio::test] +async fn test_tracing_create_compactor_trace() { + test_helpers::maybe_start_logging(); + let database_url = maybe_skip_integration!(); + + let ingester_config = TestConfig::new_ingester(&database_url); + let router_config = TestConfig::new_router(&ingester_config); + let querier_config = TestConfig::new_querier(&ingester_config).with_querier_mem_pool_bytes(1); + let udp_capture = UdpCapture::new().await; + let compactor_config = TestConfig::new_compactor(&ingester_config).with_tracing(&udp_capture); + + let mut cluster = MiniCluster::new() + .with_router(router_config) + .await + .with_ingester(ingester_config) + .await + .with_querier(querier_config) + .await + .with_compactor_config(compactor_config); + + StepTest::new( + &mut cluster, + vec![ + Step::RecordNumParquetFiles, + Step::WriteLineProtocol(String::from( + "my_awesome_table,tag1=A,tag2=B val=42i 123456", + )), + // wait for partitions to be persisted + Step::WaitForPersisted { + expected_increase: 1, + }, + // Run the compactor + Step::Compact, + ], + ) + .run() + .await; + + // "shallow" packet inspection and verify the UDP server got omething that had some expected + // results. We could look for any text of any of the compaction spans. The name of the span + // for data fusion execution is arbitrarily chosen. + udp_capture + .wait_for(|m| m.to_string().contains("data_fusion")) + .await; + + // debugging assistance + //println!("Traces received (1):\n\n{:#?}", udp_capture.messages()); + + // wait for the UDP server to shutdown + udp_capture.stop().await; +} diff --git a/test_helpers_end_to_end/src/config.rs b/test_helpers_end_to_end/src/config.rs index 707f05eded..91bc9fdcb3 100644 --- a/test_helpers_end_to_end/src/config.rs +++ b/test_helpers_end_to_end/src/config.rs @@ -187,6 +187,7 @@ impl TestConfig { "custom-trace-header", ) .with_client_header("custom-trace-header", "4:3:2:1") + .with_env("INFLUXDB_IOX_COMPACTION_PARTITION_TRACE", "all") } /// Configure a custom debug name for tracing