Skip to content

Commit

Permalink
continue reverting to main
Browse files Browse the repository at this point in the history
  • Loading branch information
rachelyangdog committed Nov 15, 2024
1 parent 19ca1e6 commit 3528072
Show file tree
Hide file tree
Showing 9 changed files with 200 additions and 58 deletions.
81 changes: 63 additions & 18 deletions utils/_context/_scenarios/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ def all_endtoend_scenarios(test_object):
"TELEMETRY_DEPENDENCY_LOADED_TEST_FOR_DEPENDENCY_COLLECTION_DISABLED",
weblog_env={"DD_TELEMETRY_DEPENDENCY_COLLECTION_ENABLED": "false"},
doc="Test DD_TELEMETRY_DEPENDENCY_COLLECTION_ENABLED=false effect on tracers",
scenario_groups=[ScenarioGroup.TELEMETRY],
)

telemetry_app_started_products_disabled = EndToEndScenario(
Expand All @@ -121,59 +122,72 @@ def all_endtoend_scenarios(test_object):
},
appsec_enabled=False,
doc="Disable all tracers products",
scenario_groups=[ScenarioGroup.TELEMETRY],
)

telemetry_log_generation_disabled = EndToEndScenario(
"TELEMETRY_LOG_GENERATION_DISABLED",
weblog_env={"DD_TELEMETRY_LOGS_COLLECTION_ENABLED": "false",},
doc="Test env var `DD_TELEMETRY_LOGS_COLLECTION_ENABLED=false`",
scenario_groups=[ScenarioGroup.TELEMETRY],
)
telemetry_metric_generation_disabled = EndToEndScenario(
"TELEMETRY_METRIC_GENERATION_DISABLED",
weblog_env={"DD_TELEMETRY_METRICS_ENABLED": "false",},
doc="Test env var `DD_TELEMETRY_METRICS_ENABLED=false`",
scenario_groups=[ScenarioGroup.TELEMETRY],
)
telemetry_metric_generation_enabled = EndToEndScenario(
"TELEMETRY_METRIC_GENERATION_ENABLED",
weblog_env={"DD_TELEMETRY_METRICS_ENABLED": "true",},
doc="Test env var `DD_TELEMETRY_METRICS_ENABLED=true`",
scenario_groups=[ScenarioGroup.TELEMETRY],
)

# ASM scenarios
appsec_missing_rules = EndToEndScenario(
"APPSEC_MISSING_RULES",
appsec_rules="/donotexists",
weblog_env={"DD_APPSEC_RULES": "/donotexists"},
doc="Test missing appsec rules file",
scenario_groups=[ScenarioGroup.APPSEC],
)
appsec_corrupted_rules = EndToEndScenario(
"APPSEC_CORRUPTED_RULES",
appsec_rules="/appsec_corrupted_rules.yml",
weblog_env={"DD_APPSEC_RULES": "/appsec_corrupted_rules.yml"},
doc="Test corrupted appsec rules file",
scenario_groups=[ScenarioGroup.APPSEC],
)
appsec_custom_rules = EndToEndScenario(
"APPSEC_CUSTOM_RULES",
appsec_rules="/appsec_custom_rules.json",
weblog_env={"DD_APPSEC_RULES": "/appsec_custom_rules.json"},
weblog_volumes={"./tests/appsec/custom_rules.json": {"bind": "/appsec_custom_rules.json", "mode": "ro"}},
doc="Test custom appsec rules file",
scenario_groups=[ScenarioGroup.APPSEC],
)
appsec_blocking = EndToEndScenario(
"APPSEC_BLOCKING",
appsec_rules="/appsec_blocking_rule.json",
weblog_env={"DD_APPSEC_RULES": "/appsec_blocking_rule.json"},
weblog_volumes={"./tests/appsec/blocking_rule.json": {"bind": "/appsec_blocking_rule.json", "mode": "ro"}},
doc="Misc tests for appsec blocking",
scenario_groups=[ScenarioGroup.APPSEC, ScenarioGroup.ESSENTIALS],
)
graphql_appsec = EndToEndScenario(
"GRAPHQL_APPSEC",
appsec_rules="/appsec_blocking_rule.json",
weblog_env={"DD_APPSEC_RULES": "/appsec_blocking_rule.json"},
weblog_volumes={"./tests/appsec/blocking_rule.json": {"bind": "/appsec_blocking_rule.json", "mode": "ro"}},
doc="AppSec tests for GraphQL integrations",
github_workflow="graphql",
scenario_groups=[ScenarioGroup.APPSEC],
)
appsec_rules_monitoring_with_errors = EndToEndScenario(
"APPSEC_RULES_MONITORING_WITH_ERRORS",
appsec_rules="/appsec_custom_rules_with_errors.json",
weblog_env={"DD_APPSEC_RULES": "/appsec_custom_rules_with_errors.json"},
weblog_volumes={
"./tests/appsec/custom_rules_with_errors.json": {
"bind": "/appsec_custom_rules_with_errors.json",
"mode": "ro",
}
},
doc="Appsec rule file with some errors",
scenario_groups=[ScenarioGroup.APPSEC],
)
Expand Down Expand Up @@ -244,8 +258,9 @@ def all_endtoend_scenarios(test_object):
"APPSEC_RUNTIME_ACTIVATION",
rc_api_enabled=True,
appsec_enabled=False,
weblog_env={"DD_APPSEC_WAF_TIMEOUT": "10000000", "DD_APPSEC_TRACE_RATE_LIMIT": "10000"}, # 10 seconds
doc="",
scenario_groups=[ScenarioGroup.APPSEC],
scenario_groups=[ScenarioGroup.APPSEC, ScenarioGroup.APPSEC_RASP],
)

