Refactor code structure and optimize performance across multiple modules
This commit is contained in:
@@ -32,7 +32,8 @@ public sealed class RateLimitingTests
|
||||
config["scanner:rateLimiting:proofBundleWindow"] = TimeSpan.FromSeconds(windowSeconds).ToString();
|
||||
});
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task ManifestEndpoint_IncludesRateLimitHeaders()
|
||||
{
|
||||
// Arrange
|
||||
@@ -50,7 +51,8 @@ public sealed class RateLimitingTests
|
||||
response.StatusCode == HttpStatusCode.TooManyRequests);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task ProofBundleEndpoint_IncludesRateLimitHeaders()
|
||||
{
|
||||
// Arrange
|
||||
@@ -67,7 +69,8 @@ public sealed class RateLimitingTests
|
||||
response.StatusCode == HttpStatusCode.TooManyRequests);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task ExcessiveRequests_Returns429()
|
||||
{
|
||||
// Arrange - Create factory with very low rate limit for testing
|
||||
@@ -93,7 +96,8 @@ public sealed class RateLimitingTests
|
||||
"Expected either rate limiting (429) or successful responses (200/404)");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task RateLimited_Returns429WithRetryAfter()
|
||||
{
|
||||
// Arrange
|
||||
@@ -115,7 +119,8 @@ public sealed class RateLimitingTests
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task HealthEndpoint_NotRateLimited()
|
||||
{
|
||||
// Arrange
|
||||
@@ -134,7 +139,8 @@ public sealed class RateLimitingTests
|
||||
Assert.All(responses, r => Assert.NotEqual(HttpStatusCode.TooManyRequests, r.StatusCode));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task RateLimitedResponse_HasProblemDetails()
|
||||
{
|
||||
// Arrange
|
||||
@@ -157,7 +163,8 @@ public sealed class RateLimitingTests
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task DifferentTenants_HaveSeparateRateLimits()
|
||||
{
|
||||
// This test verifies tenant isolation in rate limiting
|
||||
@@ -166,6 +173,7 @@ public sealed class RateLimitingTests
|
||||
// Arrange
|
||||
await using var factory = CreateFactory();
|
||||
using var client = factory.CreateClient();
|
||||
using StellaOps.TestKit;
|
||||
var scanId = Guid.NewGuid();
|
||||
|
||||
// Act - Requests from "anonymous" tenant
|
||||
|
||||
Reference in New Issue
Block a user