Skip to content

Commit

Permalink
* Misc other changes from #1519
Browse files Browse the repository at this point in the history
  • Loading branch information
lukebakken committed Mar 27, 2024
1 parent 0f87fe2 commit 4283dca
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 12 deletions.
6 changes: 3 additions & 3 deletions .ci/ubuntu/gha-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ function start_toxiproxy
# sudo ss -4nlp
echo "[INFO] starting Toxiproxy server docker container"
docker rm --force "$toxiproxy_docker_name" 2>/dev/null || echo "[INFO] $toxiproxy_docker_name was not running"
docker run --pull always --detach \
docker run --detach \
--name "$toxiproxy_docker_name" \
--hostname "$toxiproxy_docker_name" \
--publish 8474:8474 \
--publish 55672:55672 \
--network "$docker_network_name" \
'ghcr.io/shopify/toxiproxy:2.7.0'
'ghcr.io/shopify/toxiproxy:latest'
fi
}

Expand All @@ -58,7 +58,7 @@ function start_rabbitmq
echo "[INFO] starting RabbitMQ server docker container"
chmod 0777 "$GITHUB_WORKSPACE/.ci/ubuntu/log"
docker rm --force "$rabbitmq_docker_name" 2>/dev/null || echo "[INFO] $rabbitmq_docker_name was not running"
docker run --pull always --detach \
docker run --detach \
--name "$rabbitmq_docker_name" \
--hostname "$rabbitmq_docker_name" \
--publish 5671:5671 \
Expand Down
15 changes: 14 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,22 @@ RABBITMQ_DOCKER_NAME ?= rabbitmq-dotnet-client-rabbitmq
build:
dotnet build $(CURDIR)/Build.csproj

# Note:
#
# --environment 'GITHUB_ACTIONS=true'
#
# The above argument is passed to `dotnet test` because it's assumed you
# use this command to set up your local environment on Linux:
#
# ./.ci/ubuntu/gha-setup.sh toxiproxy
#
# The gha-setup.sh command has been tested on Ubuntu 22 and Arch Linux
# and should work on any Linux system with a recent docker.
#
test:
dotnet test $(CURDIR)/projects/Test/Unit/Unit.csproj --logger 'console;verbosity=detailed'
dotnet test --environment "RABBITMQ_RABBITMQCTL_PATH=DOCKER:$$(docker inspect --format='{{.Id}}' $(RABBITMQ_DOCKER_NAME))" \
dotnet test --environment 'GITHUB_ACTIONS=true' \
--environment "RABBITMQ_RABBITMQCTL_PATH=DOCKER:$$(docker inspect --format='{{.Id}}' $(RABBITMQ_DOCKER_NAME))" \
--environment 'RABBITMQ_LONG_RUNNING_TESTS=true' $(CURDIR)/projects/Test/Integration/Integration.csproj --logger 'console;verbosity=detailed'
--environment 'RABBITMQ_TOXIPROXY_TESTS=true' \
--environment 'PASSWORD=grapefruit' \
Expand Down
14 changes: 13 additions & 1 deletion projects/Test/Common/TestOutputWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
// Copyright (c) 2007-2020 VMware, Inc. All rights reserved.
//---------------------------------------------------------------------------

using System;
using System.IO;
using System.Text;
using Xunit.Abstractions;
Expand Down Expand Up @@ -56,7 +57,18 @@ public override void Write(char[] buffer, int index, int count)
sb.Append(_testDisplayName);
sb.Append(" | ");
sb.Append(buffer, index, count);
_output.WriteLine(sb.ToString().TrimEnd());
try
{
_output.WriteLine(sb.ToString().TrimEnd());
}
catch (InvalidOperationException)
{
/*
* Note:
* This exception can be thrown if there is no running test.
* Catch it here to prevent it causing an incorrect test failure.
*/
}
}
}
}
Expand Down
7 changes: 0 additions & 7 deletions projects/Test/Integration/SslEnv.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public class SslEnv
private const string _hostname = "localhost";
private readonly string _sslDir;
private readonly bool _isSslConfigured;
private readonly bool _isGithubActions;

public SslEnv()
{
Expand All @@ -53,7 +52,6 @@ public SslEnv()

if (_isSslConfigured)
{
Boolean.TryParse(Environment.GetEnvironmentVariable("GITHUB_ACTIONS"), out _isGithubActions);
_certPath = Path.Combine(_sslDir, $"client_{_hostname}.p12");
}
}
Expand All @@ -77,10 +75,5 @@ public bool IsSslConfigured
{
get { return _isSslConfigured; }
}

public bool IsGitHubActions
{
get { return _isGithubActions; }
}
}
}

0 comments on commit 4283dca

Please sign in to comment.