Update dotnet dependencies and add a dedicated "cargo build" step to reduce risk of timing out.

This commit is contained in:
Sebastian Jeltsch
2024-11-14 20:42:17 +01:00
parent 9bd4f31517
commit 2e0d267d2a
2 changed files with 32 additions and 12 deletions

View File

@@ -1,4 +1,4 @@
using Xunit;
using System.Diagnostics;
namespace TrailBase;
@@ -22,14 +22,28 @@ class SimpleStrict {
}
public class ClientTestFixture : IDisposable {
System.Diagnostics.Process process;
Process process;
public ClientTestFixture() {
var address = $"127.0.0.1:{Constants.Port}";
string projectDirectory = Directory.GetParent(Environment.CurrentDirectory)!.Parent!.Parent!.FullName;
Console.WriteLine($"Building TrailBase: {projectDirectory}");
var buildProcess = new Process();
buildProcess.StartInfo.WorkingDirectory = projectDirectory;
buildProcess.StartInfo.FileName = "cargo";
buildProcess.StartInfo.Arguments = "build";
buildProcess.StartInfo.UseShellExecute = false;
buildProcess.StartInfo.RedirectStandardOutput = true;
buildProcess.Start();
var exited = buildProcess.WaitForExit(TimeSpan.FromMinutes(10));
if (!exited) {
buildProcess.Kill();
}
var address = $"127.0.0.1:{Constants.Port}";
Console.WriteLine($"Starting TrailBase: {address}: {projectDirectory}");
process = new System.Diagnostics.Process();
process = new Process();
process.StartInfo.WorkingDirectory = projectDirectory;
process.StartInfo.FileName = "cargo";
process.StartInfo.Arguments = $"run -- --data-dir ../testfixture run --dev -a {address}";
@@ -74,7 +88,7 @@ public class ClientTest : IClassFixture<ClientTestFixture> {
}
[Fact]
public async void AuthTest() {
public async Task AuthTest() {
var client = new Client($"http://127.0.0.1:{Constants.Port}", null);
var oldTokens = await client.Login("admin@localhost", "secret");
Assert.NotNull(oldTokens?.auth_token);
@@ -92,7 +106,7 @@ public class ClientTest : IClassFixture<ClientTestFixture> {
}
[Fact]
public async void RecordsTest() {
public async Task RecordsTest() {
var client = new Client($"http://127.0.0.1:{Constants.Port}", null);
await client.Login("admin@localhost", "secret");

View File

@@ -7,13 +7,19 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="coverlet.collector" Version="6.0.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="9.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.2.0" />
<PackageReference Include="xunit" Version="2.5.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>