From ba67cf5159e628ba856b12a0de390fdd6570cfce Mon Sep 17 00:00:00 2001 From: Jordan Dominion Date: Fri, 18 Apr 2025 09:55:47 -0400 Subject: [PATCH] Prevent race conditions with chat integration tests --- .github/workflows/ci-pipeline.yml | 6 ++---- .../Components/Chat/Providers/TestIrcProvider.cs | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci-pipeline.yml b/.github/workflows/ci-pipeline.yml index 1011e97ac7..c0943f5cca 100644 --- a/.github/workflows/ci-pipeline.yml +++ b/.github/workflows/ci-pipeline.yml @@ -519,8 +519,8 @@ jobs: - name: Run Unit Tests run: sudo dotnet test --no-build --logger "GitHubActions;summary.includePassedTests=true;summary.includeSkippedTests=true" --filter TestCategory!=RequiresDatabase -c ${{ matrix.configuration }}NoWindows --collect:"XPlat Code Coverage" --settings build/ci.runsettings --results-directory ./TestResults tgstation-server.sln env: - TGS_TEST_DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }} - TGS_TEST_IRC_CONNECTION_STRING: ${{ secrets.IRC_CONNECTION_STRING }} + TGS_TEST_DISCORD_TOKEN: ${{ matrix.configuration == 'Release' && secrets.DISCORD_TOKEN || '' }} + TGS_TEST_IRC_CONNECTION_STRING: ${{ matrix.configuration == 'Release' && secrets.IRC_CONNECTION_STRING || '' }} TGS_TEST_APP_ID: ${{ secrets.APP_ID }} TGS_TEST_APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }} TGS_TEST_REPO_SLUG: ${{ github.repository }} @@ -588,8 +588,6 @@ jobs: - name: Run Unit Tests run: dotnet test --no-build --logger "GitHubActions;summary.includePassedTests=true;summary.includeSkippedTests=true" --filter TestCategory!=RequiresDatabase -c ${{ matrix.configuration }}NoWix --collect:"XPlat Code Coverage" --settings build/ci.runsettings --results-directory ./TestResults tgstation-server.sln env: - TGS_TEST_DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }} - TGS_TEST_IRC_CONNECTION_STRING: ${{ secrets.IRC_CONNECTION_STRING }} TGS_TEST_APP_ID: ${{ secrets.APP_ID }} TGS_TEST_APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }} TGS_TEST_REPO_SLUG: ${{ github.repository }} diff --git a/tests/Tgstation.Server.Host.Tests/Components/Chat/Providers/TestIrcProvider.cs b/tests/Tgstation.Server.Host.Tests/Components/Chat/Providers/TestIrcProvider.cs index 834be3bcad..b39f84f4c0 100644 --- a/tests/Tgstation.Server.Host.Tests/Components/Chat/Providers/TestIrcProvider.cs +++ b/tests/Tgstation.Server.Host.Tests/Components/Chat/Providers/TestIrcProvider.cs @@ -61,7 +61,7 @@ namespace Tgstation.Server.Host.Components.Chat.Providers.Tests public async Task TestConnectAndDisconnect() { var actualToken = Environment.GetEnvironmentVariable("TGS_TEST_IRC_CONNECTION_STRING"); - if (actualToken == null) + if (String.IsNullOrWhiteSpace(actualToken)) Assert.Inconclusive("Required environment variable TGS_TEST_IRC_CONNECTION_STRING isn't set!"); if (!new IrcConnectionStringBuilder(actualToken).Valid)