diff --git a/.github/workflows/apicompatibility.yml b/.github/workflows/apicompatibility.yml index ccd19983b..01610167b 100644 --- a/.github/workflows/apicompatibility.yml +++ b/.github/workflows/apicompatibility.yml @@ -16,7 +16,9 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 0 # fetching all - - uses: actions/setup-dotnet@v3.0.3 + + - name: Setup .NET 7.0 + uses: actions/setup-dotnet@v3.0.3 with: dotnet-version: '7.0.x' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 216e71c52..9306e8a31 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,8 @@ jobs: with: fetch-depth: 0 # fetching all - - uses: actions/setup-dotnet@v3.0.3 + - name: Setup .NET 7.0 + uses: actions/setup-dotnet@v3.0.3 with: dotnet-version: '7.0.x' diff --git a/.github/workflows/code-coverage.yml b/.github/workflows/code-coverage.yml index 3e89a7e9d..ae5f5b289 100644 --- a/.github/workflows/code-coverage.yml +++ b/.github/workflows/code-coverage.yml @@ -23,7 +23,9 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 0 # fetching all - - uses: actions/setup-dotnet@v3.0.3 + + - name: Setup .NET 7.0 + uses: actions/setup-dotnet@v3.0.3 with: dotnet-version: '7.0.x' diff --git a/.github/workflows/dotnet-format.yml b/.github/workflows/dotnet-format.yml index 6065fbc07..8852312d2 100644 --- a/.github/workflows/dotnet-format.yml +++ b/.github/workflows/dotnet-format.yml @@ -20,7 +20,7 @@ jobs: - name: check out code uses: actions/checkout@v3 - - name: Setup .NET Core 7.0 + - name: Setup .NET 7.0 uses: actions/setup-dotnet@v3.0.3 with: dotnet-version: '7.0.x' diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 13a1968ab..f28c7a51e 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -16,7 +16,7 @@ jobs: strategy: fail-fast: false matrix: - version: [net7.0] + version: [net6.0,net7.0] steps: - uses: actions/checkout@v3 @@ -28,7 +28,7 @@ jobs: strategy: fail-fast: false matrix: - version: [net7.0] + version: [net6.0,net7.0] steps: - uses: actions/checkout@v3 @@ -40,7 +40,7 @@ jobs: strategy: fail-fast: false matrix: - version: [net7.0] + version: [net6.0,net7.0] steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/publish-packages-1.0.yml b/.github/workflows/publish-packages-1.0.yml index fbfa2f0e7..4356f8a95 100644 --- a/.github/workflows/publish-packages-1.0.yml +++ b/.github/workflows/publish-packages-1.0.yml @@ -23,7 +23,8 @@ jobs: fetch-depth: 0 # fetching all ref: ${{ github.ref || 'main' }} - - uses: actions/setup-dotnet@v3.0.3 + - name: Setup .NET 7.0 + uses: actions/setup-dotnet@v3.0.3 with: dotnet-version: '7.0.x' diff --git a/OpenTelemetry.sln b/OpenTelemetry.sln index b0929341f..b14015407 100644 --- a/OpenTelemetry.sln +++ b/OpenTelemetry.sln @@ -27,8 +27,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{7CB2F02E build\Common.props = build\Common.props build\debug.snk = build\debug.snk build\docfx.cmd = build\docfx.cmd + build\docker-compose.net6.0.yml = build\docker-compose.net6.0.yml build\docker-compose.net7.0.yml = build\docker-compose.net7.0.yml - build\docker-compose.netcoreapp3.1.yml = build\docker-compose.netcoreapp3.1.yml build\finalize-publicapi.ps1 = build\finalize-publicapi.ps1 build\GlobalAttrExclusions.txt = build\GlobalAttrExclusions.txt build\opentelemetry-icon-color.png = build\opentelemetry-icon-color.png diff --git a/build/docker-compose.net6.0.yml b/build/docker-compose.net6.0.yml new file mode 100644 index 000000000..0d5925975 --- /dev/null +++ b/build/docker-compose.net6.0.yml @@ -0,0 +1,9 @@ +version: '3.7' + +services: + tests: + build: + args: + PUBLISH_FRAMEWORK: net6.0 + TEST_SDK_VERSION: 6.0 + BUILD_SDK_VERSION: 7.0 diff --git a/build/docker-compose.net7.0.yml b/build/docker-compose.net7.0.yml index bbc8ac678..d79fa366b 100644 --- a/build/docker-compose.net7.0.yml +++ b/build/docker-compose.net7.0.yml @@ -5,4 +5,5 @@ services: build: args: PUBLISH_FRAMEWORK: net7.0 - SDK_VERSION: 7.0 + TEST_SDK_VERSION: 7.0 + BUILD_SDK_VERSION: 7.0 diff --git a/build/docker-compose.netcoreapp3.1.yml b/build/docker-compose.netcoreapp3.1.yml deleted file mode 100644 index 4d45fa1b3..000000000 --- a/build/docker-compose.netcoreapp3.1.yml +++ /dev/null @@ -1,8 +0,0 @@ -version: '3.7' - -services: - tests: - build: - args: - PUBLISH_FRAMEWORK: netcoreapp3.1 - SDK_VERSION: 3.1 diff --git a/global.json b/global.json index 40b470771..0f417661e 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { "rollForward": "latestFeature", - "version": "7.0.100" + "version": "7.0.101" } } diff --git a/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/Dockerfile b/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/Dockerfile index f7bd35c1b..372a501f7 100644 --- a/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/Dockerfile +++ b/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/Dockerfile @@ -2,8 +2,10 @@ # This should be run from the root of the repo: # docker build --file test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/Dockerfile -ARG SDK_VERSION=7.0 -FROM mcr.microsoft.com/dotnet/sdk:${SDK_VERSION} AS build +ARG BUILD_SDK_VERSION=7.0 +ARG TEST_SDK_VERSION=7.0 + +FROM mcr.microsoft.com/dotnet/sdk:${BUILD_SDK_VERSION} AS build ARG PUBLISH_CONFIGURATION=Release ARG PUBLISH_FRAMEWORK=net7.0 WORKDIR /repo @@ -11,7 +13,7 @@ COPY . ./ WORKDIR "/repo/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests" RUN dotnet publish "OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests.csproj" -c "${PUBLISH_CONFIGURATION}" -f "${PUBLISH_FRAMEWORK}" -o /drop -p:IntegrationBuild=true -p:TARGET_FRAMEWORK=${PUBLISH_FRAMEWORK} -FROM mcr.microsoft.com/dotnet/sdk:${SDK_VERSION} AS final +FROM mcr.microsoft.com/dotnet/sdk:${TEST_SDK_VERSION} AS final WORKDIR /test COPY --from=build /drop . ENTRYPOINT ["dotnet", "vstest", "OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests.dll", "--logger:console;verbosity=detailed"] diff --git a/test/OpenTelemetry.Instrumentation.SqlClient.Tests/Dockerfile b/test/OpenTelemetry.Instrumentation.SqlClient.Tests/Dockerfile index d41db745d..1083201de 100644 --- a/test/OpenTelemetry.Instrumentation.SqlClient.Tests/Dockerfile +++ b/test/OpenTelemetry.Instrumentation.SqlClient.Tests/Dockerfile @@ -2,8 +2,10 @@ # This should be run from the root of the repo: # docker build --file test/OpenTelemetry.Instrumentation.SqlClient.Tests/Dockerfile . -ARG SDK_VERSION=7.0 -FROM mcr.microsoft.com/dotnet/sdk:${SDK_VERSION} AS build +ARG BUILD_SDK_VERSION=7.0 +ARG TEST_SDK_VERSION=7.0 + +FROM mcr.microsoft.com/dotnet/sdk:${BUILD_SDK_VERSION} AS build ARG PUBLISH_CONFIGURATION=Release ARG PUBLISH_FRAMEWORK=net7.0 WORKDIR /repo @@ -12,9 +14,9 @@ RUN ls -la /repo WORKDIR "/repo/test/OpenTelemetry.Instrumentation.SqlClient.Tests" RUN dotnet publish "OpenTelemetry.Instrumentation.SqlClient.Tests.csproj" -c "${PUBLISH_CONFIGURATION}" -f "${PUBLISH_FRAMEWORK}" -o /drop -p:IntegrationBuild=true -p:TARGET_FRAMEWORK=${PUBLISH_FRAMEWORK} -FROM mcr.microsoft.com/dotnet/sdk:${SDK_VERSION} AS final +FROM mcr.microsoft.com/dotnet/sdk:${TEST_SDK_VERSION} AS final ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.7.3/wait /wait RUN chmod +x /wait WORKDIR /test COPY --from=build /drop . -ENTRYPOINT ["dotnet", "vstest", "OpenTelemetry.Instrumentation.SqlClient.Tests.dll"] +ENTRYPOINT ["dotnet", "vstest", "OpenTelemetry.Instrumentation.SqlClient.Tests.dll", "--logger:console;verbosity=detailed"] diff --git a/test/OpenTelemetry.Instrumentation.W3cTraceContext.Tests/Dockerfile b/test/OpenTelemetry.Instrumentation.W3cTraceContext.Tests/Dockerfile index 5698ff755..cadf139e9 100644 --- a/test/OpenTelemetry.Instrumentation.W3cTraceContext.Tests/Dockerfile +++ b/test/OpenTelemetry.Instrumentation.W3cTraceContext.Tests/Dockerfile @@ -2,14 +2,16 @@ # This should be run from the root of the repo: # docker build --file test/OpenTelemetry.Instrumentation.W3cTraceContext.Tests/Dockerfile . -ARG SDK_VERSION=7.0 +ARG BUILD_SDK_VERSION=7.0 +ARG TEST_SDK_VERSION=7.0 + FROM ubuntu AS w3c #Install git WORKDIR /w3c RUN apt-get update && apt-get install -y git RUN git clone https://github.com/w3c/trace-context.git -FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build +FROM mcr.microsoft.com/dotnet/sdk:${BUILD_SDK_VERSION} AS build ARG PUBLISH_CONFIGURATION=Release ARG PUBLISH_FRAMEWORK=net7.0 WORKDIR /repo @@ -17,7 +19,7 @@ COPY . ./ WORKDIR "/repo/test/OpenTelemetry.Instrumentation.W3cTraceContext.Tests" RUN dotnet publish "OpenTelemetry.Instrumentation.W3cTraceContext.Tests.csproj" -c "${PUBLISH_CONFIGURATION}" -f "${PUBLISH_FRAMEWORK}" -o /drop -p:IntegrationBuild=true -p:TARGET_FRAMEWORK=${PUBLISH_FRAMEWORK} -FROM mcr.microsoft.com/dotnet/sdk:${SDK_VERSION} AS final +FROM mcr.microsoft.com/dotnet/sdk:${TEST_SDK_VERSION} AS final WORKDIR /test COPY --from=build /drop . COPY --from=w3c /w3c . @@ -27,4 +29,4 @@ RUN apt-get update \ && ln -s /usr/bin/python3 python \ && pip3 install --upgrade pip \ && pip3 install aiohttp -ENTRYPOINT ["dotnet", "vstest", "OpenTelemetry.Instrumentation.W3cTraceContext.Tests.dll"] +ENTRYPOINT ["dotnet", "vstest", "OpenTelemetry.Instrumentation.W3cTraceContext.Tests.dll", "--logger:console;verbosity=detailed"] diff --git a/test/OpenTelemetry.Instrumentation.W3cTraceContext.Tests/W3CTraceContextTests.cs b/test/OpenTelemetry.Instrumentation.W3cTraceContext.Tests/W3CTraceContextTests.cs index 618ddc995..e2386cb86 100644 --- a/test/OpenTelemetry.Instrumentation.W3cTraceContext.Tests/W3CTraceContextTests.cs +++ b/test/OpenTelemetry.Instrumentation.W3cTraceContext.Tests/W3CTraceContextTests.cs @@ -13,8 +13,8 @@ // See the License for the specific language governing permissions and // limitations under the License. // + using System.Diagnostics; -using System.Net.Http; using System.Text; using System.Text.Json; using System.Text.Json.Serialization; @@ -34,6 +34,7 @@ namespace OpenTelemetry.Instrumentation.W3cTraceContext.Tests opentelemetry>docker-compose --file=test/OpenTelemetry.Instrumentation.W3cTraceContext.Tests/docker-compose.yml --project-directory=. up --exit-code-from=tests --build */ private const string W3cTraceContextEnvVarName = "OTEL_W3CTRACECONTEXT"; + private static readonly Version AspNetCoreHostingVersion = typeof(Microsoft.AspNetCore.Hosting.Builder.IApplicationBuilderFactory).Assembly.GetName().Version; private readonly HttpClient httpClient = new HttpClient(); private readonly ITestOutputHelper output; @@ -59,7 +60,7 @@ namespace OpenTelemetry.Instrumentation.W3cTraceContext.Tests // disabling due to failing dotnet-format // TODO: investigate why dotnet-format fails. #pragma warning disable SA1008 // Opening parenthesis should be spaced correctly - app.MapPost("/", async([FromBody]Data[] data) => + app.MapPost("/", async([FromBody] Data[] data) => { var result = string.Empty; if (data != null) @@ -90,13 +91,24 @@ namespace OpenTelemetry.Instrumentation.W3cTraceContext.Tests string result = RunCommand("python", "trace-context/test/test.py http://localhost:5000/"); // Assert - // Assert on the last line - // TODO: Investigate failures: - // 1) harness sends a request with an invalid tracestate header with duplicated keys ... FAIL - // 2) harness sends an invalid traceparent with illegal characters in trace_flags ... FAIL string lastLine = ParseLastLine(result); + this.output.WriteLine("result:" + result); - Assert.StartsWith("FAILED (failures=3)", lastLine); + + // Assert on the last line + + // TODO: Investigate failures on .NET6 vs .NET7. To see the details + // run the tests with console logger (done automatically by the CI + // jobs). + + if (AspNetCoreHostingVersion.Major <= 6) + { + Assert.StartsWith("FAILED (failures=5)", lastLine); + } + else + { + Assert.StartsWith("FAILED (failures=3)", lastLine); + } } private static string RunCommand(string command, string args)