Skip to content

Commit

Permalink
ci: Assign a unique network name in docker compose for each test exec…
Browse files Browse the repository at this point in the history
…ution to avoid collisions. (#1892)
  • Loading branch information
tippmar-nr authored Sep 8, 2023
1 parent 16ad4b0 commit e1ae31b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ version: "3"
# 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)
# NETWORK_NAME The network name to use for containers in this app. Should be unique among all running instances.
#
# and the usual suspects:
# NEW_RELIC_LICENSE_KEY
Expand Down Expand Up @@ -74,4 +75,9 @@ services:
extends:
service: smoketestapp
build:
dockerfile: SmokeTestApp/Dockerfile.centos
dockerfile: SmokeTestApp/Dockerfile.centos

networks:
default:
name: ${NETWORK_NAME}
driver: bridge
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ public override void Start(string commandLineArguments, Dictionary<string, strin
startInfo.EnvironmentVariables.Remove("CORECLR_PROFILER");
startInfo.EnvironmentVariables.Remove("CORECLR_PROFILER_PATH");
startInfo.EnvironmentVariables.Remove("CORECLR_NEWRELIC_HOME");
startInfo.EnvironmentVariables.Remove("NETWORK_NAME");

// Docker compose settings
var testConfiguration = IntegrationTestConfiguration.GetIntegrationTestConfiguration("Default");
Expand All @@ -120,6 +121,7 @@ public override void Start(string commandLineArguments, Dictionary<string, strin
startInfo.EnvironmentVariables.Add("AGENT_PATH", newRelicHomeDirectoryPath);
startInfo.EnvironmentVariables.Add("LOG_PATH", profilerLogDirectoryPath);
startInfo.EnvironmentVariables.Add("CONTAINER_NAME", ContainerName);
startInfo.EnvironmentVariables.Add("NETWORK_NAME", Guid.NewGuid().ToString()); // generate a random network name to keep parallel test execution from failing

if (AdditionalEnvironmentVariables != null)
{
Expand Down

0 comments on commit e1ae31b

Please sign in to comment.