Skip to content

chore(test): add shared config test helpers and cover config predicates - #2118

Merged
tobz merged 3 commits into
mainfrom
tobz/test-cleanup-config-test-helper-foundation
Jul 15, 2026
Merged

chore(test): add shared config test helpers and cover config predicates#2118
tobz merged 3 commits into
mainfrom
tobz/test-cleanup-config-test-helper-foundation

Conversation

@tobz

@tobz tobz commented Jul 14, 2026

Copy link
Copy Markdown
Member

Summary

This PR introduces a number of test hlpers for creating GenericConfiguration as required in various tests, and switches over a number of tests to use these new helpers.

Change Type

  • Bug fix
  • New feature
  • Non-functional (chore, refactoring, docs)
  • Performance

How did you test this PR?

New and existing unit tests.

References

DADP-2

tobz commented Jul 14, 2026

Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@dd-octo-sts dd-octo-sts Bot added area/config Configuration. area/components Sources, transforms, and destinations. area/test All things testing: unit/integration, correctness, SMP regression, etc. labels Jul 14, 2026
@datadog-prod-us1-5

This comment has been minimized.

@pr-commenter

pr-commenter Bot commented Jul 14, 2026

Copy link
Copy Markdown

Binary Size Analysis (Agent Data Plane)

Baseline: faadad5 · Comparison: a1e1bcc · diff
Analysis Configuration: stripped binaries · Pass/Fail Threshold: +5%
Sizes: 39.57 MiB (baseline) vs 39.58 MiB (comparison)
Size Change: +6.30 KiB (+0.02%)

✅ Binary size difference within threshold

