Daemon: POSIX artifact URIs; tests find session files through StoreFileName #25
2 changed files with 9 additions and 4 deletions
|
|
@ -1132,7 +1132,12 @@ public sealed class AquaSynthDaemonService : IDisposable
|
|||
|
||||
private static string SessionId(string patchId, string compileKey) => $"{StoreFileName.From(patchId)}-{compileKey[..Math.Min(12, compileKey.Length)]}";
|
||||
|
||||
private static string ToArtifactUri(string path) => $"file:///{Path.GetFullPath(path).Replace('\\', '/')}";
|
||||
// `C:\a\b` -> file:///C:/a/b and `/a/b` -> file:///a/b; a bare "file:///" prefix made POSIX paths file:////a/b, which Uri reads as a UNC host.
|
||||
private static string ToArtifactUri(string path)
|
||||
{
|
||||
var full = Path.GetFullPath(path).Replace('\\', '/');
|
||||
return full.StartsWith('/') ? $"file://{full}" : $"file:///{full}";
|
||||
}
|
||||
|
||||
private static string Now() => DateTimeOffset.UtcNow.ToString("O");
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ public sealed class AquaSynthDaemonServiceTests
|
|||
Assert.True(File.Exists(UriToPath(result.RenderReceipt.Float32Uri)));
|
||||
Assert.True(File.Exists(UriToPath(result.RenderReceipt.WavUri)));
|
||||
Assert.Equal(result.RenderReceipt.SampleCount * sizeof(float), new FileInfo(UriToPath(result.RenderReceipt.Float32Uri)).Length);
|
||||
Assert.True(File.Exists(Path.Combine(storeRoot, "sessions", $"{result.CompileReceipt.SessionId}.cc")));
|
||||
Assert.True(File.Exists(Path.Combine(storeRoot, "sessions", $"{StoreFileName.From(result.CompileReceipt.SessionId)}.cc")));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -154,7 +154,7 @@ public sealed class AquaSynthDaemonServiceTests
|
|||
Assert.True(File.Exists(UriToPath(quiet.Float32Uri)));
|
||||
Assert.True(File.Exists(UriToPath(loud.Float32Uri)));
|
||||
Assert.Equal(128 * sizeof(float), new FileInfo(UriToPath(loud.Float32Uri)).Length);
|
||||
Assert.True(File.Exists(Path.Combine(storeRoot, "live", $"{close.ReceiptId}.cc")));
|
||||
Assert.True(File.Exists(Path.Combine(storeRoot, "live", $"{StoreFileName.From(close.ReceiptId)}.cc")));
|
||||
var liveState = await ReadLiveSessionStateAsync(storeRoot, open.SessionId);
|
||||
Assert.Equal(open.SessionId, liveState.SessionId);
|
||||
Assert.Equal("closed", liveState.Status);
|
||||
|
|
@ -210,7 +210,7 @@ public sealed class AquaSynthDaemonServiceTests
|
|||
private static async Task<AquaSynthLiveInstrumentSessionState> ReadLiveSessionStateAsync(string storeRoot, string sessionId)
|
||||
{
|
||||
using var cache = await CultCacheMessagePack.OpenAsync(
|
||||
Path.Combine(storeRoot, "live-sessions", $"{sessionId}.cc")).ConfigureAwait(false);
|
||||
Path.Combine(storeRoot, "live-sessions", $"{StoreFileName.From(sessionId)}.cc")).ConfigureAwait(false);
|
||||
return Assert.Single(cache.GetAll<AquaSynthLiveInstrumentSessionState>());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue