Skip to content

Commit

Permalink
Add an OATS test configuration running with self-contained executables (
Browse files Browse the repository at this point in the history
grafana#67)

* Add test configuration running with self-contained executables

* Remove debugging statement

* Add docker file for self-contained deployment

* Regroup HTTP tests

* Use an OATS matrix
  • Loading branch information
pyohannes authored Jan 24, 2024
1 parent a6323da commit 3281582
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: '3.4'

services:
aspnetcore:
image: ${DOCKER_REGISTRY-}aspnetcore
build:
context: ../..
dockerfile: examples/net6.0/aspnetcore/Dockerfile
args:
DOTNET_PUBLISH_ARGS: "--self-contained true /p:PublishSingleFile=true"
entrypoint: ./aspnetcore
environment:
- OTEL_EXPORTER_OTLP_ENDPOINT=http://collector:4317
ports:
- "5000:80"
- "8080:80" # for OATs
depends_on:
- redis
- mssql
redis:
image: redis:7.2
ports:
- "6379:6379"
mssql:
image: mcr.microsoft.com/mssql/server:2022-latest
environment:
- ACCEPT_EULA=Y
- MSSQL_SA_PASSWORD=Password12345%%
12 changes: 12 additions & 0 deletions docker/docker-compose-aspnetcore/http/oats-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
matrix:
- name: default
docker-compose:
generator: lgtm
files:
- ../docker-compose.oats.yml
- name: self-contained
docker-compose:
generator: lgtm
files:
- ../docker-compose.self-contained.oats.yml
interval: 500ms
7 changes: 2 additions & 5 deletions docker/docker-compose-aspnetcore/http/oats.http-get.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
docker-compose:
generator: lgtm
files:
- ../docker-compose.oats.yml
include:
- ./oats-template.yml
input:
- path: /api/HttpClient/Get
interval: 500ms
expected:
traces:
- traceql: '{ name =~ "api/HttpClient/Get" }'
Expand Down
7 changes: 2 additions & 5 deletions docker/docker-compose-aspnetcore/http/oats.http-geterror.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
docker-compose:
generator: lgtm
files:
- ../docker-compose.oats.yml
include:
- ./oats-template.yml
input:
- path: /api/HttpClient/GetError
interval: 500ms
expected:
traces:
- traceql: '{ name =~ "api/HttpClient/GetError" }'
Expand Down
12 changes: 12 additions & 0 deletions docker/docker-compose-aspnetcore/oats-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
matrix:
- name: default
docker-compose:
generator: lgtm
files:
- ./docker-compose.oats.yml
- name: self-contained
docker-compose:
generator: lgtm
files:
- ./docker-compose.self-contained.oats.yml
interval: 500ms
6 changes: 2 additions & 4 deletions docker/docker-compose-aspnetcore/oats.mssql-query.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
docker-compose:
generator: lgtm
files:
- ./docker-compose.oats.yml
include:
- ./oats-template.yml
input:
- path: /api/MsSql/Tables
expected:
Expand Down
6 changes: 2 additions & 4 deletions docker/docker-compose-aspnetcore/oats.mssql-sproc.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
docker-compose:
generator: lgtm
files:
- ./docker-compose.oats.yml
include:
- ./oats-template.yml
input:
- path: /api/MsSql/ServerInfo
expected:
Expand Down
7 changes: 5 additions & 2 deletions examples/net6.0/aspnetcore/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ WORKDIR /app
EXPOSE 80

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build

ARG DOTNET_PUBLISH_ARGS=""

WORKDIR /src
COPY ["examples/net6.0/aspnetcore/aspnetcore.csproj", "examples/net6.0/aspnetcore/"]
RUN dotnet restore "examples/net6.0/aspnetcore/aspnetcore.csproj"
Expand All @@ -13,9 +16,9 @@ WORKDIR "/src/examples/net6.0/aspnetcore"
RUN dotnet build "aspnetcore.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "aspnetcore.csproj" -c Release -o /app/publish /p:UseAppHost=false
RUN dotnet publish "aspnetcore.csproj" -c Release -o /app/publish ${DOTNET_PUBLISH_ARGS}

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "aspnetcore.dll"]
ENTRYPOINT ["dotnet", "aspnetcore.dll"]

0 comments on commit 3281582

Please sign in to comment.