Changes by Module
Module File Size Symbols
anon.af97149b0445cad8a4012b595e0bd85e.579.llvm.10574602561526825425 -16.39 KiB 1
anon.512d24b72dd11d19f36a4d5747fb931e.579.llvm.17768360911663887949 +16.30 KiB 1
anon.af97149b0445cad8a4012b595e0bd85e.700.llvm.10574602561526825425 -11.67 KiB 1
anon.512d24b72dd11d19f36a4d5747fb931e.700.llvm.17768360911663887949 +11.67 KiB 1
figment +9.69 KiB 777
anon.af97149b0445cad8a4012b595e0bd85e.209.llvm.10574602561526825425 -9.46 KiB 1
anon.512d24b72dd11d19f36a4d5747fb931e.209.llvm.17768360911663887949 +9.45 KiB 1
anon.af97149b0445cad8a4012b595e0bd85e.577.llvm.10574602561526825425 -8.81 KiB 1
anon.512d24b72dd11d19f36a4d5747fb931e.577.llvm.17768360911663887949 +8.80 KiB 1
anon.af97149b0445cad8a4012b595e0bd85e.3.llvm.10574602561526825425 -8.05 KiB 1
anon.512d24b72dd11d19f36a4d5747fb931e.3.llvm.17768360911663887949 +8.04 KiB 1
anon.af97149b0445cad8a4012b595e0bd85e.42.llvm.10574602561526825425 -7.03 KiB 1
anon.512d24b72dd11d19f36a4d5747fb931e.42.llvm.17768360911663887949 +7.03 KiB 1
anon.a462ed33ce22f3b693e3d34f7c946ddf.392.llvm.6638511991563817748 -6.01 KiB 1
anon.f243257c56b3346d93522c726e2f011e.392.llvm.9648298838685347262 +6.00 KiB 1
axum -5.73 KiB 460
matchit +5.69 KiB 35
anon.af97149b0445cad8a4012b595e0bd85e.575.llvm.10574602561526825425 -3.86 KiB 1
anon.512d24b72dd11d19f36a4d5747fb931e.575.llvm.17768360911663887949 +3.86 KiB 1
anon.af97149b0445cad8a4012b595e0bd85e.327.llvm.10574602561526825425 -3.74 KiB 1
Detailed Symbol Changes
    FILE SIZE        VM SIZE    
 --------------  -------------- 
  [NEW] +59.1Ki  [NEW] +59.0Ki    saluki_components::common::datadog::io::run_endpoint_io_loop::_{{closure}}::h993d5c57ebf263bd
  [NEW] +44.0Ki  [NEW] +43.9Ki    agent_data_plane::cli::run::handle_run_command::_{{closure}}::h269a10ac30b70c85
  [NEW] +43.6Ki  [NEW] +43.4Ki    _<saluki_components::forwarders::otlp::OtlpForwarder as saluki_core::components::forwarders::Forwarder>::run::_{{closure}}::h29a76a4ba92d0553
  [NEW] +35.6Ki  [NEW] +35.4Ki    _<saluki_components::transforms::apm_stats::ApmStats as saluki_core::components::transforms::Transform>::run::_{{closure}}::h426bca0ec788e1a2
  [NEW] +32.8Ki  [NEW] +32.7Ki    saluki_components::sources::otlp::metrics::translator::OtlpMetricsTranslator::translate_metrics::ha95697fb5f5066a9
  [NEW] +31.1Ki  [NEW] +30.9Ki    _<saluki_components::transforms::aggregate::Aggregate as saluki_core::components::transforms::Transform>::run::_{{closure}}::hd26f038711b53cd8
  [NEW] +30.2Ki  [NEW] +30.1Ki    agent_data_plane::cli::dogstatsd::handle_dogstatsd_command::_{{closure}}::h09e30375dbbfc7a5
  [NEW] +29.4Ki  [NEW] +29.2Ki    _<saluki_components::sources::dogstatsd::_::<impl serde_core::de::Deserialize for saluki_components::sources::dogstatsd::DogStatsDConfiguration>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map::h883e03a06cc41da6
  [NEW] +28.3Ki  [NEW] +28.1Ki    saluki_components::sources::dogstatsd::drive_stream::_{{closure}}::h104376214dcc290b
  [NEW] +28.1Ki  [NEW] +28.0Ki    agent_data_plane::cli::run::create_topology::_{{closure}}::hac2a7bcde4780228
  +0.0% +6.40Ki  +0.1% +8.07Ki    [44541 Others]
  [DEL] -28.1Ki  [DEL] -28.0Ki    agent_data_plane::cli::run::create_topology::_{{closure}}::hd8a72355ff003d67
  [DEL] -28.3Ki  [DEL] -28.1Ki    saluki_components::sources::dogstatsd::drive_stream::_{{closure}}::h238489a24a74cf7c
  [DEL] -29.5Ki  [DEL] -29.2Ki    _<saluki_components::sources::dogstatsd::_::<impl serde_core::de::Deserialize for saluki_components::sources::dogstatsd::DogStatsDConfiguration>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map::h18c6e37cde8d40d9
  [DEL] -30.2Ki  [DEL] -30.1Ki    agent_data_plane::cli::dogstatsd::handle_dogstatsd_command::_{{closure}}::ha69a4f26b997405c
  [DEL] -31.2Ki  [DEL] -31.0Ki    _<saluki_components::transforms::aggregate::Aggregate as saluki_core::components::transforms::Transform>::run::_{{closure}}::ha8f9871f3ff017ed
  [DEL] -32.9Ki  [DEL] -32.7Ki    saluki_components::sources::otlp::metrics::translator::OtlpMetricsTranslator::translate_metrics::hec9b0982420ae3da
  [DEL] -35.6Ki  [DEL] -35.4Ki    _<saluki_components::transforms::apm_stats::ApmStats as saluki_core::components::transforms::Transform>::run::_{{closure}}::hf73c1d365faff7fa
  [DEL] -43.5Ki  [DEL] -43.3Ki    _<saluki_components::forwarders::otlp::OtlpForwarder as saluki_core::components::forwarders::Forwarder>::run::_{{closure}}::h9dd32abe6e9e9d5b
  [DEL] -44.0Ki  [DEL] -43.9Ki    agent_data_plane::cli::run::handle_run_command::_{{closure}}::hea7b42ae4ce878b7
  [DEL] -59.1Ki  [DEL] -59.0Ki    saluki_components::common::datadog::io::run_endpoint_io_loop::_{{closure}}::h55e3ef7849629ffa
  +0.0% +6.30Ki  +0.0% +7.97Ki    TOTAL

