chore(test): Fix cmd injection telemetry flaky tests#7599
Conversation
Overall package sizeSelf size: 4.78 MB Dependency sizes| name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 2.0.6 | 81.92 kB | 816.75 kB | | dc-polyfill | 0.1.10 | 26.73 kB | 26.73 kB |🤖 This report was automatically generated by heaviest-objects-in-the-universe |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7599 +/- ##
==========================================
- Coverage 80.31% 80.31% -0.01%
==========================================
Files 733 733
Lines 31546 31546
==========================================
- Hits 25337 25336 -1
- Misses 6209 6210 +1 Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This comment has been minimized.
This comment has been minimized.
BenchmarksBenchmark execution time: 2026-02-23 09:25:16 Comparing candidate commit 4b48679 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 231 metrics, 29 unstable metrics. |
| assert.ok(Object.hasOwn(payload[0][0].meta, '_dd.appsec.json')) | ||
| assert.match(payload[0][0].meta['_dd.appsec.json'], new RegExp(`"rasp-command_injection-rule-id-${ruleId}"`)) | ||
| }) | ||
| }, 4_000) |
There was a problem hiding this comment.
Tests have a default timeout of 5000, and this method default timeout of 30_000. I'm changing this to have a readable message if test timeout happens. (same in line 85)
| assert.fail('namespace should be appsec') | ||
| } | ||
| }, 'generate-metrics', 30_000, 2) | ||
| }, 'generate-metrics', 4_000, 1, true) |
There was a problem hiding this comment.
the number 1 doesn't matter, because the true is a flag that ignores the first property. This test is going to success when a telemetry that success the asserts happen.
What does this PR do?
Instead of checking only the first 2 messages coming in the telemetry, this will wait until the first telemetry message that asserts everithing.
And also, the check will fail if the telemetry is not in appsec namespace.
Motivation
Additional Notes
APPSEC-60075