Skip to content

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

Open
lucaspimentel wants to merge 3 commits into
mainfrom
lpimentel/dedupe-trace-processor-test-preamble
Open

test(traces): dedupe test preamble in trace_processor tests#1364
lucaspimentel wants to merge 3 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

This comment has been minimized.

@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
@lucaspimentel
lucaspimentel marked this pull request as ready for review September 10, 2026 14:27
Copilot AI lite review requested due to automatic review settings September 10, 2026 14:27
@lucaspimentel
lucaspimentel requested review from a team as code owners September 10, 2026 14:27
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 10, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-10T14:28:57.902542Z 7d920b4 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The change is a test-only refactor with no behavioral changes to production code, and the identified issue is a minor maintainability nit.

Pull request overview

Refactors ServerlessTraceProcessor unit tests in trace_processor.rs by extracting repeated test setup into shared helper functions within mod tests, reducing duplication while keeping production behavior unchanged.

Changes:

  • Added shared test helpers to construct common Config, Provider/ServerlessTraceProcessor, and TracerHeaderTags values.
  • Updated the affected tests to use the new helpers, preserving the one test that intentionally uses the default (non-compute-stats) configuration.
File summaries
File Description
bottlecap/src/traces/trace_processor.rs Test-only refactor: deduplicates repeated trace processor test preamble via shared helpers.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread bottlecap/src/traces/trace_processor.rs
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.

2 participants