Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Use arm64 runners for arm64 container integration tests #2959

Merged
merged 11 commits into from
Jan 23, 2025
70 changes: 63 additions & 7 deletions .github/workflows/run_linux_container_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ permissions:

jobs:

run-linux-container-tests:
name: Run Linux Container Integration Tests
run-amd64-linux-container-tests:
name: Run amd64 Linux Container Integration Tests
runs-on: ubuntu-latest

env:
Expand All @@ -46,9 +46,6 @@ jobs:
with:
egress-policy: audit

- name: Docker Setup QEMU
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0

- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
Expand Down Expand Up @@ -82,5 +79,64 @@ jobs:
with:
dotnet-version: '9.0.x'

- name: Build & Run Linux Container Integration Tests
run: dotnet test ./tests/Agent/IntegrationTests/ContainerIntegrationTests/ContainerIntegrationTests.csproj --framework net9.0
- name: Build & Run amd64 Linux Container Integration Tests
env:
BUILD_ARCH: amd64
run: dotnet test ./tests/Agent/IntegrationTests/ContainerIntegrationTests/ContainerIntegrationTests.csproj --framework net9.0 --filter Architecture=amd64

run-arm64-linux-container-tests:
name: Run arm64 Linux Container Integration Tests
runs-on: ubuntu-24.04-arm

env:
test_results_path: tests\TestResults
integration_tests_shared_project: ${{ github.workspace }}/tests/Agent/IntegrationTests/Shared
NR_DOTNET_TEST_SAVE_WORKING_DIRECTORY: 1
# Make this variable true to enable extra data-gathering and logging to help troubleshoot test failures, at the cost of additional time and resources
enhanced_logging: false


steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit

- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0

- name: Download Agent Home Folders (Call)
if: ${{ inputs.external_call }}
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: homefolders
path: src/Agent

- name: Download Agent Home Folders (Dispatch)
if: ${{ !inputs.external_call }}
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ inputs.run_id }}
name: homefolders
path: ${{ github.workspace }}/src/Agent
repository: ${{ github.repository }}

- name: Set up secrets
env:
INTEGRATION_TEST_SECRETS: ${{ secrets.TEST_SECRETS }}
run: |
echo $INTEGRATION_TEST_SECRETS | dotnet user-secrets set --project ${{ env.integration_tests_shared_project }}

- name: Install .NET 9
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1
with:
dotnet-version: '9.0.x'

- name: Build & Run arm64 Linux Container Integration Tests
env:
BUILD_ARCH: arm64
run: dotnet test ./tests/Agent/IntegrationTests/ContainerIntegrationTests/ContainerIntegrationTests.csproj --framework net9.0 --filter Architecture=arm64

Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
ARG DOTNET_VERSION
ARG DISTRO_TAG
ARG TARGET_ARCH
ARG BUILD_ARCH
FROM --platform=${TARGET_ARCH} mcr.microsoft.com/dotnet/aspnet:${DOTNET_VERSION}-${DISTRO_TAG} AS base
WORKDIR /app
EXPOSE 80

# build image is always amd64 (to match the runner architecture), even though the target architecture may be arm64
ARG DOTNET_VERSION
FROM --platform=amd64 mcr.microsoft.com/dotnet/sdk:${DOTNET_VERSION}-${DISTRO_TAG} AS build
# build arch may be different from target arch (i.e., when running locally with QEMU)
FROM --platform=${BUILD_ARCH} mcr.microsoft.com/dotnet/sdk:${DOTNET_VERSION}-${DISTRO_TAG} AS build
ARG TARGET_ARCH
WORKDIR /src

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
ARG DISTRO_TAG
ARG BUILD_ARCH
FROM --platform=amd64 mcr.microsoft.com/dotnet/aspnet:9.0-bookworm-slim AS base
WORKDIR /app
EXPOSE 80
Expand All @@ -10,9 +11,8 @@ RUN apt-get update \
&& apt-get update \
&& apt-get install -y aspnetcore-runtime-8.0


# 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:9.0-bookworm-slim AS build
# build arch may be different from target arch (i.e., when running locally with QEMU)
FROM --platform=${BUILD_ARCH} mcr.microsoft.com/dotnet/sdk:9.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 Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
ARG DISTRO_TAG
ARG BUILD_ARCH
FROM --platform=amd64 mcr.microsoft.com/dotnet/aspnet:9.0-bookworm-slim AS base
WORKDIR /app
EXPOSE 80
Expand All @@ -10,9 +11,8 @@ RUN apt-get update \
&& apt-get update \
&& apt-get install -y aspnetcore-runtime-8.0


