From 983e793fd3ee0e257ea292d92111bae18ed8e639 Mon Sep 17 00:00:00 2001 From: Zhijie Yang Date: Wed, 18 Dec 2024 00:19:31 +0100 Subject: [PATCH] chore(24.10): aspnetcore-runtime-9.0 --- .../aspnetcore-runtime-9.0/task.yaml | 25 +++++++++++++++++ .../web_helloworld/Hello.csproj | 9 ++++++ .../web_helloworld/Program.cs | 6 ++++ .../Properties/launchSettings.json | 28 +++++++++++++++++++ .../appsettings.Development.json | 8 ++++++ .../web_helloworld/appsettings.json | 9 ++++++ 6 files changed, 85 insertions(+) create mode 100644 tests/spread/integration/aspnetcore-runtime-9.0/task.yaml create mode 100644 tests/spread/integration/aspnetcore-runtime-9.0/web_helloworld/Hello.csproj create mode 100644 tests/spread/integration/aspnetcore-runtime-9.0/web_helloworld/Program.cs create mode 100644 tests/spread/integration/aspnetcore-runtime-9.0/web_helloworld/Properties/launchSettings.json create mode 100644 tests/spread/integration/aspnetcore-runtime-9.0/web_helloworld/appsettings.Development.json create mode 100644 tests/spread/integration/aspnetcore-runtime-9.0/web_helloworld/appsettings.json diff --git a/tests/spread/integration/aspnetcore-runtime-9.0/task.yaml b/tests/spread/integration/aspnetcore-runtime-9.0/task.yaml new file mode 100644 index 00000000..5226db0b --- /dev/null +++ b/tests/spread/integration/aspnetcore-runtime-9.0/task.yaml @@ -0,0 +1,25 @@ +summary: Integration tests for .NET 9 Runtime + +execute: | + # install slices + rootfs="$(install-slices aspnetcore-runtime-9.0_libs base-files_base bash_bins coreutils_directory-listing)" + mv $rootfs/usr/lib/dotnet/dotnet9 $rootfs/usr/lib/dotnet/dotnet + ln -s ../lib/dotnet/dotnet $rootfs/usr/bin/dotnet + + # smoking test the .NET runtime + chroot "$rootfs" /usr/bin/dotnet --info + + # preparing the test data + apt update && apt install -y dotnet-sdk-9.0 + cp -r web_helloworld $rootfs/web_helloworld + dotnet publish $rootfs/web_helloworld/Hello.csproj --no-self-contained + + mkdir -p "${rootfs}"/proc + mount --bind /proc "${rootfs}"/proc + + # test the helloworld web app + chroot "$rootfs" dotnet /app_helloworld/bin/Release/net9.0/Hello.dll --urls="http://0.0.0.0:5108" & + sleep 5 + # Send a request to the web app and verify the result + ret=0 + curl http://localhost:5108/ | grep "Hello World!" || ret=1 diff --git a/tests/spread/integration/aspnetcore-runtime-9.0/web_helloworld/Hello.csproj b/tests/spread/integration/aspnetcore-runtime-9.0/web_helloworld/Hello.csproj new file mode 100644 index 00000000..6568b3dc --- /dev/null +++ b/tests/spread/integration/aspnetcore-runtime-9.0/web_helloworld/Hello.csproj @@ -0,0 +1,9 @@ + + + + net9.0 + enable + enable + + + diff --git a/tests/spread/integration/aspnetcore-runtime-9.0/web_helloworld/Program.cs b/tests/spread/integration/aspnetcore-runtime-9.0/web_helloworld/Program.cs new file mode 100644 index 00000000..1760df1d --- /dev/null +++ b/tests/spread/integration/aspnetcore-runtime-9.0/web_helloworld/Program.cs @@ -0,0 +1,6 @@ +var builder = WebApplication.CreateBuilder(args); +var app = builder.Build(); + +app.MapGet("/", () => "Hello World!"); + +app.Run(); diff --git a/tests/spread/integration/aspnetcore-runtime-9.0/web_helloworld/Properties/launchSettings.json b/tests/spread/integration/aspnetcore-runtime-9.0/web_helloworld/Properties/launchSettings.json new file mode 100644 index 00000000..0bf46a5e --- /dev/null +++ b/tests/spread/integration/aspnetcore-runtime-9.0/web_helloworld/Properties/launchSettings.json @@ -0,0 +1,28 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:65090", + "sslPort": 44311 + } + }, + "profiles": { + "Hello": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "https://localhost:7158;http://localhost:5108", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/tests/spread/integration/aspnetcore-runtime-9.0/web_helloworld/appsettings.Development.json b/tests/spread/integration/aspnetcore-runtime-9.0/web_helloworld/appsettings.Development.json new file mode 100644 index 00000000..a34cd70c --- /dev/null +++ b/tests/spread/integration/aspnetcore-runtime-9.0/web_helloworld/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/tests/spread/integration/aspnetcore-runtime-9.0/web_helloworld/appsettings.json b/tests/spread/integration/aspnetcore-runtime-9.0/web_helloworld/appsettings.json new file mode 100644 index 00000000..23160a4d --- /dev/null +++ b/tests/spread/integration/aspnetcore-runtime-9.0/web_helloworld/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +}