Skip to content

Add yaml-mapper integration tests#2143

Open
fanny-jiang wants to merge 32 commits intomainfrom
fanny/AGENTONB-2670/migration-mapper-tests
Open

Add yaml-mapper integration tests#2143
fanny-jiang wants to merge 32 commits intomainfrom
fanny/AGENTONB-2670/migration-mapper-tests

Conversation

@fanny-jiang
Copy link
Copy Markdown
Contributor

@fanny-jiang fanny-jiang commented Nov 6, 2025

What this PR does / why we need it:

Adds integration tests for the yaml-mapper binary, testing the mapping of various values.yaml configurations supported by the yaml-mapper to DDA and validating successful agent installation using the mapped DDA in kind cluster.

Validations:

  • Each test values.yaml file installs a healthy agent workload using the datadog helm chart
  • Each test values.yaml maps to DDA custom resource that successfully installs a healthy agent workload
  • The agent runtime config produced by the mapped DDA agents is equivalent to that produced by the source helm values.yaml** (with minor exceptions, see below)

Validated Helm configs:

  • Minimal agent installation (API/APP key credentials and k8s secrets)
  • Cluster and site settings (clusterName, site, dd_url endpoint, registry)
  • Datadog tags and env variables
  • Name overrides (nameOverride/fullnameOverride)
  • Minimal kubelet configuration
  • Container runtime socket paths (CRI, Docker)
  • Minimal NetworkPolicy configs
  • Origin detection unified
  • APM (hostPort and UDS mode, minimal instrumentation and error tracking)
  • Logs collection (minimal - missing include/exclude filters)
  • Process monitoring
  • DogStatsD
  • Cluster checks and cluster checks runner
  • Cluster agent overrides
  • Admission Controller (including sidecar injection)
  • Kubernetes events collection
  • Kubernetes State Metrics core check (minimal)
  • Orchestrator Explorer (minimal)
  • Helm check
  • Prometheus scrape (partial)
  • Remote Configuration
  • Pod-level overrides (resources, update strategy, priorityClassName, hostNetwork, hostPID)

Not tested at this time:

  • system-probe related features (not supported in kind)
    • NPM
    • OOMKill check
    • enableTCPQueueLength

Agent Config diff exceptions:

Which issue this PR fixes

(optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged)

  • fixes #

Special notes for your reviewer:

  1. Install the required DatadogAgent and DatadogAgentInternal CRDs in your test kind-cluster:
make setup-mapper-crds

or

helm install datadog-crds datadog/datadog-crds --set crds.datadogAgents=true --set crds.datadogAgentInternals=true                                                  
  1. Run make integ-test-mapper

If you exit the test early and wish to re-run the tests, you can prepend the command with YAMLMAPPER_CLEANUP_STALE=true to clean up resources from previous test runs

Checklist

[Place an '[x]' (no spaces) in all applicable fields. Please remove unrelated fields.]

  • Chart Version semver bump label added (use <chartName>/minor-version, <chartName>/patch-version, or <chartName>/no-version-bump)
  • For datadog or datadog-operator chart or value changes, update the test baselines (run: make update-test-baselines)

GitHub CI takes care of the below, but are still required:

  • Documentation has been updated with helm-docs (run: .github/helm-docs.sh)
  • CHANGELOG.md has been updated
  • Variables are documented in the README.md

@fanny-jiang fanny-jiang force-pushed the fanny/AGENTONB-2670/migration-mapper-tests branch 2 times, most recently from e39cf35 to 54c555a Compare November 6, 2025 14:42
@fanny-jiang fanny-jiang added chart/datadog This issue or pull request is related to the datadog chart datadog/patch-version Patch version bump for datadog chart labels Nov 6, 2025
@fanny-jiang fanny-jiang force-pushed the fanny/AGENTONB-2670/migration-mapper-tests branch from d6a23c8 to 0450509 Compare November 7, 2025 01:04
@fanny-jiang fanny-jiang marked this pull request as ready for review November 7, 2025 18:14
@fanny-jiang fanny-jiang requested review from a team as code owners November 7, 2025 18:14
@fanny-jiang fanny-jiang added datadog/no-version-bump Skip version bump for datadog chart and removed datadog/patch-version Patch version bump for datadog chart labels Jan 22, 2026
@fanny-jiang fanny-jiang force-pushed the fanny/AGENTONB-2670/migration-mapper-tests branch 2 times, most recently from b463f70 to 62cc8a0 Compare January 23, 2026 17:10
kubectl get nodes
helm dependency build ./charts/datadog
helm dependency build ./charts/datadog-operator
make integ-test-mapper
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
make integ-test-mapper
make integ-test-mapper-strict

