perf: use stable sha256 cache keys for summarizer requests
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System.Reflection;
|
||||
using JobTrackerApi.Controllers;
|
||||
using JobTrackerApi.Services;
|
||||
using Xunit;
|
||||
|
||||
namespace JobTrackerApi.Tests;
|
||||
@@ -19,4 +20,19 @@ public sealed class OwnershipGuardTests
|
||||
var method = typeof(CorrespondenceController).GetMethod("FindOwnedMessageAsync", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
Assert.NotNull(method);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Summarizer_service_uses_sha256_cache_key_builder()
|
||||
{
|
||||
var method = typeof(SummarizerService).GetMethod("BuildCacheKey", BindingFlags.NonPublic | BindingFlags.Static);
|
||||
Assert.NotNull(method);
|
||||
|
||||
var first = (string)method!.Invoke(null, new object[] { "example text", 150, 30 })!;
|
||||
var second = (string)method.Invoke(null, new object[] { "example text", 150, 30 })!;
|
||||
var different = (string)method.Invoke(null, new object[] { "different text", 150, 30 })!;
|
||||
|
||||
Assert.Equal(first, second);
|
||||
Assert.StartsWith("summ:", first);
|
||||
Assert.NotEqual(first, different);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user