Add capture index manifest for group testing
This commit is contained in:
@@ -39,6 +39,35 @@ public sealed class FileTurnTelemetrySinkTests
|
||||
Assert.Equal(1234, payload.GetProperty("details").GetProperty("bufferedAudioBytes").GetInt32());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task RecordsCaptureIndexForTurnDiagnosticsAndErrors()
|
||||
{
|
||||
var directoryPath = Path.Combine(Path.GetTempPath(), "OpenJibo.Tests", Guid.NewGuid().ToString("N"));
|
||||
var sink = new FileTurnTelemetrySink(
|
||||
NullLogger<FileTurnTelemetrySink>.Instance,
|
||||
Options.Create(new TurnTelemetryOptions
|
||||
{
|
||||
Enabled = true,
|
||||
DirectoryPath = directoryPath
|
||||
}));
|
||||
|
||||
await sink.RecordTurnDiagnosticAsync("yes_no_turn_received", new Dictionary<string, object?>
|
||||
{
|
||||
["transID"] = "trans-1",
|
||||
["bufferedAudioBytes"] = 1234
|
||||
});
|
||||
|
||||
await sink.RecordTranscriptError(new InvalidOperationException("boom"), "turn error");
|
||||
|
||||
var indexPath = Path.Combine(directoryPath, "capture-index.ndjson");
|
||||
var lines = await File.ReadAllLinesAsync(indexPath);
|
||||
|
||||
Assert.Contains(lines, line => line.Contains("\"eventType\":\"yes_no_turn_received\"", StringComparison.Ordinal));
|
||||
Assert.Contains(lines, line => line.Contains("\"eventType\":\"transcript_error\"", StringComparison.Ordinal));
|
||||
Assert.Contains(lines, line => line.Contains("\"message\":\"Turn telemetry diagnostic\"", StringComparison.Ordinal));
|
||||
Assert.Contains(lines, line => line.Contains("\"message\":\"Turn telemetry error\"", StringComparison.Ordinal));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task RecordsTranscriptErrorOnTurnError()
|
||||
{
|
||||
@@ -148,4 +177,4 @@ public sealed class FileTurnTelemetrySinkTests
|
||||
It.IsAny<CancellationToken>()),
|
||||
Times.AtLeastOnce());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user