Use strict mode to require equal agent config between helm and dda agent deployments when this PR is merged

@fanny-jiang fanny-jiang force-pushed the fanny/AGENTONB-2670/migration-mapper-tests branch from 6b485e8 to b32025a Compare January 28, 2026 20:41
@fanny-jiang
Copy link
Copy Markdown
Contributor Author

@codex review

Copy link
Copy Markdown

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

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: 0341677d2c

ℹ️ 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 test/datadog/yamlmapper/mapping_datadog_helm_to_datadogagent_crd.yaml Outdated
Comment thread .github/workflows/go-test-yamlmapper.yaml
fanny-jiang and others added 16 commits March 10, 2026 14:15
- update readme for datadog
- Add t.Helper() to validateExpectedPodsAgainstValues, validateExpectedPodCount,
  and assertBaseValuesCoverage for correct failure attribution
- Fix assertBaseValuesCoverage to also check the inverse: fail if any values
  file on disk has no matching test case in baseTestCases
- Fix applyDDAAndWaitForAgents to wait for ClusterAgent and CCR pods in
  addition to DaemonSet agent pods; add ExpectedComponentPods parameter
- Use specific ExpectedErrMsg "mapping completed with" in negative test cases
  instead of the generic "error"
- Equalize getHelmAgentConf and getOperatorAgentConf to both use defaultPodRetries
- Handle []interface{} in normalizeDataWithPath so nested booleans inside
  list-valued config fields are normalized correctly
- Remove unused fmt import from integ_test.go
- Remove redundant test/datadog/yamlmapper/** path from workflow triggers
- Fix typo in createTestResources comment

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The yaml-mapper tests validate mapper transformation logic and agent config
equivalence — neither of which is k8s-version-sensitive. Cross-version
compatibility for the Helm chart and operator is already covered by
go-test-operator.yaml (11 versions) and ci.yaml (kubeconform). Running
3x the jobs provided no meaningful additional coverage.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Now that there is a single k8s version, replace the matrix with hardcoded
values directly in the step definitions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The inverse check was failing because it only looked at baseTestCases,
but the values directory also contains files referenced by
testCasesWithDependencies, negativeTestCases, and TestInvalidYAMLChartInstall.

Fix by building a combined set of all referenced filenames across all test
slices before checking for uncovered files on disk. Extract
invalidYAMLValuesFile as a constant so the hardcoded reference in
TestInvalidYAMLChartInstall is included in the coverage set.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- update readme for datadog
P1: Point mapper tests at the canonical mapping file in
charts/datadog/files/ instead of maintaining a stale copy in the test
directory. Delete the duplicate.

P2: Replace local charts/datadog-operator path with the remote
datadog/datadog-operator chart reference, reading the pinned version at
test time from charts/datadog/requirements.yaml. This ensures CI always
tests against the same operator version the chart ships. Remove the now-
unnecessary helm dependency build for charts/datadog-operator from CI.

Add Remote/Version fields to common.HelmCommand to support remote chart
references in InstallChart without corrupting the chart path via
filepath.Abs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
GetFullValues was added in #2068 alongside the original mapper integration
tests, but was never called after those tests were reverted and rewritten.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@fanny-jiang fanny-jiang force-pushed the fanny/AGENTONB-2670/migration-mapper-tests branch from 766a053 to 2d6c741 Compare March 10, 2026 18:21
- mapper.yaml.disabled: fix mapping file path, add description comment, add mapping file to trigger paths
- utils.go: add license header, rename context var to avoid shadowing package, extract isEnvTruthy helper, add forceDeleteThreshold constant
- helpers.go: getMappingPath logs warning on Abs failure, add duplicate checks for all test case slices
- integ_test.go: remove redundant kubectlOptions param from installAndVerifyOperatorAgent
- negative_test.go: use case-sensitive error assertion, remove unused strings import
- common.go: require.NoError instead of require.Nil in CurrentContext

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@fanny-jiang
Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

ℹ️ 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".

fanny-jiang and others added 2 commits March 10, 2026 16:09
Add test/common/** to catch changes to shared test utilities used by the
yamlmapper integration tests. Keep test/datadog/** and charts/datadog/**
broad to ensure regressions from any chart or test change are caught.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Document prerequisites, make targets, environment variables, and cleanup
steps for running the YAML mapper integration tests locally.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chart/datadog This issue or pull request is related to the datadog chart datadog/no-version-bump Skip version bump for datadog chart documentation Improvements or additions to documentation tools/ci

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant