Skip to content
Draft
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
15 changes: 12 additions & 3 deletions manifests/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -779,9 +779,18 @@ manifest:
tests/ffe/test_dynamic_evaluation.py::Test_FFE_Flag_Parse_Error_Isolation: bug (FFL-2184)
tests/ffe/test_dynamic_evaluation.py::Test_FFE_Unknown_Operator_Tolerance: bug (FFL-2184)
tests/ffe/test_exposure_egress.py: v3.36.0
tests/ffe/test_exposure_egress.py::Test_FFE_Exposure_Egress_Agentless_Direct: missing_feature (Not yet implemented)
tests/ffe/test_exposure_egress.py::Test_FFE_Exposure_Egress_Agentless_Direct_Shutdown: missing_feature (Not yet implemented)
tests/ffe/test_exposure_egress.py::Test_FFE_Exposure_Egress_Agentless_Sidecar: missing_feature (Not yet implemented)
tests/ffe/test_exposure_egress.py::Test_FFE_Exposure_Egress_Agentless_Direct:
- weblog_declaration:
"*": irrelevant
poc: v3.54.0
tests/ffe/test_exposure_egress.py::Test_FFE_Exposure_Egress_Agentless_Direct_Shutdown:
- weblog_declaration:
"*": irrelevant
poc: v3.54.0
tests/ffe/test_exposure_egress.py::Test_FFE_Exposure_Egress_Agentless_Sidecar:
- weblog_declaration:
"*": irrelevant
poc: v3.54.0
tests/ffe/test_exposures_datadog_agent.py: v3.36.0
tests/ffe/test_exposures_datadog_agent.py::Test_FFE_Exposure_Caching_Serial_Id_Appears: missing_feature (EX-3416)
tests/ffe/test_exposures_datadog_agent.py::Test_FFE_Exposure_Caching_Serial_Id_Cycle: missing_feature (EX-3416)
Expand Down
44 changes: 44 additions & 0 deletions tests/test_the_test/test_dotnet_direct_evp_activation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
"""Guard the .NET-only activation and lifecycle for direct-EVP validation."""

from pathlib import Path

from utils import features, scenarios


@scenarios.test_the_test
@features.not_reported
def test_dotnet_direct_evp_activation_is_exposure_only_and_poc_scoped() -> None:
manifest = Path("manifests/dotnet.yml").read_text(encoding="utf-8")

for test_class in (
"Test_FFE_Exposure_Egress_Agentless_Direct",
"Test_FFE_Exposure_Egress_Agentless_Direct_Shutdown",
"Test_FFE_Exposure_Egress_Agentless_Sidecar",
):
declaration = (
f"tests/ffe/test_exposure_egress.py::{test_class}:\n"
' - weblog_declaration:\n "*": irrelevant\n poc: v3.54.0'
)
assert declaration in manifest

assert "tests/ffe/test_flag_eval_evp.py: missing_feature (FFL-2446)" in manifest


@scenarios.test_the_test
@features.not_reported
def test_dotnet_direct_evp_shutdown_execs_runtime_and_marks_server_closed() -> None:
app_script = Path("utils/build/docker/dotnet/weblog/app.sh").read_text(encoding="utf-8")
program = Path("utils/build/docker/dotnet/weblog/Program.cs").read_text(encoding="utf-8")

shutdown_switch = 'SYSTEM_TESTS_FFE_SHUTDOWN_FLUSH_ENABLED:-}" = "true"'
assert shutdown_switch in app_script
assert "exec dotnet app.dll" in app_script
assert app_script.index(shutdown_switch) < app_script.index("exec dotnet app.dll")
assert app_script.index("exec dotnet app.dll") < app_script.index("if ( ! dotnet app.dll)")

assert 'GetEnvironmentVariable("SYSTEM_TESTS_FFE_SHUTDOWN_FLUSH_ENABLED") == "true"' in program
assert "GetRequiredService<IHostApplicationLifetime>().ApplicationStopped.Register" in program
assert 'event = "system_tests.ffe.shutdown.server_closed"' in program
assert 'timestamp = DateTimeOffset.UtcNow.ToString("O")' in program
assert "Console.Out.Flush();" in program
assert program.index("ApplicationStopped.Register") < program.index("host.Run();")
18 changes: 17 additions & 1 deletion utils/build/docker/dotnet/weblog/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System;
using System.Text.Json;
using System.Threading;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Http;
using Datadog.Trace;
Expand Down Expand Up @@ -37,7 +39,21 @@ public static void Main(string[] args)
settings.LogsInjectionEnabled = true;
Tracer.Configure(settings);
}
CreateHostBuilder(args).Build().Run();
var host = CreateHostBuilder(args).Build();
if (Environment.GetEnvironmentVariable("SYSTEM_TESTS_FFE_SHUTDOWN_FLUSH_ENABLED") == "true")
{
host.Services.GetRequiredService<IHostApplicationLifetime>().ApplicationStopped.Register(() =>
{
Console.WriteLine(JsonSerializer.Serialize(new
{
@event = "system_tests.ffe.shutdown.server_closed",
timestamp = DateTimeOffset.UtcNow.ToString("O")
}));
Console.Out.Flush();
});
}

host.Run();
}
public static IHostBuilder CreateHostBuilder(string[] args)
{
Expand Down
4 changes: 4 additions & 0 deletions utils/build/docker/dotnet/weblog/app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ if [ "${UDS_WEBLOG:-0}" = "1" ]; then
./set-uds-transport.sh
fi

if [ "${SYSTEM_TESTS_FFE_SHUTDOWN_FLUSH_ENABLED:-}" = "true" ]; then
exec dotnet app.dll
fi

if ( ! dotnet app.dll); then
echo recovering dump to /var/log/system-tests/dumps
mkdir -p /var/log/system-tests/dumps
Expand Down
Loading