appsec_api_security = EndToEndScenario(
Expand Down Expand Up @@ -349,13 +364,24 @@ def all_endtoend_scenarios(test_object):
scenario_groups=[ScenarioGroup.APPSEC],
)

iast_deduplication = EndToEndScenario(
"IAST_DEDUPLICATION",
weblog_env={
"DD_IAST_ENABLED": "true",
"DD_IAST_DEDUPLICATION_ENABLED": "true",
"DD_IAST_REQUEST_SAMPLING": "100",
},
doc="Iast scenario with deduplication enabled",
scenario_groups=[ScenarioGroup.APPSEC],
)

remote_config_mocked_backend_asm_features = EndToEndScenario(
"REMOTE_CONFIG_MOCKED_BACKEND_ASM_FEATURES",
rc_api_enabled=True,
appsec_enabled=False,
weblog_env={"DD_REMOTE_CONFIGURATION_ENABLED": "true",},
doc="",
scenario_groups=[ScenarioGroup.APPSEC, ScenarioGroup.ESSENTIALS],
scenario_groups=[ScenarioGroup.APPSEC, ScenarioGroup.REMOTE_CONFIG, ScenarioGroup.ESSENTIALS],
)

remote_config_mocked_backend_live_debugging = EndToEndScenario(
Expand All @@ -368,6 +394,7 @@ def all_endtoend_scenarios(test_object):
"DD_INTERNAL_RCM_POLL_INTERVAL": "1000",
},
doc="",
scenario_groups=[ScenarioGroup.REMOTE_CONFIG, ScenarioGroup.ESSENTIALS],
)

