From c2450c568ac5b740c3c8c8497f6eb664c8f37da8 Mon Sep 17 00:00:00 2001 From: Zhijie Yang Date: Fri, 20 Dec 2024 14:12:53 +0100 Subject: [PATCH] test(24.10): fix aspnetcore test case --- .../aspnetcore-runtime-9.0/task.yaml | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/tests/spread/integration/aspnetcore-runtime-9.0/task.yaml b/tests/spread/integration/aspnetcore-runtime-9.0/task.yaml index 18502824..cfcdda76 100644 --- a/tests/spread/integration/aspnetcore-runtime-9.0/task.yaml +++ b/tests/spread/integration/aspnetcore-runtime-9.0/task.yaml @@ -13,10 +13,28 @@ execute: | mkdir -p "${rootfs}"/proc mount --bind /proc "${rootfs}"/proc + mkdir -p "${rootfs}"/dev + head -c 500 /dev/urandom > "${rootfs}"/dev/random + head -c 500 /dev/urandom > "${rootfs}"/dev/urandom # 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 + chroot "${rootfs}" dotnet /web_helloworld/bin/Release/net9.0/Hello.dll --urls="http://0.0.0.0:5108" & + app_pid=$! + + # Wait for the web app to start + while ! fuser 5108/tcp > /dev/null 2>&1; do + if ! test -d /proc/$app_pid; then + echo "dotnet exited quickly" + exit 1 + fi + sleep 1 + done + # Send a request to the web app and verify the result ret=0 curl http://localhost:5108/ | grep "Hello World!" || ret=1 + + + # Cleanup + kill $app_pid + exit $ret