Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 21 additions & 9 deletions tests/test_the_test/test_ci_orchestrator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
from functools import lru_cache

from utils import scenarios
from utils._context.weblog_metadata import WeblogMetaData

from utils.scripts.ci_orchestrators.workflow_data import (
_get_endtoend_weblogs,
Expand All @@ -7,12 +10,21 @@
)


@lru_cache
def get_weblogs(library: str) -> dict[str, WeblogMetaData]:
return {w.name: w for w in WeblogMetaData.load(library)}


def get_weblog(library: str, weblog: str) -> WeblogMetaData:
return get_weblogs(library)[weblog]


@scenarios.test_the_test
def test_get_endtoend_definitions():
scenario_map = {
"endtoend": [
"DEFAULT",
"GRAPHQL_APPSEC",
scenarios.default,
scenarios.graphql_appsec,
],
}

Expand All @@ -30,9 +42,9 @@ def test_get_endtoend_definitions():

@scenarios.test_the_test
def test_ipv6_is_not_supported_for_uds_weblogs():
assert not _is_supported("dotnet", "uds", "IPV6", "dev")
assert not _is_supported("python", "uds-flask", "IPV6", "dev")
assert _is_supported("python", "flask-poc", "IPV6", "dev")
assert not _is_supported(get_weblog("dotnet", "uds"), scenarios.ipv6, "dev")
assert not _is_supported(get_weblog("python", "uds-flask"), scenarios.ipv6, "dev")
assert _is_supported(get_weblog("python", "flask-poc"), scenarios.ipv6, "dev")


@scenarios.test_the_test
Expand All @@ -50,7 +62,7 @@ def test_get_endtoend_definitions_missing_endtoend_key():

@scenarios.test_the_test
def test_nodejs_weblogs_dont_require_prebuild():
scenario_map = {"endtoend": ["DEFAULT"]}
scenario_map = {"endtoend": [scenarios.default]}
defs = get_endtoend_definitions("nodejs", scenario_map, [], "dev", 200000, 256, "123", "")
# Node.js weblogs use build_mode="local": no dedicated build_end_to_end job
# (parallel_weblogs lists only "prebuild" weblogs, so it is empty), but the
Expand Down Expand Up @@ -80,7 +92,7 @@ def test_weblog_build_mode_is_resolved_from_metadata():

@scenarios.test_the_test
def test_nodejs_build_base_image():
scenario_map = {"endtoend": ["DEFAULT", "INTEGRATION_FRAMEWORKS"]}
scenario_map = {"endtoend": [scenarios.default, scenarios.integration_frameworks]}
defs = get_endtoend_definitions("nodejs", scenario_map, [], "dev", 200000, 256, "123", "", build_base_images=True)

assert defs["endtoend_defs"]["parallel_weblogs"] == []
Expand All @@ -96,7 +108,7 @@ def test_nodejs_build_base_image():

@scenarios.test_the_test
def test_python_build_base_image():
scenario_map = {"endtoend": ["DEFAULT", "INTEGRATION_FRAMEWORKS"]}
scenario_map = {"endtoend": [scenarios.default, scenarios.integration_frameworks]}
defs = get_endtoend_definitions("python", scenario_map, [], "dev", 200000, 256, "123", "", build_base_images=True)

# all python weblog has build_mode=prebuild. build_weblog_base_image
Expand All @@ -111,7 +123,7 @@ def test_python_build_base_image():

@scenarios.test_the_test
def test_otel_collector():
scenario_map = {"endtoend": ["OTEL_COLLECTOR"]}
scenario_map = {"endtoend": [scenarios.otel_collector]}
defs = get_endtoend_definitions("otel_collector", scenario_map, [], "prod", 200000, 256, "123", "")

assert defs["endtoend_defs"]["parallel_jobs"] == [
Expand Down
1 change: 1 addition & 0 deletions tests/test_the_test/test_group_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def test_tracer_release():
scenarios.simple_installer_auto_injection,
scenarios.multi_installer_auto_injection,
scenarios.otel_collector_e2e,
scenarios.performances,
]

for scenario in get_all_scenarios():
Expand Down
4 changes: 2 additions & 2 deletions utils/_context/_scenarios/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ class _Scenarios:
weblog_volumes={"./tests/appsec/blocking_rule.json": {"bind": "/appsec_blocking_rule.json", "mode": "ro"}},
doc="AppSec tests for GraphQL integrations",
github_workflow="endtoend",
scenario_groups=[scenario_groups.appsec],
scenario_groups=[scenario_groups.appsec, scenario_groups.graphql],
Comment thread
cbeauchesne marked this conversation as resolved.
)
# This GraphQL scenario can be used for any GraphQL testing, not just AppSec
graphql_error_tracking = EndToEndScenario(
Expand All @@ -362,7 +362,7 @@ class _Scenarios:
weblog_volumes={"./tests/appsec/blocking_rule.json": {"bind": "/appsec_blocking_rule.json", "mode": "ro"}},
doc="GraphQL error tracking tests with OpenTelemetry semantics",
github_workflow="endtoend",
scenario_groups=[scenario_groups.appsec],
scenario_groups=[scenario_groups.appsec, scenario_groups.graphql],
)
appsec_rules_monitoring_with_errors = EndToEndScenario(
"APPSEC_RULES_MONITORING_WITH_ERRORS",
Expand Down
1 change: 1 addition & 0 deletions utils/_context/_scenarios/aws_lambda.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def __init__(
all_scenario_groups.tracer_release,
all_scenario_groups.end_to_end,
all_scenario_groups.lambda_end_to_end,
all_scenario_groups.all,
] + (scenario_groups or [])

super().__init__(name, github_workflow=github_workflow, doc=doc, scenario_groups=scenario_groups)
Expand Down
2 changes: 1 addition & 1 deletion utils/_context/_scenarios/otel_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def __init__(self, name: str, *, use_proxy: bool = True, mocked_backend: bool =
name,
github_workflow="endtoend",
doc="TODO",
scenario_groups=[scenario_groups.end_to_end, scenario_groups.all],
scenario_groups=[scenario_groups.end_to_end, scenario_groups.all, scenario_groups.open_telemetry],
use_proxy=use_proxy,
mocked_backend=mocked_backend,
)
Expand Down
2 changes: 2 additions & 0 deletions utils/_context/_scenarios/performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
import pytest

from .endtoend import EndToEndScenario
from .core import scenario_groups


class PerformanceScenario(EndToEndScenario):
def __init__(self, name: str, doc: str) -> None:
super().__init__(
name, doc=doc, appsec_enabled=self.appsec_enabled, use_proxy_for_agent=False, use_proxy_for_weblog=False
)
self.scenario_groups = [scenario_groups.exotics]

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 Keep performance group backrefs in sync

Assigning self.scenario_groups after EndToEndScenario.__init__ makes the ScenarioGroup reverse indexes inconsistent: the base Scenario.__init__ has already appended PERFORMANCES to all, end_to_end, and tracer_release, and this assignment never appends it to exotics. Any test using a @scenario_groups.<group> decorator will still see PERFORMANCES in the old groups and not in exotics, while CI selection reads the overwritten scenario.scenario_groups, so the two selection paths disagree.

Useful? React with 👍 / 👎.


@property
def appsec_enabled(self):
Expand Down
Loading
Loading