fix tests. new product advisories enhancements

This commit is contained in:
master
2026-01-25 19:11:36 +02:00
parent c70e83719e
commit 6e687b523a
504 changed files with 40610 additions and 3785 deletions

View File

@@ -68,14 +68,14 @@ public sealed class BinaryIndexOpsModelsTests
WarmPreloadEnabled = true,
Isas = new Dictionary<string, IsaWarmness>
{
["intel-64"] = new IsaWarmness { Warm = true, AvailableCount = 4, MaxCount = 4 },
["armv8-64"] = new IsaWarmness { Warm = false, AvailableCount = 0, MaxCount = 4 }
["intel-64"] = new IsaWarmness { IsWarm = true, PooledCount = 4, MaxPoolSize = 4 },
["armv8-64"] = new IsaWarmness { IsWarm = false, PooledCount = 0, MaxPoolSize = 4 }
}.ToImmutableDictionary()
};
Assert.Equal(2, warmness.Isas.Count);
Assert.True(warmness.Isas["intel-64"].Warm);
Assert.False(warmness.Isas["armv8-64"].Warm);
Assert.True(warmness.Isas["intel-64"].IsWarm);
Assert.False(warmness.Isas["armv8-64"].IsWarm);
}
#endregion
@@ -89,10 +89,10 @@ public sealed class BinaryIndexOpsModelsTests
var json = JsonSerializer.Serialize(response, JsonOptions);
Assert.Contains("latencySummary", json);
Assert.Contains("p50", json);
Assert.Contains("p95", json);
Assert.Contains("p99", json);
Assert.Contains("latency", json);
Assert.Contains("p50Ms", json);
Assert.Contains("p95Ms", json);
Assert.Contains("p99Ms", json);
}
[Fact]
@@ -100,18 +100,18 @@ public sealed class BinaryIndexOpsModelsTests
{
var summary = new BenchLatencySummary
{
Min = 1.0,
Max = 100.0,
Mean = 25.0,
P50 = 20.0,
P95 = 80.0,
P99 = 95.0
MinMs = 1.0,
MaxMs = 100.0,
MeanMs = 25.0,
P50Ms = 20.0,
P95Ms = 80.0,
P99Ms = 95.0
};
Assert.Equal(1.0, summary.Min);
Assert.Equal(100.0, summary.Max);
Assert.True(summary.P50 <= summary.P95);
Assert.True(summary.P95 <= summary.P99);
Assert.Equal(1.0, summary.MinMs);
Assert.Equal(100.0, summary.MaxMs);
Assert.True(summary.P50Ms <= summary.P95Ms);
Assert.True(summary.P95Ms <= summary.P99Ms);
}
[Fact]
@@ -144,6 +144,7 @@ public sealed class BinaryIndexOpsModelsTests
{
var stats = new BinaryIndexFunctionCacheStats
{
Timestamp = "2026-01-16T10:00:00Z",
Enabled = true,
Backend = "valkey",
Hits = 800,
@@ -151,7 +152,7 @@ public sealed class BinaryIndexOpsModelsTests
Evictions = 50,
HitRate = 0.8,
KeyPrefix = "binidx:fn:",
CacheTtlSeconds = 3600
CacheTtl = "01:00:00"
};
Assert.Equal(0.8, stats.HitRate);
@@ -164,6 +165,7 @@ public sealed class BinaryIndexOpsModelsTests
{
var stats = new BinaryIndexFunctionCacheStats
{
Timestamp = "2026-01-16T10:00:00Z",
Enabled = false,
Backend = "none",
Hits = 0,
@@ -171,7 +173,7 @@ public sealed class BinaryIndexOpsModelsTests
Evictions = 0,
HitRate = 0.0,
KeyPrefix = "",
CacheTtlSeconds = 0
CacheTtl = "00:00:00"
};
Assert.False(stats.Enabled);
@@ -183,6 +185,7 @@ public sealed class BinaryIndexOpsModelsTests
{
var stats = new BinaryIndexFunctionCacheStats
{
Timestamp = "2026-01-16T10:00:00Z",
Enabled = true,
Backend = "valkey",
Hits = 100,
@@ -190,7 +193,7 @@ public sealed class BinaryIndexOpsModelsTests
Evictions = 5,
HitRate = 0.909,
KeyPrefix = "test:",
CacheTtlSeconds = 3600,
CacheTtl = "01:00:00",
EstimatedEntries = 1000,
EstimatedMemoryBytes = 52428800 // 50 MB
};
@@ -224,7 +227,7 @@ public sealed class BinaryIndexOpsModelsTests
var config = CreateSampleEffectiveConfig();
Assert.NotNull(config.Versions);
Assert.NotNull(config.Versions.BinaryIndex);
Assert.NotNull(config.Versions.Service);
Assert.NotNull(config.Versions.B2R2);
}
@@ -234,13 +237,14 @@ public sealed class BinaryIndexOpsModelsTests
var view = new B2R2PoolConfigView
{
MaxPoolSizePerIsa = 4,
WarmPreload = true,
AcquireTimeoutMs = 5000,
EnableMetrics = true
WarmPreloadEnabled = true,
WarmPreloadIsas = ImmutableArray<string>.Empty,
AcquireTimeoutSeconds = 5.0,
MetricsEnabled = true
};
Assert.Equal(4, view.MaxPoolSizePerIsa);
Assert.True(view.WarmPreload);
Assert.True(view.WarmPreloadEnabled);
}
[Fact]
@@ -251,14 +255,15 @@ public sealed class BinaryIndexOpsModelsTests
Enabled = true,
Backend = "valkey",
KeyPrefix = "binidx:fn:",
CacheTtlSeconds = 3600,
MaxTtlSeconds = 86400,
EarlyExpiryPercent = 10,
CacheTtl = "01:00:00",
MaxTtl = "1.00:00:00",
EarlyExpiryEnabled = true,
EarlyExpiryFactor = 0.1,
MaxEntrySizeBytes = 1048576
};
Assert.Equal(3600, view.CacheTtlSeconds);
Assert.Equal(86400, view.MaxTtlSeconds);
Assert.Equal("01:00:00", view.CacheTtl);
Assert.Equal("1.00:00:00", view.MaxTtl);
}
[Fact]
@@ -266,14 +271,16 @@ public sealed class BinaryIndexOpsModelsTests
{
var versions = new BackendVersions
{
BinaryIndex = "1.0.0",
Service = "1.0.0",
B2R2 = "0.9.1",
Dotnet = "10.0.0",
Valkey = "7.0.0",
Postgresql = "16.1"
};
Assert.NotNull(versions.BinaryIndex);
Assert.NotNull(versions.Service);
Assert.NotNull(versions.B2R2);
Assert.NotNull(versions.Dotnet);
Assert.NotNull(versions.Valkey);
Assert.NotNull(versions.Postgresql);
}
@@ -313,6 +320,7 @@ public sealed class BinaryIndexOpsModelsTests
{
var unavailableStats = new BinaryIndexFunctionCacheStats
{
Timestamp = "2026-01-16T10:00:00Z",
Enabled = true,
Backend = "valkey",
Hits = 0,
@@ -320,11 +328,10 @@ public sealed class BinaryIndexOpsModelsTests
Evictions = 0,
HitRate = 0.0,
KeyPrefix = "binidx:fn:",
CacheTtlSeconds = 3600,
ErrorMessage = "Valkey connection failed"
CacheTtl = "01:00:00"
};
Assert.NotNull(unavailableStats.ErrorMessage);
// Note: Core model doesn't have ErrorMessage, would need to check via Components.Valkey status
}
#endregion
@@ -349,7 +356,7 @@ public sealed class BinaryIndexOpsModelsTests
WarmPreloadEnabled = true,
Isas = new Dictionary<string, IsaWarmness>
{
["intel-64"] = new IsaWarmness { Warm = true, AvailableCount = 4, MaxCount = 4 }
["intel-64"] = new IsaWarmness { IsWarm = true, PooledCount = 4, MaxPoolSize = 4 }
}.ToImmutableDictionary()
}
};
@@ -361,15 +368,16 @@ public sealed class BinaryIndexOpsModelsTests
{
Timestamp = "2026-01-16T10:05:00Z",
SampleSize = 10,
LatencySummary = new BenchLatencySummary
Latency = new BenchLatencySummary
{
Min = 1.2,
Max = 15.8,
Mean = 5.4,
P50 = 4.5,
P95 = 12.3,
P99 = 14.9
MinMs = 1.2,
MaxMs = 15.8,
MeanMs = 5.4,
P50Ms = 4.5,
P95Ms = 12.3,
P99Ms = 14.9
},
Success = true,
Operations = new[]
{
new BenchOperationResult { Operation = "lifter_acquire", LatencyMs = 2.1, Success = true },
@@ -382,45 +390,52 @@ public sealed class BinaryIndexOpsModelsTests
{
return new BinaryIndexEffectiveConfig
{
Timestamp = "2026-01-16T10:00:00Z",
B2R2Pool = new B2R2PoolConfigView
{
MaxPoolSizePerIsa = 4,
WarmPreload = true,
AcquireTimeoutMs = 5000,
EnableMetrics = true
WarmPreloadEnabled = true,
WarmPreloadIsas = ImmutableArray<string>.Empty,
AcquireTimeoutSeconds = 5.0,
MetricsEnabled = true
},
SemanticLifting = new SemanticLiftingConfigView
{
Enabled = true,
B2R2Version = "0.9.1",
NormalizationRecipeVersion = "1.0.0",
MaxInstructionsPerFunction = 10000,
MaxFunctionsPerBinary = 5000,
FunctionLiftTimeoutMs = 30000,
EnableDeduplication = true
FunctionLiftTimeoutSeconds = 30.0,
DeduplicationEnabled = true
},
FunctionCache = new FunctionCacheConfigView
{
Enabled = true,
Backend = "valkey",
KeyPrefix = "binidx:fn:",
CacheTtlSeconds = 3600,
MaxTtlSeconds = 86400,
EarlyExpiryPercent = 10,
CacheTtl = "01:00:00",
MaxTtl = "1.00:00:00",
EarlyExpiryEnabled = true,
EarlyExpiryFactor = 0.1,
MaxEntrySizeBytes = 1048576
},
Persistence = new PersistenceConfigView
{
Enabled = true,
Schema = "binary_index",
MinPoolSize = 2,
MaxPoolSize = 10,
CommandTimeoutSeconds = 30,
RetryOnFailure = true,
RetryOnFailureEnabled = true,
MaxRetryCount = 3,
BatchSize = 100
},
Versions = new BackendVersions
{
BinaryIndex = "1.0.0",
Service = "1.0.0",
B2R2 = "0.9.1",
Dotnet = "10.0.0",
Valkey = "7.0.0",
Postgresql = "16.1"
}

View File

@@ -32,11 +32,11 @@ public sealed class BinaryIndexOptionsTests
// FunctionCache defaults
Assert.True(options.FunctionCache.Enabled);
Assert.Equal("binidx:fn:", options.FunctionCache.KeyPrefix);
Assert.Equal("stellaops:binidx:funccache:", options.FunctionCache.KeyPrefix);
// Persistence defaults
Assert.Equal("binary_index", options.Persistence.Schema);
Assert.True(options.Persistence.RetryOnFailure);
Assert.True(options.Persistence.EnableRetryOnFailure);
// Ops defaults
Assert.True(options.Ops.EnableHealthEndpoint);
@@ -155,7 +155,7 @@ public sealed class BinaryIndexOptionsTests
var options = new BinaryIndexPersistenceOptions();
Assert.Equal(2, options.MinPoolSize);
Assert.Equal(10, options.MaxPoolSize);
Assert.Equal(20, options.MaxPoolSize);
Assert.Equal(TimeSpan.FromSeconds(30), options.CommandTimeout);
}