remote_config_mocked_backend_asm_dd = EndToEndScenario(
Expand All @@ -382,15 +409,20 @@ def all_endtoend_scenarios(test_object):
remote config. And it's okay not testing custom rule set for dev mode, as in this scenario, rules
are always coming from remote config.
""",
scenario_groups=[ScenarioGroup.APPSEC],
scenario_groups=[
ScenarioGroup.APPSEC,
ScenarioGroup.APPSEC_RASP,
ScenarioGroup.REMOTE_CONFIG,
ScenarioGroup.ESSENTIALS,
],
)

remote_config_mocked_backend_asm_features_nocache = EndToEndScenario(
"REMOTE_CONFIG_MOCKED_BACKEND_ASM_FEATURES_NOCACHE",
rc_api_enabled=True,
weblog_env={"DD_APPSEC_ENABLED": "false", "DD_REMOTE_CONFIGURATION_ENABLED": "true",},
doc="",
scenario_groups=[ScenarioGroup.APPSEC],
scenario_groups=[ScenarioGroup.APPSEC, ScenarioGroup.REMOTE_CONFIG],
)

remote_config_mocked_backend_live_debugging_nocache = EndToEndScenario(
Expand All @@ -402,13 +434,14 @@ def all_endtoend_scenarios(test_object):
"DD_REMOTE_CONFIG_ENABLED": "true",
},
doc="",
scenario_groups=[ScenarioGroup.REMOTE_CONFIG],
)

remote_config_mocked_backend_asm_dd_nocache = EndToEndScenario(
"REMOTE_CONFIG_MOCKED_BACKEND_ASM_DD_NOCACHE",
rc_api_enabled=True,
doc="",
scenario_groups=[ScenarioGroup.APPSEC],
scenario_groups=[ScenarioGroup.APPSEC, ScenarioGroup.REMOTE_CONFIG],
)

# APM tracing end-to-end scenarios
Expand Down Expand Up @@ -439,6 +472,7 @@ def all_endtoend_scenarios(test_object):
library_conf_custom_header_tags = EndToEndScenario(
"LIBRARY_CONF_CUSTOM_HEADER_TAGS",
additional_trace_header_tags=(VALID_CONFIGS),
rc_api_enabled=True,
doc="Scenario with custom headers to be used with DD_TRACE_HEADER_TAGS",
)
library_conf_custom_header_tags_invalid = EndToEndScenario(
Expand All @@ -460,24 +494,35 @@ def all_endtoend_scenarios(test_object):
"DD_TRACE_HTTP_CLIENT_ERROR_STATUSES": "200-201,202",
"DD_SERVICE": "service_test",
"DD_TRACE_KAFKA_ENABLED": "false", # Using Kafka as is the most common endpoint and integration(missing for PHP).
"DD_TRACE_KAFKAJS_ENABLED": "false", # In Node the integration is kafkajs.
"DD_TRACE_PDO_ENABLED": "false", # Use PDO for PHP,
},
include_kafka=True,
include_postgres_db=True,
doc="",
scenario_groups=[ScenarioGroup.ESSENTIALS],
scenario_groups=[ScenarioGroup.TRACING_CONFIG, ScenarioGroup.ESSENTIALS],
)

tracing_config_nondefault_2 = EndToEndScenario(
"TRACING_CONFIG_NONDEFAULT_2",
weblog_env={
"DD_TRACE_OBFUSCATION_QUERY_STRING_REGEXP": "",
"DD_TRACE_KAFKA_ENABLED": "true",
"DD_TRACE_KAFKAJS_ENABLED": "true",
"DD_TRACE_PDO_ENABLED": "true", # Use PDO for PHP
"DD_TRACE_CLIENT_IP_HEADER": "custom-ip-header",
"DD_TRACE_CLIENT_IP_ENABLED": "true",
},
include_kafka=True,
include_postgres_db=True,
doc="Test tracer configuration when a collection of non-default settings are applied",
scenario_groups=[ScenarioGroup.TRACING_CONFIG],
)
tracing_config_nondefault_3 = EndToEndScenario(
"TRACING_CONFIG_NONDEFAULT_3", weblog_env={"DD_TRACE_HTTP_CLIENT_TAG_QUERY_STRING": "false"}, doc="",
"TRACING_CONFIG_NONDEFAULT_3",
weblog_env={"DD_TRACE_HTTP_CLIENT_TAG_QUERY_STRING": "false"},
doc="",
scenario_groups=[ScenarioGroup.TRACING_CONFIG],
)

parametric = ParametricScenario("PARAMETRIC", doc="WIP")
Expand Down Expand Up @@ -603,7 +648,7 @@ def all_endtoend_scenarios(test_object):
scenario_groups=[ScenarioGroup.ONBOARDING],
github_workflow="libinjection",
)
host_auto_injection_install_script_profiling = InstallerAutoInjectionScenario(
host_auto_injection_install_script_profiling = InstallerAutoInjectionScenarioProfiling(
"HOST_AUTO_INJECTION_INSTALL_SCRIPT_PROFILING",
"Onboarding Host Single Step Instrumentation scenario using agent auto install script with profiling activating by the installation process",
vm_provision="host-auto-inject-install-script",
Expand All @@ -613,7 +658,7 @@ def all_endtoend_scenarios(test_object):
github_workflow="libinjection",
)

container_auto_injection_install_script_profiling = InstallerAutoInjectionScenario(
container_auto_injection_install_script_profiling = InstallerAutoInjectionScenarioProfiling(
"CONTAINER_AUTO_INJECTION_INSTALL_SCRIPT_PROFILING",
"Onboarding Container Single Step Instrumentation profiling scenario using agent auto install script",
vm_provision="container-auto-inject-install-script",
Expand Down Expand Up @@ -682,11 +727,11 @@ def all_endtoend_scenarios(test_object):

appsec_rasp = EndToEndScenario(
"APPSEC_RASP",
weblog_env={"DD_APPSEC_RASP_ENABLED": "true"},
appsec_rules="/appsec_rasp_ruleset.json",
weblog_env={"DD_APPSEC_RASP_ENABLED": "true", "DD_APPSEC_RULES": "/appsec_rasp_ruleset.json"},
weblog_volumes={"./tests/appsec/rasp/rasp_ruleset.json": {"bind": "/appsec_rasp_ruleset.json", "mode": "ro"}},
doc="Enable APPSEC RASP",
github_workflow="endtoend",
scenario_groups=[ScenarioGroup.APPSEC],
scenario_groups=[ScenarioGroup.APPSEC, ScenarioGroup.APPSEC_RASP],
)

external_processing = ExternalProcessingScenario("EXTERNAL_PROCESSING")
Expand Down
Loading

0 comments on commit 3528072

Please sign in to comment.