Skip to content

test(appsec): add products payload tests for service activation telemetry#7124

Open
Julio-Guerra wants to merge 2 commits into
mainfrom
jg/appsec-products-payload-test
Open

test(appsec): add products payload tests for service activation telemetry#7124
Julio-Guerra wants to merge 2 commits into
mainfrom
jg/appsec-products-payload-test

Conversation

@Julio-Guerra

Copy link
Copy Markdown
Contributor

Summary

  • Adds find_products() helper in tests/appsec/utils.py that yields products dicts from app-started, app-product-change, and app-client-configuration-change telemetry payloads
  • Adds TestServiceActivationEnvVarProductsPayload (default scenario) and TestServiceActivationRemoteConfigProductsPayload (APPSEC_RUNTIME_ACTIVATION) to verify that products.appsec.enabled=true is reported in telemetry when AppSec is enabled via env var or remote config
  • These tests cover the payload that feeds service_instance.asm_enabled in the backend, used by fleet-api to surface AAP as an enabled product

Test plan

  • CI passes for TestServiceActivationEnvVarProductsPayload (default scenario, all languages)
  • CI passes for TestServiceActivationRemoteConfigProductsPayload (APPSEC_RUNTIME_ACTIVATION, all languages)

🤖 Generated with Claude Code

…etry

- Add find_products() helper to extract products dicts from app-started,
  app-product-change, and app-client-configuration-change telemetry events
- Add TestServiceActivationRemoteConfigProductsPayload and
  TestServiceActivationEnvVarProductsPayload test classes to verify that
  products.appsec.enabled=true is reported in telemetry, which feeds
  service_instance.asm_enabled in the backend for fleet-api AAP detection

Rationale: Ensure the telemetry payload that signals AAP as an enabled
product is correctly emitted for both env-var and remote-config activation paths

This commit made by [/dd:git:commit:quick](https://github.com/DataDog/claude-marketplace/tree/main/dd/commands/git/commit/quick.md)
@Julio-Guerra Julio-Guerra requested review from a team as code owners June 10, 2026 13:03
@github-actions

Copy link
Copy Markdown
Contributor

CODEOWNERS have been resolved as:

tests/appsec/test_service_activation_metric.py                          @DataDog/asm-libraries @DataDog/system-tests-core
tests/appsec/utils.py                                                   @DataDog/asm-libraries @DataDog/system-tests-core

@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented Jun 10, 2026

Copy link
Copy Markdown

Pipelines

Fix all issues with BitsAI

⚠️ Warnings

🚦 2 Pipeline jobs failed

Testing the test | all-jobs-are-green   View in Datadog   GitHub Actions

Testing the test | lint / lint   View in Datadog   GitHub Actions

Useful? React with 👍 / 👎

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

@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: f505f6d0f0

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

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

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/appsec/utils.py Outdated
None,
)
if appsec_entry:
yield {"appsec": {"enabled": True}}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Stop synthesizing the products payload

In the APPSEC_RUNTIME_ACTIVATION scenario, setup_service_activation_metric sends the ASM RC config, and the existing configuration test already expects an app-client-configuration-change containing DD_APPSEC_ENABLED. This branch turns that configuration event into {"appsec": {"enabled": True}}, so TestServiceActivationRemoteConfigProductsPayload can pass even when the tracer never emits an actual products.appsec.enabled payload on app-started/app-product-change, which is the regression this new test is meant to catch.

Useful? React with 👍 / 👎.


@scenarios.appsec_runtime_activation
@features.appsec_service_activation_origin_metric
class TestServiceActivationRemoteConfigProductsPayload(BaseServiceActivationProductsPayload):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Add manifest coverage for the new test classes

These new service-activation tests have no manifest entries, and per docs/edit/manifest.md an unspecified test is enabled by default. I checked the existing manifests: Java and PHP mark all neighboring service activation metric/configuration classes as missing_feature (manifests/java.yml:2443-2446, manifests/php.yml:461-464), Ruby marks the remote-config variants as missing_feature (manifests/ruby.yml:1505-1507), and .NET still disables the metric variants (manifests/dotnet.yml:514-515). Without corresponding entries for the two new classes, those libraries will start running these tests in scenarios where the prerequisite service-activation telemetry is already declared unsupported.

Useful? React with 👍 / 👎.

@nccatoni nccatoni 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.

LGTM (for @DataDog/system-tests-core) but you should get a review from someone familiar with the feature

…m find_products

- Remove synthesis of products dict from app-client-configuration-change events
- Simplify find_products() to only yield from app-started/app-product-change payloads

Rationale: callers should handle RC-triggered enablement events separately rather than
through a synthesised products dict in find_products

This commit made by [/dd:git:commit:quick](https://github.com/DataDog/claude-marketplace/tree/main/dd/commands/git/commit/quick.md)
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