Skip to content

test(traces): dedupe test preamble in trace_processor tests - #1364

Draft
lucaspimentel wants to merge 2 commits into
mainfrom
lpimentel/dedupe-trace-processor-test-preamble
Draft

test(traces): dedupe test preamble in trace_processor tests#1364
lucaspimentel wants to merge 2 commits into
mainfrom
lpimentel/dedupe-trace-processor-test-preamble

Conversation

@lucaspimentel

@lucaspimentel lucaspimentel commented Sep 8, 2026

Copy link
Copy Markdown
Member

Overview

Test-only refactor deferred from #1320 to keep that PR small.

Eight tests in traces/trace_processor.rs repeated the same setup: a Config, a Provider, a ServerlessTraceProcessor with an ObfuscationConfig, and a TracerHeaderTags value. This extracts that preamble into three shared test helpers inside mod tests:

  • create_compute_stats_config(): the shared config with lambda_extension_compute_stats: true used by seven of the tests
  • create_test_processor(&Arc<Config>, Arc<std::sync::Mutex<ErrorsSampler>>): builds the tags provider (lambda runtime, test-arn metadata) and the processor, taking the config and sampler as parameters
  • create_test_header_tags(): the shared 'static tracer header tags

Accepting the config as a parameter lets test_process_traces_body_size_reflects_enriched_payload keep its deliberate default configuration (local stats disabled) while sharing the rest of the setup. Sampler choices are unchanged: six tests use the enabled error sampler, two use the disabled one. No production code changes.

Testing

  • cargo test -p bottlecap traces::trace_processor::tests: same test count as before the refactor, all passing
  • cargo test -p bottlecap: all unit and integration tests pass
  • cargo fmt --all -- --check, cargo clippy --lib --tests, and git diff --check clean

@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented Sep 8, 2026

Copy link
Copy Markdown

Pipelines

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 7d920b4 | Docs | View more details | Give us feedback!

@lucaspimentel lucaspimentel changed the title APMSVLS-469: dedupe test preamble in trace_processor tests APMSVLS-469: test(traces): dedupe test preamble in trace_processor tests Sep 8, 2026
@lucaspimentel lucaspimentel changed the title APMSVLS-469: test(traces): dedupe test preamble in trace_processor tests [APMSVLS-469] test(traces): dedupe test preamble in trace_processor tests Sep 8, 2026
@lucaspimentel lucaspimentel changed the title [APMSVLS-469] test(traces): dedupe test preamble in trace_processor tests test(traces): dedupe test preamble in trace_processor tests Sep 8, 2026
Extract repeated Config, tags-provider, ServerlessTraceProcessor, and
TracerHeaderTags construction from eight trace-processor tests into
shared test helpers. No behavior change; the enriched-payload body-size
test keeps its default configuration with local stats disabled.
The helpers are used by tests beyond the error sampler ones, so name them
after what they build instead, matching the existing create_* convention
in the module.

🤖
@lucaspimentel
lucaspimentel force-pushed the lpimentel/dedupe-trace-processor-test-preamble branch from 198f665 to 7d920b4 Compare September 9, 2026 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant