Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(appsec): connect testagent service to tests #11985

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
4 changes: 2 additions & 2 deletions hatch.toml
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ dependencies = [
test = [
"uname -a",
"pip freeze",
"DD_CIVISIBILITY_ITR_ENABLED=0 DD_IAST_REQUEST_SAMPLING=100 _DD_APPSEC_DEDUPLICATION_ENABLED=false python -m pytest -vvv {args:tests/appsec/integrations/django_tests/}",
"DD_TRACE_AGENT_URL=\"http://testagent:9126\" DD_CIVISIBILITY_ITR_ENABLED=0 DD_IAST_REQUEST_SAMPLING=100 _DD_APPSEC_DEDUPLICATION_ENABLED=false python -m pytest -vvv {args:tests/appsec/integrations/django_tests/}",
]

[[envs.appsec_integrations_django.matrix]]
Expand Down Expand Up @@ -374,7 +374,7 @@ dependencies = [
test = [
"uname -a",
"pip freeze",
"DD_TRACE_AGENT_URL=http://localhost:9126 DD_CIVISIBILITY_ITR_ENABLED=0 DD_IAST_REQUEST_SAMPLING=100 _DD_APPSEC_DEDUPLICATION_ENABLED=false python -m pytest -vvv {args:tests/appsec/integrations/flask_tests/}",
"DD_TRACE_AGENT_URL=\"http://testagent:9126\" DD_CIVISIBILITY_ITR_ENABLED=0 DD_IAST_REQUEST_SAMPLING=100 _DD_APPSEC_DEDUPLICATION_ENABLED=false python -m pytest -vvv {args:tests/appsec/integrations/flask_tests/}",
]

[[envs.appsec_integrations_flask.matrix]]
Expand Down
3 changes: 2 additions & 1 deletion scripts/gen_gitlab_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ def __str__(self) -> str:
if wait_for:
lines.append(" before_script:")
lines.append(f" - !reference [{base}, before_script]")
lines.append(f" - riot -v run -s --pass-env wait -- {' '.join(wait_for)}")
if self.runner == "riot":
lines.append(f" - riot -v run -s --pass-env wait -- {' '.join(wait_for)}")

env = self.env
if not env or "SUITE_NAME" not in env:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ def _request_403(client, debug_mode=False, max_retries=40, sleep_time=1):
raise AssertionError("request_403 failed, max_retries=%d, sleep_time=%f" % (max_retries, sleep_time))


@flaky(until=1706677200, reason="TODO(avara1986): We need to migrate testagent to gitlab")
@pytest.mark.skipif(sys.version_info >= (3, 11), reason="Gunicorn is only supported up to 3.10")
def test_load_testing_appsec_ip_blocking_gunicorn_rc_disabled():
token = "test_load_testing_appsec_ip_blocking_gunicorn_rc_disabled_{}".format(str(uuid.uuid4()))
Expand All @@ -203,7 +202,6 @@ def test_load_testing_appsec_ip_blocking_gunicorn_rc_disabled():
_unblock_ip(token)


@flaky(until=1706677200, reason="TODO(avara1986): We need to migrate testagent to gitlab")
@pytest.mark.skipif(sys.version_info >= (3, 11), reason="Gunicorn is only supported up to 3.10")
def test_load_testing_appsec_ip_blocking_gunicorn_block():
token = "test_load_testing_appsec_ip_blocking_gunicorn_block_{}".format(str(uuid.uuid4()))
Expand All @@ -221,7 +219,6 @@ def test_load_testing_appsec_ip_blocking_gunicorn_block():
_request_200(gunicorn_client)


@flaky(until=1706677200, reason="TODO(avara1986): We need to migrate testagent to gitlab")
@pytest.mark.skipif(list(sys.version_info[:2]) != [3, 10], reason="Run this tests in python 3.10")
def test_load_testing_appsec_ip_blocking_gunicorn_block_and_kill_child_worker():
token = "test_load_testing_appsec_ip_blocking_gunicorn_block_and_kill_child_worker_{}".format(str(uuid.uuid4()))
Expand Down
6 changes: 5 additions & 1 deletion tests/appsec/suitespec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ suites:
- tests/appsec/integrations/flask_tests/*
retry: 2
runner: hatch
timeout: 30m
services:
- testagent
timeout: 40m
appsec_integrations_django:
parallelism: 6
paths:
Expand All @@ -120,6 +122,8 @@ suites:
- tests/appsec/integrations/django_tests/*
retry: 2
runner: hatch
services:
- testagent
timeout: 30m
appsec_threats_django:
parallelism: 12
Expand Down
Loading