tests fixes and some product advisories tunes ups
This commit is contained in:
@@ -23,7 +23,7 @@ public sealed class HlcTimestampJsonConverter : JsonConverter<HlcTimestamp>
|
||||
{
|
||||
if (reader.TokenType == JsonTokenType.Null)
|
||||
{
|
||||
return default;
|
||||
throw new JsonException("Cannot deserialize null to HlcTimestamp. Use HlcTimestamp? with NullableHlcTimestampJsonConverter for nullable timestamps.");
|
||||
}
|
||||
|
||||
if (reader.TokenType != JsonTokenType.String)
|
||||
|
||||
@@ -111,12 +111,30 @@ public static class CanonicalJsonAssert
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!current.TryGetProperty(part, out var next))
|
||||
// Try exact match first
|
||||
if (current.TryGetProperty(part, out var next))
|
||||
{
|
||||
current = next;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Try case-insensitive match (canonical JSON may use different casing)
|
||||
JsonElement? found = null;
|
||||
foreach (var prop in current.EnumerateObject())
|
||||
{
|
||||
if (string.Equals(prop.Name, part, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
found = prop.Value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (found is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
current = next;
|
||||
current = found.Value;
|
||||
}
|
||||
|
||||
return current;
|
||||
|
||||
@@ -63,14 +63,14 @@ public class IntegrationPluginTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GetChecks_ReturnsElevenChecks()
|
||||
public void GetChecks_ReturnsSixteenChecks()
|
||||
{
|
||||
var plugin = new IntegrationPlugin();
|
||||
var context = CreateTestContext();
|
||||
|
||||
var checks = plugin.GetChecks(context);
|
||||
|
||||
Assert.Equal(11, checks.Count);
|
||||
Assert.Equal(16, checks.Count);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using FluentAssertions;
|
||||
using StellaOps.TestKit.Environment;
|
||||
using Xunit;
|
||||
using TestKitTestResult = StellaOps.TestKit.Environment.TestResult;
|
||||
|
||||
namespace StellaOps.TestKit.Tests;
|
||||
|
||||
@@ -129,7 +130,7 @@ public sealed class EnvironmentSkewTests
|
||||
test: () =>
|
||||
{
|
||||
executedProfiles.Add("executed");
|
||||
return Task.FromResult(new TestResult { Value = 1.0, DurationMs = 10 });
|
||||
return Task.FromResult(new TestKitTestResult { Value = 1.0, DurationMs = 10 });
|
||||
},
|
||||
profiles: [EnvironmentProfile.Standard, EnvironmentProfile.HighLatency]);
|
||||
|
||||
@@ -150,7 +151,7 @@ public sealed class EnvironmentSkewTests
|
||||
test: () =>
|
||||
{
|
||||
executionCount++;
|
||||
return Task.FromResult(new TestResult { Value = executionCount, DurationMs = 10 });
|
||||
return Task.FromResult(new TestKitTestResult { Value = executionCount, DurationMs = 10 });
|
||||
},
|
||||
profile: EnvironmentProfile.Standard,
|
||||
iterations: 5);
|
||||
@@ -170,7 +171,7 @@ public sealed class EnvironmentSkewTests
|
||||
|
||||
// Act
|
||||
var result = await runner.RunWithProfile(
|
||||
test: () => Task.FromResult(new TestResult
|
||||
test: () => Task.FromResult(new TestKitTestResult
|
||||
{
|
||||
Value = values[index++],
|
||||
DurationMs = 100
|
||||
@@ -198,7 +199,7 @@ public sealed class EnvironmentSkewTests
|
||||
{
|
||||
throw new InvalidOperationException("Test error");
|
||||
}
|
||||
return Task.FromResult(new TestResult { Value = 1.0, Success = true });
|
||||
return Task.FromResult(new TestKitTestResult { Value = 1.0, Success = true });
|
||||
},
|
||||
profile: EnvironmentProfile.Standard,
|
||||
iterations: 3);
|
||||
@@ -214,7 +215,7 @@ public sealed class EnvironmentSkewTests
|
||||
// Arrange
|
||||
var runner = new SkewTestRunner();
|
||||
var report = await runner.RunAcrossProfiles(
|
||||
test: () => Task.FromResult(new TestResult { Value = 100.0, DurationMs = 10 }),
|
||||
test: () => Task.FromResult(new TestKitTestResult { Value = 100.0, DurationMs = 10 }),
|
||||
profiles: [EnvironmentProfile.Standard, EnvironmentProfile.HighLatency]);
|
||||
|
||||
// Act & Assert
|
||||
@@ -230,7 +231,7 @@ public sealed class EnvironmentSkewTests
|
||||
var values = new Queue<double>([100.0, 100.0, 100.0, 200.0, 200.0, 200.0]); // 100% difference
|
||||
|
||||
var report = await runner.RunAcrossProfiles(
|
||||
test: () => Task.FromResult(new TestResult { Value = values.Dequeue(), DurationMs = 10 }),
|
||||
test: () => Task.FromResult(new TestKitTestResult { Value = values.Dequeue(), DurationMs = 10 }),
|
||||
profiles: [EnvironmentProfile.Standard, EnvironmentProfile.HighLatency]);
|
||||
|
||||
// Act & Assert
|
||||
@@ -244,7 +245,7 @@ public sealed class EnvironmentSkewTests
|
||||
// Arrange
|
||||
var runner = new SkewTestRunner();
|
||||
var report = await runner.RunAcrossProfiles(
|
||||
test: () => Task.FromResult(new TestResult { Value = 100.0, DurationMs = 10 }),
|
||||
test: () => Task.FromResult(new TestKitTestResult { Value = 100.0, DurationMs = 10 }),
|
||||
profiles: [EnvironmentProfile.Standard]);
|
||||
|
||||
// Act & Assert - should not throw for single profile
|
||||
@@ -262,7 +263,7 @@ public sealed class EnvironmentSkewTests
|
||||
// Arrange
|
||||
var runner = new SkewTestRunner();
|
||||
var report = await runner.RunAcrossProfiles(
|
||||
test: () => Task.FromResult(new TestResult { Value = 1.0 }),
|
||||
test: () => Task.FromResult(new TestKitTestResult { Value = 1.0 }),
|
||||
profiles: [EnvironmentProfile.Standard]);
|
||||
|
||||
// Act
|
||||
@@ -280,7 +281,7 @@ public sealed class EnvironmentSkewTests
|
||||
// Arrange
|
||||
var runner = new SkewTestRunner();
|
||||
var report = await runner.RunAcrossProfiles(
|
||||
test: () => Task.FromResult(new TestResult { Value = 1.0 }),
|
||||
test: () => Task.FromResult(new TestKitTestResult { Value = 1.0 }),
|
||||
profiles: [EnvironmentProfile.Standard]);
|
||||
|
||||
// Act
|
||||
@@ -300,7 +301,7 @@ public sealed class EnvironmentSkewTests
|
||||
public void TestResult_Defaults_AreCorrect()
|
||||
{
|
||||
// Arrange & Act
|
||||
var result = new TestResult();
|
||||
var result = new TestKitTestResult();
|
||||
|
||||
// Assert
|
||||
result.Success.Should().BeTrue();
|
||||
|
||||
@@ -126,8 +126,9 @@ public sealed class LongevityTests
|
||||
// Act
|
||||
var growthRate = metrics.MemoryGrowthRate;
|
||||
|
||||
// Assert - just verify it's calculated
|
||||
growthRate.Should().BeOfType<double>();
|
||||
// Assert - just verify it's calculated and is a valid value
|
||||
double.IsNaN(growthRate).Should().BeFalse();
|
||||
double.IsInfinity(growthRate).Should().BeFalse();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
Reference in New Issue
Block a user