Skip to content

Commit

Permalink
Update dotnet dependencies and add a dedicated "cargo build" step to …
Browse files Browse the repository at this point in the history
…reduce risk of timing out.
  • Loading branch information
ignatz committed Nov 14, 2024
1 parent 9bd4f31 commit 2e0d267
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 12 deletions.
26 changes: 20 additions & 6 deletions client/trailbase-dotnet/ClientTest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Xunit;
using System.Diagnostics;

namespace TrailBase;

Expand All @@ -22,14 +22,28 @@ public SimpleStrict(string? id, string? text_null, string? text_default, string
}

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}";
Expand Down Expand Up @@ -74,7 +88,7 @@ public void IdTest() {
}

[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);
Expand All @@ -92,7 +106,7 @@ public async void AuthTest() {
}

[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");

Expand Down
18 changes: 12 additions & 6 deletions client/trailbase-dotnet/TrailBase.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 2e0d267

Please sign in to comment.