fix: persist p-rec-update package load diagnostics
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
<ProjectReference Include="..\..\Launcher.Next.Application\Launcher.Next.Application.csproj" />
|
||||
<ProjectReference Include="..\..\Launcher.Next.Infrastructure\Launcher.Next.Infrastructure.csproj" />
|
||||
<ProjectReference Include="..\..\Launcher.Next.Autodesk\Launcher.Next.Autodesk.csproj" />
|
||||
<ProjectReference Include="..\..\Launcher.Next.App\Launcher.Next.App.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup><None Update="fixtures\p-rec-annot-pilot.manifest.json" CopyToOutputDirectory="PreserveNewest" /></ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
using System.Text.Json;
|
||||
using Launcher.Next.App;
|
||||
using Xunit;
|
||||
|
||||
namespace Launcher.Next.Tests;
|
||||
|
||||
public sealed class LocalParityEvidenceTests
|
||||
{
|
||||
[Fact]
|
||||
public async Task EvidenceWriter_AtomicallyPublishesValidatedSchema()
|
||||
{
|
||||
var root = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString("N"));
|
||||
try
|
||||
{
|
||||
Directory.CreateDirectory(root);
|
||||
var path = await LocalParityLaunchService.WriteEvidenceAsync(root, new { schemaVersion = 4, state = "PACKAGE_LOAD_VERIFIED" }, CancellationToken.None);
|
||||
Assert.True(File.Exists(path));
|
||||
using var document = JsonDocument.Parse(await File.ReadAllTextAsync(path));
|
||||
Assert.Equal(4, document.RootElement.GetProperty("schemaVersion").GetInt32());
|
||||
Assert.False(File.Exists(path + ".tmp"));
|
||||
}
|
||||
finally { if (Directory.Exists(root)) Directory.Delete(root, recursive: true); }
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task EvidenceWriter_ReplacesStaleTemporaryArtifact()
|
||||
{
|
||||
var root = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString("N"));
|
||||
try
|
||||
{
|
||||
Directory.CreateDirectory(root);
|
||||
await File.WriteAllTextAsync(Path.Combine(root, "controlled-local-parity-launch.json.tmp"), "stale");
|
||||
var path = await LocalParityLaunchService.WriteEvidenceAsync(root, new { schemaVersion = 4, terminalResult = "PACKAGE_LOAD_VERIFIED" }, CancellationToken.None);
|
||||
Assert.Contains("PACKAGE_LOAD_VERIFIED", await File.ReadAllTextAsync(path));
|
||||
Assert.False(File.Exists(path + ".tmp"));
|
||||
}
|
||||
finally { if (Directory.Exists(root)) Directory.Delete(root, recursive: true); }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user