# 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:9.0-bookworm-slim AS build
# build arch may be different from target arch (i.e., when running locally with QEMU)
FROM --platform=${BUILD_ARCH} mcr.microsoft.com/dotnet/sdk:9.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 Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
ARG DOTNET_VERSION
ARG DISTRO_TAG
ARG TARGET_ARCH
ARG BUILD_ARCH
FROM --platform=${TARGET_ARCH} mcr.microsoft.com/dotnet/aspnet:${DOTNET_VERSION}-${DISTRO_TAG} AS base
WORKDIR /app
EXPOSE 80

# build image is always amd64 (to match the runner architecture), even though the target architecture may be arm64
ARG DOTNET_VERSION
FROM --platform=amd64 mcr.microsoft.com/dotnet/sdk:${DOTNET_VERSION}-${DISTRO_TAG} AS build
# build arch may be different from target arch (i.e., when running locally with QEMU)
FROM --platform=${BUILD_ARCH} mcr.microsoft.com/dotnet/sdk:${DOTNET_VERSION}-${DISTRO_TAG} AS build
ARG TARGET_ARCH
WORKDIR /src
COPY ["SmokeTestApp/SmokeTestApp.csproj", "SmokeTestApp/"]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
ARG DOTNET_VERSION
ARG TARGET_ARCH
ARG BUILD_ARCH
# Uses a custom-built Amazon Linux image with ASP.NET Core pre-installed, served from a private
# container repository under the .NET Team Sandbox Azure subscription
FROM --platform=${TARGET_ARCH} dotnetreg.azurecr.io/amazonlinux-aspnet:${DOTNET_VERSION} AS base
WORKDIR /app
EXPOSE 80

# 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:${DOTNET_VERSION} AS build
# build arch may be different from target arch (i.e., when running locally with QEMU)
FROM --platform=${BUILD_ARCH} mcr.microsoft.com/dotnet/sdk:${DOTNET_VERSION} AS build
ARG TARGET_ARCH
WORKDIR /src
COPY ["SmokeTestApp/SmokeTestApp.csproj", "SmokeTestApp/"]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
ARG DOTNET_VERSION
ARG TARGET_ARCH
ARG BUILD_ARCH
FROM --platform=${TARGET_ARCH} quay.io/centos/centos:stream9 AS base
WORKDIR /app
EXPOSE 80

# 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:${DOTNET_VERSION} AS build
# build arch may be different from target arch (i.e., when running locally with QEMU)
FROM --platform=${BUILD_ARCH} mcr.microsoft.com/dotnet/sdk:${DOTNET_VERSION} AS build
ARG TARGET_ARCH
WORKDIR /src
COPY ["SmokeTestApp/SmokeTestApp.csproj", "SmokeTestApp/"]
Expand Down Expand Up @@ -40,4 +41,4 @@ NEW_RELIC_LOG_DIRECTORY=/app/logs
WORKDIR /app
COPY --from=publish /app/publish .

ENTRYPOINT ["dotnet", "SmokeTestApp.dll"]
ENTRYPOINT ["dotnet", "SmokeTestApp.dll"]
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
ARG DOTNET_VERSION
ARG TARGET_ARCH
ARG BUILD_ARCH
# Uses a custom-built Fedora image with ASP.NET Core pre-installed, served from a private
# container repository under the .NET Team Sandbox Azure subscription
FROM --platform=${TARGET_ARCH} dotnetreg.azurecr.io/fedora-aspnet:${DOTNET_VERSION} AS base
FROM dotnetreg.azurecr.io/fedora-aspnet:${DOTNET_VERSION} AS base
WORKDIR /app
EXPOSE 80

