Skip to content

Commit

Permalink
chore: Deprecate .NET 7 usage in tests (#2428)
Browse files Browse the repository at this point in the history
  • Loading branch information
tippmar-nr authored Apr 25, 2024
1 parent 1d8352b commit eea6704
Show file tree
Hide file tree
Showing 37 changed files with 56 additions and 209 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run_linux_container_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,4 @@ jobs:
echo $INTEGRATION_TEST_SECRETS | dotnet user-secrets set --project ${{ env.integration_tests_shared_project }}
- name: Build & Run Linux Container Integration Tests
run: dotnet test ./tests/Agent/IntegrationTests/ContainerIntegrationTests/ContainerIntegrationTests.csproj --framework net7.0
run: dotnet test ./tests/Agent/IntegrationTests/ContainerIntegrationTests/ContainerIntegrationTests.csproj --framework net8.0
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@ From a Powershell command prompt in the same folder as this README file:

```
docker buildx build --build-arg DOTNET_VERSION="6.0" -f Dockerfile.AmazonBaseImage --tag dotnetreg.azurecr.io/amazonlinux-aspnet:6.0 --platform linux/amd64,linux/arm64/v8 --push .
docker buildx build --build-arg DOTNET_VERSION="7.0" -f Dockerfile.AmazonBaseImage --tag dotnetreg.azurecr.io/amazonlinux-aspnet:7.0 --platform linux/amd64,linux/arm64/v8 --push .
docker buildx build --build-arg DOTNET_VERSION="8.0" -f Dockerfile.AmazonBaseImage --tag dotnetreg.azurecr.io/amazonlinux-aspnet:8.0 --platform linux/amd64,linux/arm64/v8 --push .
docker buildx build --build-arg DOTNET_VERSION="6.0" -f Dockerfile.FedoraBaseImage --tag fedora-aspnet:6.0 --platform linux/amd64,linux/arm64/v8 -push .
docker buildx build --build-arg DOTNET_VERSION="7.0" -f Dockerfile.FedoraBaseImage --tag fedora-aspnet:7.0 --platform linux/amd64,linux/arm64/v8 -push .
docker buildx build --build-arg DOTNET_VERSION="8.0" -f Dockerfile.FedoraBaseImage --tag fedora-aspnet:8.0 --platform linux/amd64,linux/arm64/v8 -push .
```

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG DISTRO_TAG
FROM --platform=amd64 mcr.microsoft.com/dotnet/aspnet:7.0-bullseye-slim AS base
FROM --platform=amd64 mcr.microsoft.com/dotnet/aspnet:8.0-bookworm-slim AS base
WORKDIR /app
EXPOSE 80
RUN apt-get update \
Expand All @@ -12,7 +12,7 @@ RUN apt-get update \


# build image is always amd64 (to match the runner architecture), even though the target architecture may be arm64
FROM --platform=amd64 mcr.microsoft.com/dotnet/sdk:7.0-bullseye-slim AS build
FROM --platform=amd64 mcr.microsoft.com/dotnet/sdk:8.0-bookworm-slim AS build
RUN apt-get update \
&& apt-get install -y wget \
&& wget https://packages.microsoft.com/config/debian/11/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \
Expand All @@ -27,12 +27,12 @@ RUN dotnet restore "KafkaTestApp/KafkaTestApp.csproj" -p:TargetFramework=net${AP

COPY . .
WORKDIR "/src/KafkaTestApp"
RUN dotnet build "KafkaTestApp.csproj" -c Release -o /app/build --os linux --framework net${APP_DOTNET_VERSION}
RUN dotnet build "KafkaTestApp.csproj" -c Release -o /app/build --self-contained --os linux --framework net${APP_DOTNET_VERSION}


FROM build AS publish
ARG APP_DOTNET_VERSION
RUN dotnet publish "KafkaTestApp.csproj" -c Release -o /app/publish /p:UseAppHost=false --os linux --framework net${APP_DOTNET_VERSION}
RUN dotnet publish "KafkaTestApp.csproj" -c Release -o /app/publish --self-contained --os linux --framework net${APP_DOTNET_VERSION}


FROM base AS final
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>.</DockerfileContext>
</PropertyGroup>
Expand All @@ -10,7 +10,7 @@
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.6" />

<PackageReference Include="Confluent.Kafka" Version="1.4.0" Condition="'$(TargetFramework)' == 'net6.0'" />
<PackageReference Include="Confluent.Kafka" Version="2.2.0" Condition="'$(TargetFramework)' == 'net7.0'" />
<PackageReference Include="Confluent.Kafka" Version="2.2.0" Condition="'$(TargetFramework)' == 'net8.0'" />
</ItemGroup>


Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>.</DockerfileContext>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
version: "3"

# The following must be set either in environment variables or via a .env file in the same folder as this file:
#
# AGENT_PATH host path to the Agent linux home folder - will map to /usr/local/newrelic-dotnet-agent in the container
# LOG_PATH host path for Agent logfile output - will map to /app/logs in the container
# DISTRO_TAG distro tag for build, not including the architecture suffix - possible values 7.0-bullseye-slim, 7.0-alpine, 7.0-jammy
# DISTRO_TAG distro tag for build, not including the architecture suffix - possible values 8.0-bookworm-slim, 8.0-alpine, 8.0-jammy
# TARGET_ARCH the target architecture for the build and run -- either amd64 or arm64
# PORT external port for the smoketest API
# CONTAINER_NAME The name for the container
# PLATFORM The platform that the service runs on -- linux/amd64 or linux/arm64/v8
# DOTNET_VERSION The dotnet version number to use (7.0, 8.0, etc)
# DOTNET_VERSION The dotnet version number to use (8.0, etc)
# TEST_DOCKERFILE The path and dockerfile to use for the service.
#
# NEW_RELIC_KAFKA_TOPIC
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ version: "3"
#
# AGENT_PATH host path to the Agent linux home folder - will map to /usr/local/newrelic-dotnet-agent in the container
# LOG_PATH host path for Agent logfile output - will map to /app/logs in the container
# DISTRO_TAG distro tag for build, not including the architecture suffix - possible values 7.0-bullseye-slim, 7.0-alpine, 7.0-jammy
# DISTRO_TAG distro tag for build, not including the architecture suffix - possible values 8.0-bookworm-slim, 8.0-alpine, 8.0-jammy
# TARGET_ARCH the target architecture for the build and run -- either amd64 or arm64
# PORT external port for the smoketest API
# CONTAINER_NAME The name for the container
# PLATFORM The platform that the service runs on -- linux/amd64 or linux/arm64/v8
# DOTNET_VERSION The dotnet version number to use (7.0, 8.0, etc)
# DOTNET_VERSION The dotnet version number to use (8.0, etc)
# NETWORK_NAME The network name to use for containers in this app. Should be unique among all running instances.
# TEST_DOCKERFILE The path and dockerfile to use for the service.
#
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
version: "3"

# The following must be set either in environment variables or via a .env file in the same folder as this file:
#
# AGENT_PATH host path to the Agent linux home folder - will map to /usr/local/newrelic-dotnet-agent in the container
# LOG_PATH host path for Agent logfile output - will map to /app/logs in the container
# DISTRO_TAG distro tag for build, not including the architecture suffix - possible values 7.0-bullseye-slim, 7.0-alpine, 7.0-jammy
# DISTRO_TAG distro tag for build, not including the architecture suffix - possible values 8.0-bookworm-slim, 8.0-alpine, 8.0-jammy
# TARGET_ARCH the target architecture for the build and run -- either amd64 or arm64
# PORT external port for the smoketest API
# CONTAINER_NAME The name for the container
# PLATFORM The platform that the service runs on -- linux/amd64 or linux/arm64/v8
# DOTNET_VERSION The dotnet version number to use (7.0, 8.0, etc)
# DOTNET_VERSION The dotnet version number to use (8.0, etc)
# TEST_DOCKERFILE The path and dockerfile to use for the service.
#
# and the usual suspects:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<RootNamespace>NewRelic.Agent.ContainerIntegrationTests</RootNamespace>
<AssemblyName>NewRelic.Agent.ContainerIntegrationTests</AssemblyName>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<Import Project="Test.targets" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace NewRelic.Agent.ContainerIntegrationTests.Fixtures;

public abstract class ContainerTestFixtureBase : RemoteApplicationFixture
{
private const string DotnetVersion = "7.0";
private const string DotnetVersion = "8.0";

protected override int MaxTries => 1;

Expand Down Expand Up @@ -44,7 +44,7 @@ public class UbuntuX64ContainerTestFixture : ContainerTestFixtureBase
{
private const string Dockerfile = "SmokeTestApp/Dockerfile";
private const ContainerApplication.Architecture Architecture = ContainerApplication.Architecture.X64;
private const string DistroTag = "bullseye-slim";
private const string DistroTag = "bookworm-slim";

public UbuntuX64ContainerTestFixture() : base(DistroTag, Architecture, Dockerfile) { }
}
Expand All @@ -70,7 +70,7 @@ public class UbuntuArm64ContainerTestFixture : ContainerTestFixtureBase
{
private const string Dockerfile = "SmokeTestApp/Dockerfile";
private const ContainerApplication.Architecture Architecture = ContainerApplication.Architecture.Arm64;
private const string DistroTag = "bullseye-slim";
private const string DistroTag = "bookworm-slim";

public UbuntuArm64ContainerTestFixture() : base(DistroTag, Architecture, Dockerfile) { }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,18 @@ public class KafkaDotNet6TestFixture : KafkaTestFixtureBase
{
private const string Dockerfile = "KafkaTestApp/Dockerfile";
private const ContainerApplication.Architecture Architecture = ContainerApplication.Architecture.X64;
private const string DistroTag = "bullseye-slim";
private const string DistroTag = "bookworm-slim";
private const string DotnetVersion = "6.0";

public KafkaDotNet6TestFixture() : base(DistroTag, Architecture, Dockerfile, DotnetVersion) { }
}

public class KafkaDotNet7TestFixture : KafkaTestFixtureBase
public class KafkaDotNet8TestFixture : KafkaTestFixtureBase
{
private const string Dockerfile = "KafkaTestApp/Dockerfile";
private const ContainerApplication.Architecture Architecture = ContainerApplication.Architecture.X64;
private const string DistroTag = "bullseye-slim";
private const string DotnetVersion = "7.0";
private const string DistroTag = "bookworm-slim";
private const string DotnetVersion = "8.0";

public KafkaDotNet7TestFixture() : base(DistroTag, Architecture, Dockerfile, DotnetVersion) { }
public KafkaDotNet8TestFixture() : base(DistroTag, Architecture, Dockerfile, DotnetVersion) { }
}
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ public KafkaDotNet6Test(KafkaDotNet6TestFixture fixture, ITestOutputHelper outpu
}
}

public class KafkaDotNet7Test : LinuxKafkaTest<KafkaDotNet7TestFixture>
public class KafkaDotNet8Test : LinuxKafkaTest<KafkaDotNet8TestFixture>
{
public KafkaDotNet7Test(KafkaDotNet7TestFixture fixture, ITestOutputHelper output) : base(fixture, output)
public KafkaDotNet8Test(KafkaDotNet8TestFixture fixture, ITestOutputHelper output) : base(fixture, output)
{
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net7.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net8.0</TargetFrameworks>
<RootNamespace>NewRelic.Agent.IntegrationTestHelpers</RootNamespace>
<AssemblyName>NewRelic.Agent.IntegrationTestHelpers</AssemblyName>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,6 @@ public ConsoleDynamicMethodFixtureCore60() : base("net6.0")
}
}

public class ConsoleDynamicMethodFixtureCore70 : ConsoleDynamicMethodFixtureCoreSpecificVersion
{
public ConsoleDynamicMethodFixtureCore70() : base("net7.0")
{
}
}

public class ConsoleDynamicMethodFixtureCore80 : ConsoleDynamicMethodFixtureCoreSpecificVersion
{
public ConsoleDynamicMethodFixtureCore80() : base("net8.0")
Expand Down
2 changes: 1 addition & 1 deletion tests/Agent/IntegrationTests/Shared/Shared.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net462;net7.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net462;net8.0</TargetFrameworks>
<AssemblyName>Shared</AssemblyName>
<RootNamespace>NewRelic.Agent.IntegrationTests.Shared</RootNamespace>
<Description>Project containing items shared across test applications, test libraries, and test runners.</Description>
Expand Down
Loading

0 comments on commit eea6704

Please sign in to comment.