Skip to content

Commit 0905049

Browse files
authored
chore(iast): migrate test packages to gitlab (DataDog#11827)
Tests packages are failing in main on CircleCi due to timeout. We’re not sure the root cause because the CI has been broken for over 7 days, until DataDog#11807 reverted the changes. Making it nearly impossible to pinpoint where the issue started in CircleCI. So, W've decided it's time to migrate this to GitLab CAVEAT: test_packages will only run on the main branch. Therefore, these tests haven't been executed in this PR, but the [previous commit](DataDog@0cec964) included a configuration to run them here to validate functionality https://gitlab.ddbuild.io/DataDog/apm-reliability/dd-trace-py/-/jobs/748795172 ## Checklist - [x] PR author has checked that all the criteria below are met - The PR description includes an overview of the change - The PR description articulates the motivation for the change - The change includes tests OR the PR description describes a testing strategy - The PR description notes risks associated with the change, if any - Newly-added code is easy to change - The change follows the [library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) - The change includes or references documentation updates if necessary - Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) ## Reviewer Checklist - [x] Reviewer has checked that all the criteria below are met - Title is accurate - All changes are related to the pull request's stated goal - Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes - Testing strategy adequately addresses listed risks - Newly-added code is easy to change - Release note makes sense to a user of the library - If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment - Backport labels are set in a manner that is consistent with the [release branch maintenance policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)
1 parent d0b151a commit 0905049

File tree

4 files changed

+38
-16
lines changed

4 files changed

+38
-16
lines changed

.circleci/config.templ.yml

-13
Original file line numberDiff line numberDiff line change
@@ -404,19 +404,6 @@ jobs:
404404
paths:
405405
- "."
406406

407-
appsec_iast_packages:
408-
<<: *machine_executor
409-
parallelism: 5
410-
steps:
411-
- when:
412-
condition:
413-
matches: { pattern: "main", value: << pipeline.git.branch >> }
414-
steps:
415-
- run_test:
416-
pattern: 'appsec_iast_packages'
417-
snapshot: true
418-
- run: echo "This test is skipped outside of main branch"
419-
420407
appsec_integrations:
421408
<<: *machine_executor
422409
parallelism: 13

hatch.toml

+26
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,32 @@ test = [
299299
[[envs.appsec_iast_native.matrix]]
300300
python = ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
301301

302+
## ASM appsec_iast_packages
303+
304+
[envs.appsec_iast_packages]
305+
template = "appsec_iast_packages"
306+
dependencies = [
307+
"pytest",
308+
"pytest-cov",
309+
"requests",
310+
"hypothesis",
311+
"requests",
312+
"astunparse",
313+
"flask",
314+
"virtualenv-clone"
315+
]
316+
317+
[envs.appsec_iast_packages.scripts]
318+
test = [
319+
"uname -a",
320+
"pip freeze",
321+
"DD_CIVISIBILITY_ITR_ENABLED=0 DD_IAST_REQUEST_SAMPLING=100 _DD_APPSEC_DEDUPLICATION_ENABLED=false python -m pytest tests/appsec/iast_packages",
322+
]
323+
324+
[[envs.appsec_iast_packages.matrix]]
325+
python = ["3.9", "3.10", "3.11", "3.12"]
326+
327+
302328
## ASM FastAPI
303329

304330
[envs.appsec_threats_fastapi]

scripts/gen_gitlab_config.py

+6
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class JobSpec:
2222
timeout: t.Optional[int] = None
2323
skip: bool = False
2424
paths: t.Optional[t.Set[str]] = None # ignored
25+
only: t.Optional[t.Set[str]] = None # ignored
2526

2627
def __str__(self) -> str:
2728
lines = []
@@ -60,6 +61,11 @@ def __str__(self) -> str:
6061
for key, value in env.items():
6162
lines.append(f" {key}: {value}")
6263

64+
if self.only:
65+
lines.append(" only:")
66+
for value in self.only:
67+
lines.append(f" - {value}")
68+
6369
if self.parallelism is not None:
6470
lines.append(f" parallel: {self.parallelism}")
6571

tests/appsec/suitespec.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ suites:
7474
retry: 2
7575
runner: hatch
7676
appsec_iast_packages:
77-
parallelism: 5
77+
parallelism: 4
7878
paths:
7979
- '@bootstrap'
8080
- '@core'
@@ -84,8 +84,11 @@ suites:
8484
- '@remoteconfig'
8585
- tests/appsec/iast/*
8686
- tests/appsec/iast_packages/*
87-
runner: riot
88-
snapshot: true
87+
retry: 2
88+
runner: hatch
89+
timeout: 50m
90+
only:
91+
- 'main'
8992
appsec_integrations:
9093
parallelism: 7
9194
paths:

0 commit comments

Comments
 (0)