# 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:${DOTNET_VERSION} AS build
# build arch may be different from target arch (i.e., when running locally with QEMU)
FROM --platform=${BUILD_ARCH} mcr.microsoft.com/dotnet/sdk:${DOTNET_VERSION} AS build
ARG TARGET_ARCH
WORKDIR /src
COPY ["SmokeTestApp/SmokeTestApp.csproj", "SmokeTestApp/"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
# 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 8.0-bookworm-slim, 8.0-alpine, 8.0-jammy
# TARGET_ARCH the target architecture for the build and run -- either amd64 or arm64
# TARGET_ARCH the target architecture for the run -- either amd64 or arm64
# BUILD_ARCH the build architecture-- 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
Expand Down Expand Up @@ -54,6 +55,7 @@ services:
args:
DISTRO_TAG: ${DISTRO_TAG}
TARGET_ARCH: ${TARGET_ARCH}
BUILD_ARCH: ${BUILD_ARCH}
NEW_RELIC_LICENSE_KEY: ${NEW_RELIC_LICENSE_KEY}
NEW_RELIC_APP_NAME: ${NEW_RELIC_APP_NAME}
NEW_RELIC_HOST: ${NEW_RELIC_HOST}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
# 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 8.0-bookworm-slim, 8.0-alpine, 8.0-jammy
# TARGET_ARCH the target architecture for the build and run -- either amd64 or arm64
# TARGET_ARCH the target architecture for the run -- either amd64 or arm64
# BUILD_ARCH the build architecture -- 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
Expand Down Expand Up @@ -32,6 +33,7 @@ services:
args:
DISTRO_TAG: ${DISTRO_TAG}
TARGET_ARCH: ${TARGET_ARCH}
BUILD_ARCH: ${BUILD_ARCH}
NEW_RELIC_LICENSE_KEY: ${NEW_RELIC_LICENSE_KEY}
NEW_RELIC_APP_NAME: ${NEW_RELIC_APP_NAME}
NEW_RELIC_HOST: ${NEW_RELIC_HOST}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
# 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 8.0-bookworm-slim, 8.0-alpine, 8.0-jammy
# TARGET_ARCH the target architecture for the build and run -- either amd64 or arm64
# TARGET_ARCH the target architecture for the run -- either amd64 or arm64
# BUILD_ARCH the build architecture -- 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
Expand Down Expand Up @@ -32,6 +33,7 @@ services:
args:
DISTRO_TAG: ${DISTRO_TAG}
TARGET_ARCH: ${TARGET_ARCH}
BUILD_ARCH: ${BUILD_ARCH}
NEW_RELIC_LICENSE_KEY: ${NEW_RELIC_LICENSE_KEY}
NEW_RELIC_APP_NAME: ${NEW_RELIC_APP_NAME}
NEW_RELIC_HOST: ${NEW_RELIC_HOST}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
# 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 9.0-bookworm-slim, 9.0-alpine, 9.0-noble
# TARGET_ARCH the target architecture for the build and run -- either amd64 or arm64
# TARGET_ARCH the target architecture for the run -- either amd64 or arm64
# BUILD_ARCH the build architecture -- 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
Expand All @@ -30,6 +31,7 @@ services:
args:
DISTRO_TAG: ${DISTRO_TAG}
TARGET_ARCH: ${TARGET_ARCH}
BUILD_ARCH: ${BUILD_ARCH}
NEW_RELIC_LICENSE_KEY: ${NEW_RELIC_LICENSE_KEY}
NEW_RELIC_APP_NAME: ${NEW_RELIC_APP_NAME}
NEW_RELIC_HOST: ${NEW_RELIC_HOST}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@ public override void Start(string commandLineArguments, Dictionary<string, strin
startInfo.EnvironmentVariables.Add("APP_DOTNET_VERSION", _dotnetVersion);
startInfo.EnvironmentVariables.Add("DISTRO_TAG", _distroTag);
startInfo.EnvironmentVariables.Add("TARGET_ARCH", _targetArch);

// Workflow will set BUILD_ARCH if it's a CI build
// otherwise, assume it's a local build and set it to amd64
if (!startInfo.EnvironmentVariables.ContainsKey("BUILD_ARCH"))
startInfo.EnvironmentVariables.Add("BUILD_ARCH", "amd64");

startInfo.EnvironmentVariables.Add("PLATFORM", _containerPlatform);
startInfo.EnvironmentVariables.Add("NEW_RELIC_LICENSE_KEY", testConfiguration.LicenseKey);
startInfo.EnvironmentVariables.Add("NEW_RELIC_HOST", testConfiguration.CollectorUrl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace NewRelic.Agent.ContainerIntegrationTests.Tests.AwsSdk;

[Trait("Architecture", "amd64")]
public class AwsSdkDynamoDBTest : NewRelicIntegrationTest<AwsSdkContainerDynamoDBTestFixture>
{
private readonly AwsSdkContainerDynamoDBTestFixture _fixture;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace NewRelic.Agent.ContainerIntegrationTests.Tests.AwsSdk;

[Trait("Architecture", "amd64")]
public class AwsSdkMultiServiceTest : NewRelicIntegrationTest<AwsSdkContainerMultiServiceTestFixture>
{
private readonly AwsSdkContainerMultiServiceTestFixture _fixture;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
using NewRelic.Testing.Assertions;
using Xunit;
using Xunit.Abstractions;
using Assert = Xunit.Assert;

namespace NewRelic.Agent.ContainerIntegrationTests.Tests.AwsSdk;

[Trait("Architecture", "amd64")]
public abstract class AwsSdkSQSTestBase : NewRelicIntegrationTest<AwsSdkContainerSQSTestFixture>
{
private readonly AwsSdkContainerSQSTestFixture _fixture;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,34 +77,46 @@ public void Test()

// only testing on a subset of linux distros to keep total test runtime under control. Additional distros can be uncommented below if needed.

[Trait("Architecture", "amd64")]
public class DebianX64InfiniteTracingContainerTest(DebianX64ContainerTestFixture fixture, ITestOutputHelper output)
: InfiniteTracingContainerTest<DebianX64ContainerTestFixture>(fixture, output);

//[Trait("Architecture", "amd64")]
//public class UbuntuX64InfiniteTracingContainerTest(UbuntuX64ContainerTestFixture fixture, ITestOutputHelper output)
// : InfiniteTracingContainerTest<UbuntuX64ContainerTestFixture>(fixture, output);

[Trait("Architecture", "amd64")]
public class AlpineX64InfiniteTracingContainerTest(AlpineX64ContainerTestFixture fixture, ITestOutputHelper output)
: InfiniteTracingContainerTest<AlpineX64ContainerTestFixture>(fixture, output);

[Trait("Architecture", "arm64")]
public class DebianArm64InfiniteTracingContainerTest(DebianArm64ContainerTestFixture fixture, ITestOutputHelper output)
: InfiniteTracingContainerTest<DebianArm64ContainerTestFixture>(fixture, output);

//[Trait("Architecture", "arm64")]
//public class UbuntuArm64InfiniteTracingContainerTest(UbuntuArm64ContainerTestFixture fixture, ITestOutputHelper output)
// : InfiniteTracingContainerTest<UbuntuArm64ContainerTestFixture>(fixture, output);

//[Trait("Architecture", "amd64")]
//public class CentosX64InfiniteTracingContainerTest(CentosX64ContainerTestFixture fixture, ITestOutputHelper output)
// : InfiniteTracingContainerTest<CentosX64ContainerTestFixture>(fixture, output);

//[Trait("Architecture", "arm64")]
//public class CentosArm64InfiniteTracingContainerTest(CentosArm64ContainerTestFixture fixture, ITestOutputHelper output)
// : InfiniteTracingContainerTest<CentosArm64ContainerTestFixture>(fixture, output);

[Trait("Architecture", "amd64")]
public class AmazonX64InfiniteTracingContainerTest(AmazonX64ContainerTestFixture fixture, ITestOutputHelper output)
: InfiniteTracingContainerTest<AmazonX64ContainerTestFixture>(fixture, output);

[Trait("Architecture", "arm64")]
public class AmazonArm64InfiniteTracingContainerTest(AmazonArm64ContainerTestFixture fixture, ITestOutputHelper output)
: InfiniteTracingContainerTest<AmazonArm64ContainerTestFixture>(fixture, output);

//[Trait("Architecture", "amd64")]
//public class FedoraX64InfiniteTracingContainerTest(FedoraX64ContainerTestFixture fixture, ITestOutputHelper output)
// : InfiniteTracingContainerTest<FedoraX64ContainerTestFixture>(fixture, output);

//[Trait("Architecture", "arm64")]
//public class FedoraArm64InfiniteTracingContainerTest(FedoraArm64ContainerTestFixture fixture, ITestOutputHelper output)
// : InfiniteTracingContainerTest<FedoraArm64ContainerTestFixture>(fixture, output);
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,15 @@ internal static string GenerateTopic()
}
}

[Trait("Architecture", "amd64")]
public class KafkaDotNet8Test : LinuxKafkaTest<KafkaDotNet8TestFixture>
{
public KafkaDotNet8Test(KafkaDotNet8TestFixture fixture, ITestOutputHelper output) : base(fixture, output)
{
}
}

[Trait("Architecture", "amd64")]
public class KafkaDotNet9Test : LinuxKafkaTest<KafkaDotNet9TestFixture>
{
public KafkaDotNet9Test(KafkaDotNet9TestFixture fixture, ITestOutputHelper output) : base(fixture, output)
Expand Down
Loading
Loading