sln build fix (again), tests fixes, audit work and doctors work
This commit is contained in:
@@ -168,7 +168,7 @@ public sealed class AdvisoryChatIntentRouterTests
|
||||
|
||||
[Theory]
|
||||
[InlineData("How do I fix CVE-2024-12345?", AdvisoryChatIntent.ProposeFix)]
|
||||
[InlineData("What's the remediation for this vulnerability?", AdvisoryChatIntent.ProposeFix)]
|
||||
[InlineData("What's the remediation for CVE-2024-12345?", AdvisoryChatIntent.ProposeFix)]
|
||||
[InlineData("Patch options for openssl", AdvisoryChatIntent.ProposeFix)]
|
||||
public async Task RouteAsync_NaturalLanguageFix_InfersProposeFixIntent(
|
||||
string input, AdvisoryChatIntent expectedIntent)
|
||||
|
||||
@@ -271,6 +271,16 @@ public sealed class AdvisoryChatDeterminismTests
|
||||
SbomDigest = "sha256:sbom123",
|
||||
ComponentCount = 10
|
||||
});
|
||||
mockSbom.Setup(x => x.GetFindingDataAsync(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string?>(), It.IsAny<CancellationToken>()))
|
||||
.ReturnsAsync(new FindingData
|
||||
{
|
||||
Type = "CVE",
|
||||
Id = "CVE-2024-12345",
|
||||
Package = "pkg:npm/test-package@1.0.0",
|
||||
Severity = "High",
|
||||
CvssScore = 7.5,
|
||||
Description = "Test vulnerability"
|
||||
});
|
||||
|
||||
return new EvidenceBundleAssembler(
|
||||
mockVex.Object,
|
||||
@@ -313,6 +323,16 @@ public sealed class AdvisoryChatDeterminismTests
|
||||
SbomDigest = "sha256:sbom123",
|
||||
ComponentCount = 10
|
||||
});
|
||||
mockSbom.Setup(x => x.GetFindingDataAsync(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string?>(), It.IsAny<CancellationToken>()))
|
||||
.ReturnsAsync(new FindingData
|
||||
{
|
||||
Type = "CVE",
|
||||
Id = "CVE-2024-12345",
|
||||
Package = "pkg:npm/test-package@1.0.0",
|
||||
Severity = "High",
|
||||
CvssScore = 7.5,
|
||||
Description = "Test vulnerability"
|
||||
});
|
||||
|
||||
return new EvidenceBundleAssembler(
|
||||
mockVex.Object,
|
||||
|
||||
@@ -149,17 +149,23 @@ public sealed class LocalInferenceClientTests
|
||||
var chunks = new List<AdvisoryChatResponseChunk>();
|
||||
|
||||
// Act
|
||||
await foreach (var chunk in _client.StreamResponseAsync(bundle, routingResult, cts.Token))
|
||||
try
|
||||
{
|
||||
chunks.Add(chunk);
|
||||
if (chunks.Count >= 2)
|
||||
await foreach (var chunk in _client.StreamResponseAsync(bundle, routingResult, cts.Token))
|
||||
{
|
||||
cts.Cancel();
|
||||
chunks.Add(chunk);
|
||||
if (chunks.Count >= 2)
|
||||
{
|
||||
cts.Cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
// Expected - cancellation was requested
|
||||
}
|
||||
|
||||
// Assert - should have stopped early due to cancellation
|
||||
// (but OperationCanceledException might be thrown)
|
||||
// Assert - should have stopped due to cancellation
|
||||
Assert.True(chunks.Count >= 2);
|
||||
}
|
||||
|
||||
|
||||
@@ -48,8 +48,8 @@ public sealed class SystemPromptLoaderTests
|
||||
var cts = new CancellationTokenSource();
|
||||
cts.Cancel();
|
||||
|
||||
// Act & Assert
|
||||
await Assert.ThrowsAsync<OperationCanceledException>(() =>
|
||||
// Act & Assert - TaskCanceledException derives from OperationCanceledException
|
||||
await Assert.ThrowsAnyAsync<OperationCanceledException>(() =>
|
||||
loader.LoadSystemPromptAsync(cts.Token));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user