Skip to content

[SDTEST-3871] Add runtime tags env alias#101

Merged
anmarchenko merged 1 commit into
mainfrom
anmarchenko/runtime-tags-env-alias
Jul 1, 2026
Merged

[SDTEST-3871] Add runtime tags env alias#101
anmarchenko merged 1 commit into
mainfrom
anmarchenko/runtime-tags-env-alias

Conversation

@anmarchenko

@anmarchenko anmarchenko commented Jul 1, 2026

Copy link
Copy Markdown
Member

What

Add DD_TEST_OPTIMIZATION_RUNTIME_TAGS as an alias for DD_TEST_OPTIMIZATION_RUNNER_RUNTIME_TAGS when configuring runtime tag overrides. Document the alias in the settings table and cover alias precedence in settings tests.

Why

This gives users a way to set one runtime-tags environment variable compatible with datadog-ci gem variable.

E2E testing

Run DD_TEST_OPTIMIZATION_RUNTIME_TAGS='{"os.platform":"linux","runtime.version":"3.2.0"}' ddtest plan in a repository configured for DDTest and verify the plan uses those runtime tags when fetching skippable tests.

@anmarchenko anmarchenko marked this pull request as ready for review July 1, 2026 08:50
@anmarchenko anmarchenko requested a review from a team as a code owner July 1, 2026 08:50
@anmarchenko anmarchenko changed the title [codex] Add runtime tags env alias [SDTEST-3871] Add runtime tags env alias Jul 1, 2026
@datadog-datadog-prod-us1

Copy link
Copy Markdown

Tests  Code Coverage

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 25.00%
Overall Coverage: 88.12% (-0.05%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 85c371f | Docs | Datadog PR Page | Give us feedback!

@datadog-datadog-prod-us1 datadog-datadog-prod-us1 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

The alias implementation is correct. Viper v1.21's BindEnv with multiple env vars follows first-non-empty semantics (allowEmptyEnv defaults to false), so DD_TEST_OPTIMIZATION_RUNTIME_TAGS is used whenever DD_TEST_OPTIMIZATION_RUNNER_RUNTIME_TAGS is absent or empty — exactly the intended precedence. Adversarial tests confirmed the alias works when canonical is truly unset, AutomaticEnv doesn't interfere, and invalid JSON in the alias is passed through without crashing Init.

Was this helpful? React 👍 or 👎

📊 Validated against 6 scenarios · Open Bits AI session

🤖 Datadog Autotest · Commit 85c371f · What is Autotest? · Any feedback? Reach out in #autotest

@anmarchenko

Copy link
Copy Markdown
Member Author

E2E Test Report: SUCCESS

Tested by: Shepherd Agent (autonomous QA for Datadog Test Optimization)

Test Environment

Results

Check Status Evidence
PR branch built and injected as ddtest Passed crook run rubocop -c ddtest-plan --dep ddtest=anmarchenko/runtime-tags-env-alias --debug completed successfully
DD_TEST_OPTIMIZATION_RUNTIME_TAGS alias was consumed by planner settings Passed Plan report showed Runtime tags: {"os.platform":"linux","runtime.version":"3.2.0"}
Runtime tag override reached skippable-tests request payload Passed TIA-enabled mockdog run captured /api/v2/ci/tests/skippable with configurations.os.platform=linux and configurations.runtime.version=3.2.0
Plan output remained valid Passed Focused plan produced 1 runner for spec/rubocop/cop/lint/unused_method_argument_spec.rb, skippable percentage 0.00

Issues Found

None.

Note: the first default mockdog run proved the alias was consumed by settings, but default mockdog settings have TIA disabled, so it did not call the skippable endpoint. I ran a second focused planner pass with the itr-discovery-only scenario to force the TIA/skippable path and verify the raw request body.

Verification

Datadog UI verification was not applicable for this change because the requested validation was ddtest plan and the run targeted local mockdog, not a real Datadog backend. The relevant backend-facing behavior was verified directly from mockdog's captured skippable request payload.

Test Methodology

  1. Fetched PR details and inspected the diff.
  2. Used the rubocop RSpec playground with ddtest-plan, matching this planner/settings-only change.
  3. Ran with DD_TEST_OPTIMIZATION_RUNTIME_TAGS='{"os.platform":"linux","runtime.version":"3.2.0"}'.
  4. Verified planner logs and report output showed the runtime tag override.
  5. Re-ran with mockdog itr-discovery-only and a single spec file to exercise /api/v2/ci/tests/skippable.
  6. Verified mockdog captured the expected runtime tag values in the request payload.

This E2E test was performed by Shepherd - autonomous QA agent for Datadog Test Optimization.

@anmarchenko anmarchenko merged commit 4eb7a01 into main Jul 1, 2026
4 checks passed
@anmarchenko anmarchenko deleted the anmarchenko/runtime-tags-env-alias branch July 1, 2026 10:04
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