diff --git a/build/Build.Windows.ps1 b/build/Build.Windows.ps1 index d3e803c..d18263e 100644 --- a/build/Build.Windows.ps1 +++ b/build/Build.Windows.ps1 @@ -29,6 +29,18 @@ function Execute-Tests($version) { & dotnet test ./test/SeqCli.Tests/SeqCli.Tests.csproj -c Release --framework "$framework" /p:Configuration=Release /p:Platform=x64 /p:VersionPrefix=$version if($LASTEXITCODE -ne 0) { throw "Build failed" } + + choco install seq + $env:PATH="C:\Program Files\Seq;$env:PATH" + + cd ./test/SeqCli.EndToEnd/ + & dotnet run -f $framework + if ($LASTEXITCODE -ne 0) + { + cd ../.. + exit 1 + } + cd ../.. } function Create-ArtifactDir diff --git a/src/SeqCli/Forwarder/Util/CaptiveProcess.cs b/src/SeqCli/Forwarder/Util/CaptiveProcess.cs index 0c2e3e4..be40279 100644 --- a/src/SeqCli/Forwarder/Util/CaptiveProcess.cs +++ b/src/SeqCli/Forwarder/Util/CaptiveProcess.cs @@ -14,6 +14,7 @@ using System; using System.Diagnostics; +using System.Collections.Generic; using System.Threading; namespace SeqCli.Forwarder.Util; @@ -25,7 +26,8 @@ public static int Run( string? args = null, Action? writeStdout = null, Action? writeStderr = null, - string? workingDirectory = null) + string? workingDirectory = null, + Dictionary? environment = null) { if (fullExePath == null) throw new ArgumentNullException(nameof(fullExePath)); @@ -48,6 +50,14 @@ public static int Run( if (!string.IsNullOrEmpty(workingDirectory)) startInfo.WorkingDirectory = workingDirectory; + if (environment != null) + { + foreach (var (k, v) in environment) + { + startInfo.EnvironmentVariables.Add(k, v); + } + } + using var process = Process.Start(startInfo)!; using var outputComplete = new ManualResetEvent(false); using var errorComplete = new ManualResetEvent(false); diff --git a/src/SeqCli/SeqCli.csproj b/src/SeqCli/SeqCli.csproj index b6caa5e..2c376c7 100644 --- a/src/SeqCli/SeqCli.csproj +++ b/src/SeqCli/SeqCli.csproj @@ -32,7 +32,7 @@ - + diff --git a/test/SeqCli.EndToEnd/Support/TestConfiguration.cs b/test/SeqCli.EndToEnd/Support/TestConfiguration.cs index ddb3756..e3b35aa 100644 --- a/test/SeqCli.EndToEnd/Support/TestConfiguration.cs +++ b/test/SeqCli.EndToEnd/Support/TestConfiguration.cs @@ -53,6 +53,9 @@ public CaptiveProcess SpawnServerProcess(string storagePath) return new CaptiveProcess(containerRuntime, $"run --name {containerName} -d -e ACCEPT_EULA=Y -e SEQ_FIRSTRUN_NOAUTHENTICATION=True -p {_serverListenPort}:80 datalust/seq:{imageTag}", stopCommandFullExePath: containerRuntime, stopCommandArgs: $"rm -f {containerName}"); } - return new CaptiveProcess("seq", commandWithArgs); + return new CaptiveProcess("seq", commandWithArgs, environment: new Dictionary + { + { "SEQ_FIRSTRUN_NOAUTHENTICATION", "True" } + }); } }