diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 5d1fdcd..910d580 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -20,7 +20,7 @@ on: - '**.asciidoc' env: - AGENT_TESTS: java nodejs + AGENT_TESTS: dotnet java nodejs jobs: integration-test: diff --git a/.gitignore b/.gitignore index 99c136a..f1dee2f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ main .webhook .vscode +.idea bin -html_docs \ No newline at end of file +html_docs diff --git a/test/dotnet/.gitignore b/test/dotnet/.gitignore new file mode 100644 index 0000000..1746e32 --- /dev/null +++ b/test/dotnet/.gitignore @@ -0,0 +1,2 @@ +bin +obj diff --git a/test/dotnet/Dockerfile b/test/dotnet/Dockerfile new file mode 100644 index 0000000..12062ee --- /dev/null +++ b/test/dotnet/Dockerfile @@ -0,0 +1,17 @@ +# https://hub.docker.com/_/microsoft-dotnet +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build +WORKDIR /source + +# copy csproj and restore as distinct layers +COPY *.csproj . +RUN dotnet restore + +# copy everything else and build app +COPY . . +RUN dotnet publish -c release -o /app --no-restore + +# final stage/image +FROM mcr.microsoft.com/dotnet/aspnet:8.0 +WORKDIR /app +COPY --from=build /app ./ +ENTRYPOINT ["dotnet", "dotnetapp.dll"] \ No newline at end of file diff --git a/test/dotnet/Program.cs b/test/dotnet/Program.cs new file mode 100644 index 0000000..1760df1 --- /dev/null +++ b/test/dotnet/Program.cs @@ -0,0 +1,6 @@ +var builder = WebApplication.CreateBuilder(args); +var app = builder.Build(); + +app.MapGet("/", () => "Hello World!"); + +app.Run(); diff --git a/test/dotnet/agent_has_started.sh b/test/dotnet/agent_has_started.sh new file mode 100644 index 0000000..53aa585 --- /dev/null +++ b/test/dotnet/agent_has_started.sh @@ -0,0 +1,10 @@ +#!/bin/sh +#initial 10 second delay for restricted CPUs making agent slow starting +sleep 10 +START_MESSAGE=`kubectl logs java-test-app | grep 'Application Started. Press Ctrl+C'` +if [ "x$START_MESSAGE" = "x" ] +then + exit 1 +else + exit 0 +fi diff --git a/test/dotnet/dotnetapp.csproj b/test/dotnet/dotnetapp.csproj new file mode 100644 index 0000000..1b28a01 --- /dev/null +++ b/test/dotnet/dotnetapp.csproj @@ -0,0 +1,9 @@ + + + + net8.0 + enable + enable + + + diff --git a/test/dotnet/test-app.yaml b/test/dotnet/test-app.yaml new file mode 100644 index 0000000..a450a4e --- /dev/null +++ b/test/dotnet/test-app.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Pod +metadata: + name: dotnet-test-app + annotations: + co.elastic.apm/attach: dotnet + labels: + app: dotnet-test-app +spec: + containers: + - image: localhost:5001/registry/dotnet-test-app + imagePullPolicy: Always + name: dotnet-test-app