Skip to content

Commit ec14f92

Browse files
eddynakaCodeBlanch
andauthored
Adding multitarget to integration tests (#1266)
* Adding multitarget to integration tests changing to ENV updating to multiline removing multiline updating version of docker-compose updating dockerfile updating pipeline testing again testing updating version to 3.7 updating dockerfile testing updating to env adding .env to test updating docker compose removing default value docker compose with options updating dockerfile to isntall netcore 2.1 adding info to check what are the versions installed updating script adding condition to download only in netcoreapp2.1 updating condition updating dockerfile adding arg updating files to enable netcoreapp2.1 and 3.1 test updating version removing duplicated files, adding to build folder updating project to tests updating project to tests updating to tests adding sdk as tag updating dockerfile removing sdk_version fixed value updating arg order updating files * removing fixed version * Attempting to get redis integration tests up and running. * Attempting to get SqlClient integration tests working on 2.1 + 3.1. * Attempting to get W3C integration tests running on 2.1 & 3.1. * Added version to Microsoft.AspNetCore.App 2.1 refs. * Comment cleanup. * Attempting to fix explicit reference warnings. Co-authored-by: Mikel Blanchard <mblanchard@macrosssoftware.com>
1 parent c7429d2 commit ec14f92

File tree

14 files changed

+73
-35
lines changed

14 files changed

+73
-35
lines changed

.github/workflows/integration.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,33 @@ on:
1313
jobs:
1414
redis-test:
1515
runs-on: ubuntu-latest
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
version: [netcoreapp2.1,netcoreapp3.1]
1620
steps:
1721
- uses: actions/checkout@v2
1822
- name: Run redis docker-compose.integration
19-
run: docker-compose --file=test/OpenTelemetry.Instrumentation.StackExchangeRedis.Tests/docker-compose.integration.yml --project-directory=. up --exit-code-from=redis_integration_tests --build
23+
run: docker-compose --file=test/OpenTelemetry.Instrumentation.StackExchangeRedis.Tests/docker-compose.yml --file=build/docker-compose.${{ matrix.version }}.yml --project-directory=. up --exit-code-from=tests --build
2024

2125
sql-test:
2226
runs-on: ubuntu-latest
27+
strategy:
28+
fail-fast: false
29+
matrix:
30+
version: [netcoreapp2.1,netcoreapp3.1]
2331
steps:
2432
- uses: actions/checkout@v2
2533
- name: Run sql docker-compose.integration
26-
run: docker-compose --file=test/OpenTelemetry.Instrumentation.SqlClient.Tests/docker-compose.integration.yml --project-directory=. up --exit-code-from=sql_integration_tests --build
34+
run: docker-compose --file=test/OpenTelemetry.Instrumentation.SqlClient.Tests/docker-compose.yml --file=build/docker-compose.${{ matrix.version }}.yml --project-directory=. up --exit-code-from=tests --build
2735

2836
w3c-trace-context-test:
2937
runs-on: ubuntu-latest
38+
strategy:
39+
fail-fast: false
40+
matrix:
41+
version: [netcoreapp2.1,netcoreapp3.1]
3042
steps:
3143
- uses: actions/checkout@v2
3244
- name: Run W3C Trace Context docker-compose.integration
33-
run: docker-compose --file=test/OpenTelemetry.Instrumentation.W3cTraceContext.Tests/docker-compose.yml --project-directory=. up --exit-code-from=w3c_trace_context_tests --build
45+
run: docker-compose --file=test/OpenTelemetry.Instrumentation.W3cTraceContext.Tests/docker-compose.yml --file=build/docker-compose.${{ matrix.version }}.yml --project-directory=. up --exit-code-from=tests --build

OpenTelemetry.sln

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{7CB2F02E
2626
build\Common.props = build\Common.props
2727
build\debug.snk = build\debug.snk
2828
build\docfx.cmd = build\docfx.cmd
29+
build\docker-compose.netcoreapp2.1.yml = build\docker-compose.netcoreapp2.1.yml
30+
build\docker-compose.netcoreapp3.1.yml = build\docker-compose.netcoreapp3.1.yml
2931
build\opentelemetry-icon-color.png = build\opentelemetry-icon-color.png
3032
build\OpenTelemetry.prod.loose.ruleset = build\OpenTelemetry.prod.loose.ruleset
3133
build\OpenTelemetry.prod.ruleset = build\OpenTelemetry.prod.ruleset
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: '3.7'
2+
3+
services:
4+
tests:
5+
build:
6+
args:
7+
PUBLISH_FRAMEWORK: netcoreapp2.1
8+
SDK_VERSION: 2.1
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: '3.7'
2+
3+
services:
4+
tests:
5+
build:
6+
args:
7+
PUBLISH_FRAMEWORK: netcoreapp3.1
8+
SDK_VERSION: 3.1

test/OpenTelemetry.Instrumentation.SqlClient.Tests/OpenTelemetry.Instrumentation.SqlClient.Tests.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<Description>Unit test project for OpenTelemetry SqlClient instrumentations</Description>
4-
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
5-
<TargetFrameworks Condition="$(OS) == 'Windows_NT'">$(TargetFrameworks);net452;net461</TargetFrameworks>
4+
<TargetFrameworks Condition="$(TARGET_FRAMEWORK) == ''">netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
5+
<TargetFrameworks Condition="$(TARGET_FRAMEWORK) == '' and $(OS) == 'Windows_NT'">$(TargetFrameworks);net452;net461</TargetFrameworks>
6+
<TargetFrameworks Condition="$(TARGET_FRAMEWORK) != ''">$(TARGET_FRAMEWORK)</TargetFrameworks>
67
</PropertyGroup>
78

89
<ItemGroup>

test/OpenTelemetry.Instrumentation.SqlClient.Tests/docker-compose.integration.yml renamed to test/OpenTelemetry.Instrumentation.SqlClient.Tests/docker-compose.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Start a sql container and then run OpenTelemetry sql integration tests.
22
# This should be run from the root of the repo:
3-
# opentelemetry>docker-compose --file=test/OpenTelemetry.Instrumentation.SqlClient.Tests/docker-compose.integration.yml --project-directory=. up --exit-code-from=sql_integration_tests --build
4-
version: '3.1'
3+
# opentelemetry>docker-compose --file=test/OpenTelemetry.Instrumentation.SqlClient.Tests/docker-compose.yml --project-directory=. up --exit-code-from=tests --build
4+
version: '3.7'
55

66
services:
77
sql:
@@ -13,11 +13,11 @@ services:
1313
ports:
1414
- "1433:1433"
1515

16-
sql_integration_tests:
16+
tests:
1717
build:
1818
context: .
1919
dockerfile: ./test/OpenTelemetry.Instrumentation.SqlClient.Tests/dockerfile
20-
entrypoint: ["bash", "-c", "/wait && dotnet test OpenTelemetry.Instrumentation.SqlClient.Tests.dll --filter CategoryName=SqlIntegrationTests"]
20+
entrypoint: ["bash", "-c", "/wait && dotnet vstest OpenTelemetry.Instrumentation.SqlClient.Tests.dll --TestCaseFilter:CategoryName=SqlIntegrationTests"]
2121
environment:
2222
- OTEL_SQLCONNECTIONSTRING=Data Source=sql; User ID=sa; Password=Pass@word18
2323
- WAIT_HOSTS=sql:1433

test/OpenTelemetry.Instrumentation.SqlClient.Tests/dockerfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,19 @@
22
# This should be run from the root of the repo:
33
# docker build --file test/OpenTelemetry.Instrumentation.SqlClient.Tests/dockerfile .
44

5-
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
5+
ARG SDK_VERSION=3.1
6+
FROM mcr.microsoft.com/dotnet/core/sdk:${SDK_VERSION} AS build
67
ARG PUBLISH_CONFIGURATION=Release
78
ARG PUBLISH_FRAMEWORK=netcoreapp3.1
89
WORKDIR /repo
910
COPY . ./
1011
RUN ls -la /repo
1112
WORKDIR "/repo/test/OpenTelemetry.Instrumentation.SqlClient.Tests"
12-
RUN dotnet publish "OpenTelemetry.Instrumentation.SqlClient.Tests.csproj" -c "${PUBLISH_CONFIGURATION}" -f "${PUBLISH_FRAMEWORK}" -o /drop -p:IntegrationBuild=true
13+
RUN dotnet publish "OpenTelemetry.Instrumentation.SqlClient.Tests.csproj" -c "${PUBLISH_CONFIGURATION}" -f "${PUBLISH_FRAMEWORK}" -o /drop -p:IntegrationBuild=true -p:TARGET_FRAMEWORK=${PUBLISH_FRAMEWORK}
1314

14-
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS final
15+
FROM mcr.microsoft.com/dotnet/core/sdk:${SDK_VERSION} AS final
1516
ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.7.3/wait /wait
1617
RUN chmod +x /wait
1718
WORKDIR /test
1819
COPY --from=build /drop .
19-
ENTRYPOINT ["dotnet", "test", "OpenTelemetry.Instrumentation.SqlClient.Tests.dll"]
20+
ENTRYPOINT ["dotnet", "vstest", "OpenTelemetry.Instrumentation.SqlClient.Tests.dll"]

test/OpenTelemetry.Instrumentation.StackExchangeRedis.Tests/OpenTelemetry.Instrumentation.StackExchangeRedis.Tests.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<Description>Unit test project for OpenTelemetry StackExchangeRedis instrumentation</Description>
4-
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
5-
<TargetFrameworks Condition="$(OS) == 'Windows_NT'">$(TargetFrameworks);net461</TargetFrameworks>
4+
<TargetFrameworks Condition="$(TARGET_FRAMEWORK) == ''">netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
5+
<TargetFrameworks Condition="$(TARGET_FRAMEWORK) == '' and $(OS) == 'Windows_NT'">$(TargetFrameworks);net461</TargetFrameworks>
6+
<TargetFrameworks Condition="$(TARGET_FRAMEWORK) != ''">$(TARGET_FRAMEWORK)</TargetFrameworks>
67
</PropertyGroup>
78

89
<ItemGroup>

test/OpenTelemetry.Instrumentation.StackExchangeRedis.Tests/docker-compose.integration.yml renamed to test/OpenTelemetry.Instrumentation.StackExchangeRedis.Tests/docker-compose.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
# Start a redis container and then run OpenTelemetry redis integration tests.
22
# This should be run from the root of the repo:
3-
# opentelemetry>docker-compose --file=test/OpenTelemetry.Instrumentation.StackExchangeRedis.Tests/docker-compose.integration.yml --project-directory=. up --exit-code-from=redis_integration_tests --build
4-
version: '3.1'
3+
# opentelemetry>docker-compose --file=test/OpenTelemetry.Instrumentation.StackExchangeRedis.Tests/docker-compose.yml --project-directory=. up --exit-code-from=tests --build
4+
version: '3.7'
55

66
services:
77
redis:
88
image: redis
99
ports:
1010
- "6379:6379"
1111

12-
redis_integration_tests:
12+
tests:
1313
build:
1414
context: .
1515
dockerfile: ./test/OpenTelemetry.Instrumentation.StackExchangeRedis.Tests/dockerfile
16-
command: --filter CategoryName=RedisIntegrationTests
16+
command: --TestCaseFilter:CategoryName=RedisIntegrationTests
1717
environment:
1818
- OTEL_REDISENDPOINT=redis:6379
1919
depends_on:

test/OpenTelemetry.Instrumentation.StackExchangeRedis.Tests/dockerfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22
# This should be run from the root of the repo:
33
# docker build --file test/OpenTelemetry.Instrumentation.StackExchangeRedis.Tests/dockerfile .
44

5-
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
5+
ARG SDK_VERSION=3.1
6+
FROM mcr.microsoft.com/dotnet/core/sdk:${SDK_VERSION} AS build
67
ARG PUBLISH_CONFIGURATION=Release
78
ARG PUBLISH_FRAMEWORK=netcoreapp3.1
89
WORKDIR /repo
910
COPY . ./
1011
WORKDIR "/repo/test/OpenTelemetry.Instrumentation.StackExchangeRedis.Tests"
11-
RUN dotnet publish "OpenTelemetry.Instrumentation.StackExchangeRedis.Tests.csproj" -c "${PUBLISH_CONFIGURATION}" -f "${PUBLISH_FRAMEWORK}" -o /drop -p:IntegrationBuild=true
12+
RUN dotnet publish "OpenTelemetry.Instrumentation.StackExchangeRedis.Tests.csproj" -c "${PUBLISH_CONFIGURATION}" -f "${PUBLISH_FRAMEWORK}" -o /drop -p:IntegrationBuild=true -p:TARGET_FRAMEWORK=${PUBLISH_FRAMEWORK}
1213

13-
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS final
14+
FROM mcr.microsoft.com/dotnet/core/sdk:${SDK_VERSION} AS final
1415
WORKDIR /test
1516
COPY --from=build /drop .
16-
ENTRYPOINT ["dotnet", "test", "OpenTelemetry.Instrumentation.StackExchangeRedis.Tests.dll"]
17+
ENTRYPOINT ["dotnet", "vstest", "OpenTelemetry.Instrumentation.StackExchangeRedis.Tests.dll"]

0 commit comments

Comments
 (0)