@tobz
tobz force-pushed the tobz/test-cleanup-config-test-helper-foundation branch from fa40de5 to 89ec904 Compare July 14, 2026 17:01
@tobz
tobz force-pushed the tobz/test-cleanup-componentcontext-test-util branch from ec3ffc3 to 80fec81 Compare July 14, 2026 17:01
@tobz tobz changed the title test(config): add shared config test helpers and cover config predicates chore(test): add shared config test helpers and cover config predicates Jul 14, 2026
@tobz tobz added the type/chore Updates to dependencies or general "administrative" tasks necessary to maintain the codebase/repo. label Jul 14, 2026
@tobz
tobz marked this pull request as ready for review July 14, 2026 17:11
@tobz
tobz requested a review from a team as a code owner July 14, 2026 17:11
Copilot AI review requested due to automatic review settings July 14, 2026 17:11

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR adds shared test helpers in saluki-config to reduce duplicated test setup when building GenericConfiguration, and expands unit-test coverage for configuration predicates and env-var remapping behavior across crates.

Changes:

  • Added saluki_config::config_from and saluki_config::test_env_lock to standardize test configuration loading and env-var serialization.
  • Updated multiple test modules to use the shared helpers instead of per-file ConfigurationLoader::for_tests wrappers.
  • Expanded configuration predicate tests (notably in agent-data-plane) and added coverage for an MRF disabled-path.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
test/CLEANUP_PLAN.md Marks the shared config test-helper foundation task as completed.
lib/saluki-config/src/lib.rs Introduces shared env lock + config_from helper; loader now uses the shared lock.
lib/saluki-components/src/destinations/dsd_debug_log/mod.rs Refactors tests to use config_from.
lib/saluki-components/src/config/mrf.rs Refactors tests to use config_from and adds a disabled-guard test for endpoint override.
lib/saluki-components/src/config/mod.rs Refactors env-var remapper tests to use the shared env lock and adds deterministic precedence test.
lib/saluki-components/src/config/cluster_agent.rs Refactors tests to use config_from.
lib/saluki-components/src/config/autoscaling_failover.rs Refactors tests to use config_from.
lib/saluki-components/src/common/datadog/io.rs Refactors tests to use config_from.
bin/agent-data-plane/src/config.rs Refactors tests to use config_from and adds predicate/timeout coverage scenarios.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/saluki-config/src/lib.rs Outdated
// All tests that mutate process-wide environment variables while loading configuration serialize against a
// single shared lock (see `test_env_lock`), so that tests in other modules and crates can't race with the
// env-var manipulation below.
let guard = test_env_lock().lock().unwrap();
Comment on lines +257 to 260
// Serialize against the single shared lock the configuration loader itself uses, so this process-wide env
// mutation can't race with other env-mutating configuration tests in this crate or any other.
let _guard = test_env_lock().lock().unwrap();

Comment on lines 272 to 274
fn env_var_not_remapped_when_absent() {
let _guard = ENV_MUTEX.lock().unwrap();
let _guard = test_env_lock().lock().unwrap();

Comment on lines +501 to +505
assert!(dp.data_pipelines_enabled());
assert!(!dp.metrics_pipeline_required());
assert!(!dp.logs_pipeline_required());
assert!(dp.traces_pipeline_required());
}

@datadog-prod-us1-5 datadog-prod-us1-5 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Datadog Autotest: PASS

More details

This PR introduces shared test helpers (config_from(), test_env_lock()) and expands test coverage of data-plane config predicates and MRF endpoints. All 9 new pipeline-requirement and 3 stop-timeout tests correctly exercise code branches that were previously untested per the CLEANUP_PLAN, with no production-code logic changes.

Was this helpful? React 👍 or 👎

📊 Validated against 15 scenarios · Open Bits AI session

🤖 Datadog Autotest · Commit 89ec904 · What is Autotest? · Any feedback? Reach out in #autotest

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 89ec904ee5

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread lib/saluki-config/src/lib.rs
@pr-commenter

pr-commenter Bot commented Jul 14, 2026

Copy link
Copy Markdown

Regression Detector (Agent Data Plane)

Run ID: 43ffce00-91ef-4a93-ae79-20939cb78027
Baseline: faadad5f · Comparison: a1e1bcce · diff

Optimization Goals: ✅ No significant changes detected

Fine details of change detection per experiment (5)

Experiments configured erratic: true are tagged (ignored) and skipped when determining which experiments regressed or improved. Experiments which are detected as erratic at runtime are tagged (erratic) to flag that the run's sample dispersion was high, but their regression / improvement signal still counts.

experiment goal Δ mean % links
quality_gates_rss_dsd_medium memory ⚪ -0.10 metrics profiles logs
quality_gates_rss_dsd_low memory ⚪ -0.12 metrics profiles logs
quality_gates_rss_dsd_heavy memory ⚪ -0.15 metrics profiles logs
quality_gates_rss_dsd_ultraheavy memory ⚪ -0.37 metrics profiles logs
quality_gates_rss_idle memory ⚪ -0.52 metrics profiles logs
Bounds Checks: ✅ Passed (5)
experiment check replicates observed links
quality_gates_rss_dsd_heavy memory_usage 10/10 ✅ 133 MiB ≤ 140 MiB metrics profiles logs
quality_gates_rss_dsd_low memory_usage 10/10 ✅ 44.3 MiB ≤ 50 MiB metrics profiles logs
quality_gates_rss_dsd_medium memory_usage 10/10 ✅ 66.9 MiB ≤ 75 MiB metrics profiles logs
quality_gates_rss_dsd_ultraheavy memory_usage 10/10 ✅ 193 MiB ≤ 200 MiB metrics profiles logs
quality_gates_rss_idle memory_usage 10/10 ✅ 30.3 MiB ≤ 40 MiB metrics profiles logs
Explanation

A change is flagged as a regression when |Δ mean %| > 5.00% in the regressing direction for its optimization goal AND SMP marks the experiment as a regression (is_regression: true). Improvements use the matching criteria for the improving direction. Experiments configured erratic: true (tagged (ignored)) are skipped outright; experiments detected as erratic at runtime (tagged (erratic)) still count, since that flag describes sample dispersion rather than directional certainty. The Δ mean % cell is colored accordingly: 🟢 = improvement, 🔴 = regression, ⚪ = neutral. Reduction in CPU or memory is an improvement; reduction in ingress throughput is a regression.

@jszwedko jszwedko left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Agreed with the Copilot comments, but otherwise 👍

Copilot AI review requested due to automatic review settings July 14, 2026 18:21
@tobz
tobz force-pushed the tobz/test-cleanup-componentcontext-test-util branch from 80fec81 to 2fb00de Compare July 14, 2026 18:21
@tobz
tobz force-pushed the tobz/test-cleanup-config-test-helper-foundation branch from 89ec904 to 5b6d83b Compare July 14, 2026 18:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 15 out of 16 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings July 14, 2026 18:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 15 out of 16 changed files in this pull request and generated 1 comment.

Comment on lines +529 to +532
pub async fn config_from(file_values: serde_json::Value) -> GenericConfiguration {
let (config, _) = ConfigurationLoader::for_tests(Some(file_values), None, false).await;
config
}
Base automatically changed from tobz/test-cleanup-componentcontext-test-util to main July 14, 2026 19:56
tobz and others added 3 commits July 14, 2026 15:56
Add config_from() and test_env_lock() to saluki-config as plain public helpers,
so config tests across crates share one loader wrapper and serialize env-var
mutation against a single lock instead of hand-rolling per-file copies. Migrate
the duplicated per-file loader helpers and consolidate saluki-components' separate
DatadogRemapper env mutex onto the shared lock.

Add coverage for previously-untested documented behavior: MrfConfiguration's
disabled short-circuit, DatadogRemapper's first-write-wins env remapping (via a new
from_env_vars test seam), and DataPlaneConfiguration's pipeline-requirement
predicates plus stop-timeout default/sum/override/overflow branches.

Resolves G2 of the test suite cleanup plan.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@tobz
tobz force-pushed the tobz/test-cleanup-config-test-helper-foundation branch from 0f01d80 to a1e1bcc Compare July 14, 2026 19:57

@datadog-prod-us1-5 datadog-prod-us1-5 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Datadog Autotest: PASS

More details

PR adds shared test helpers for creating component contexts and configurations in tests, eliminating boilerplate duplication. All helpers are properly feature-gated as test-only code. Comprehensive new tests added for DataPlaneConfiguration predicates cover previously untested paths (pipeline requirements, stop-timeout resolution, overflow handling). No production code changes; purely test infrastructure improvements.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Datadog Autotest · Commit 0f01d80 · What is Autotest? · Any feedback? Reach out in #autotest

@tobz
tobz merged commit f750b4c into main Jul 15, 2026
89 checks passed
@tobz
tobz deleted the tobz/test-cleanup-config-test-helper-foundation branch July 15, 2026 13:17
This was referenced Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/components Sources, transforms, and destinations. area/config Configuration. area/test All things testing: unit/integration, correctness, SMP regression, etc. type/chore Updates to dependencies or general "administrative" tasks necessary to maintain the codebase/repo.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants