Add call graph fixtures for various languages and scenarios
Some checks failed
AOC Guard CI / aoc-guard (push) Has been cancelled
AOC Guard CI / aoc-verify (push) Has been cancelled
Docs CI / lint-and-preview (push) Has been cancelled
Export Center CI / export-ci (push) Has been cancelled
Findings Ledger CI / build-test (push) Has been cancelled
Findings Ledger CI / migration-validation (push) Has been cancelled
Findings Ledger CI / generate-manifest (push) Has been cancelled
Lighthouse CI / Lighthouse Audit (push) Has been cancelled
Lighthouse CI / Axe Accessibility Audit (push) Has been cancelled
Policy Lint & Smoke / policy-lint (push) Has been cancelled
Reachability Corpus Validation / validate-corpus (push) Has been cancelled
Reachability Corpus Validation / validate-ground-truths (push) Has been cancelled
Scanner Analyzers / Discover Analyzers (push) Has been cancelled
Scanner Analyzers / Validate Test Fixtures (push) Has been cancelled
Signals CI & Image / signals-ci (push) Has been cancelled
Signals Reachability Scoring & Events / reachability-smoke (push) Has been cancelled
Reachability Corpus Validation / determinism-check (push) Has been cancelled
Scanner Analyzers / Build Analyzers (push) Has been cancelled
Scanner Analyzers / Test Language Analyzers (push) Has been cancelled
Scanner Analyzers / Verify Deterministic Output (push) Has been cancelled
Signals Reachability Scoring & Events / sign-and-upload (push) Has been cancelled
Some checks failed
AOC Guard CI / aoc-guard (push) Has been cancelled
AOC Guard CI / aoc-verify (push) Has been cancelled
Docs CI / lint-and-preview (push) Has been cancelled
Export Center CI / export-ci (push) Has been cancelled
Findings Ledger CI / build-test (push) Has been cancelled
Findings Ledger CI / migration-validation (push) Has been cancelled
Findings Ledger CI / generate-manifest (push) Has been cancelled
Lighthouse CI / Lighthouse Audit (push) Has been cancelled
Lighthouse CI / Axe Accessibility Audit (push) Has been cancelled
Policy Lint & Smoke / policy-lint (push) Has been cancelled
Reachability Corpus Validation / validate-corpus (push) Has been cancelled
Reachability Corpus Validation / validate-ground-truths (push) Has been cancelled
Scanner Analyzers / Discover Analyzers (push) Has been cancelled
Scanner Analyzers / Validate Test Fixtures (push) Has been cancelled
Signals CI & Image / signals-ci (push) Has been cancelled
Signals Reachability Scoring & Events / reachability-smoke (push) Has been cancelled
Reachability Corpus Validation / determinism-check (push) Has been cancelled
Scanner Analyzers / Build Analyzers (push) Has been cancelled
Scanner Analyzers / Test Language Analyzers (push) Has been cancelled
Scanner Analyzers / Verify Deterministic Output (push) Has been cancelled
Signals Reachability Scoring & Events / sign-and-upload (push) Has been cancelled
- Introduced `all-edge-reasons.json` to test edge resolution reasons in .NET. - Added `all-visibility-levels.json` to validate method visibility levels in .NET. - Created `dotnet-aspnetcore-minimal.json` for a minimal ASP.NET Core application. - Included `go-gin-api.json` for a Go Gin API application structure. - Added `java-spring-boot.json` for the Spring PetClinic application in Java. - Introduced `legacy-no-schema.json` for legacy application structure without schema. - Created `node-express-api.json` for an Express.js API application structure.
This commit is contained in:
@@ -0,0 +1,127 @@
|
||||
using FluentAssertions;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using Microsoft.Extensions.Options;
|
||||
using StellaOps.Authority.Storage.Postgres.Models;
|
||||
using StellaOps.Authority.Storage.Postgres.Repositories;
|
||||
using Xunit;
|
||||
|
||||
namespace StellaOps.Authority.Storage.Postgres.Tests;
|
||||
|
||||
[Collection(AuthorityPostgresCollection.Name)]
|
||||
public sealed class OfflineKitAuditRepositoryTests : IAsyncLifetime
|
||||
{
|
||||
private readonly AuthorityPostgresFixture _fixture;
|
||||
private readonly OfflineKitAuditRepository _repository;
|
||||
|
||||
public OfflineKitAuditRepositoryTests(AuthorityPostgresFixture fixture)
|
||||
{
|
||||
_fixture = fixture;
|
||||
|
||||
var options = fixture.Fixture.CreateOptions();
|
||||
options.SchemaName = fixture.SchemaName;
|
||||
var dataSource = new AuthorityDataSource(Options.Create(options), NullLogger<AuthorityDataSource>.Instance);
|
||||
_repository = new OfflineKitAuditRepository(dataSource, NullLogger<OfflineKitAuditRepository>.Instance);
|
||||
}
|
||||
|
||||
public Task InitializeAsync() => _fixture.TruncateAllTablesAsync();
|
||||
public Task DisposeAsync() => Task.CompletedTask;
|
||||
|
||||
[Fact]
|
||||
public async Task Insert_ThenList_ReturnsRecord()
|
||||
{
|
||||
var tenantId = Guid.NewGuid().ToString("N");
|
||||
var entity = new OfflineKitAuditEntity
|
||||
{
|
||||
EventId = Guid.NewGuid(),
|
||||
TenantId = tenantId,
|
||||
EventType = "IMPORT_VALIDATED",
|
||||
Timestamp = DateTimeOffset.UtcNow,
|
||||
Actor = "system",
|
||||
Details = """{"kitFilename":"bundle-2025-12-14.tar.zst"}""",
|
||||
Result = "success"
|
||||
};
|
||||
|
||||
await _repository.InsertAsync(entity);
|
||||
var listed = await _repository.ListAsync(tenantId, limit: 10);
|
||||
|
||||
listed.Should().ContainSingle();
|
||||
listed[0].EventId.Should().Be(entity.EventId);
|
||||
listed[0].EventType.Should().Be(entity.EventType);
|
||||
listed[0].Actor.Should().Be(entity.Actor);
|
||||
listed[0].Result.Should().Be(entity.Result);
|
||||
listed[0].Details.Should().Contain("kitFilename");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task List_WithFilters_ReturnsMatchingRows()
|
||||
{
|
||||
var tenantId = Guid.NewGuid().ToString("N");
|
||||
|
||||
await _repository.InsertAsync(new OfflineKitAuditEntity
|
||||
{
|
||||
EventId = Guid.NewGuid(),
|
||||
TenantId = tenantId,
|
||||
EventType = "IMPORT_FAILED_DSSE",
|
||||
Timestamp = DateTimeOffset.UtcNow.AddMinutes(-2),
|
||||
Actor = "system",
|
||||
Details = """{"reasonCode":"DSSE_VERIFY_FAIL"}""",
|
||||
Result = "failed"
|
||||
});
|
||||
|
||||
await _repository.InsertAsync(new OfflineKitAuditEntity
|
||||
{
|
||||
EventId = Guid.NewGuid(),
|
||||
TenantId = tenantId,
|
||||
EventType = "IMPORT_VALIDATED",
|
||||
Timestamp = DateTimeOffset.UtcNow.AddMinutes(-1),
|
||||
Actor = "system",
|
||||
Details = """{"status":"ok"}""",
|
||||
Result = "success"
|
||||
});
|
||||
|
||||
var failed = await _repository.ListAsync(tenantId, result: "failed", limit: 10);
|
||||
failed.Should().ContainSingle();
|
||||
failed[0].Result.Should().Be("failed");
|
||||
|
||||
var validated = await _repository.ListAsync(tenantId, eventType: "IMPORT_VALIDATED", limit: 10);
|
||||
validated.Should().ContainSingle();
|
||||
validated[0].EventType.Should().Be("IMPORT_VALIDATED");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task List_IsTenantIsolated()
|
||||
{
|
||||
var tenantA = Guid.NewGuid().ToString("N");
|
||||
var tenantB = Guid.NewGuid().ToString("N");
|
||||
|
||||
await _repository.InsertAsync(new OfflineKitAuditEntity
|
||||
{
|
||||
EventId = Guid.NewGuid(),
|
||||
TenantId = tenantA,
|
||||
EventType = "IMPORT_VALIDATED",
|
||||
Timestamp = DateTimeOffset.UtcNow.AddMinutes(-1),
|
||||
Actor = "system",
|
||||
Details = """{"status":"ok"}""",
|
||||
Result = "success"
|
||||
});
|
||||
|
||||
await _repository.InsertAsync(new OfflineKitAuditEntity
|
||||
{
|
||||
EventId = Guid.NewGuid(),
|
||||
TenantId = tenantB,
|
||||
EventType = "IMPORT_VALIDATED",
|
||||
Timestamp = DateTimeOffset.UtcNow,
|
||||
Actor = "system",
|
||||
Details = """{"status":"ok"}""",
|
||||
Result = "success"
|
||||
});
|
||||
|
||||
var tenantAResults = await _repository.ListAsync(tenantA, limit: 10);
|
||||
tenantAResults.Should().ContainSingle();
|
||||
tenantAResults[0].TenantId.Should().Be(tenantA);
|
||||
|
||||
var tenantBResults = await _repository.ListAsync(tenantB, limit: 10);
|
||||
tenantBResults.Should().ContainSingle();
|
||||
tenantBResults[0].TenantId.Should().Be(tenantB);
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ using System.Collections.Concurrent;
|
||||
|
||||
namespace StellaOps.Authority.Storage.Postgres.Tests.TestDoubles;
|
||||
|
||||
internal sealed class InMemoryTokenRepository : ITokenRepository, ISecondaryTokenRepository
|
||||
internal sealed class InMemoryTokenRepository : ITokenRepository
|
||||
{
|
||||
private readonly ConcurrentDictionary<Guid, TokenEntity> _tokens = new();
|
||||
public bool FailWrites { get; set; }
|
||||
@@ -67,7 +67,7 @@ internal sealed class InMemoryTokenRepository : ITokenRepository, ISecondaryToke
|
||||
public IReadOnlyCollection<TokenEntity> Snapshot() => _tokens.Values.ToList();
|
||||
}
|
||||
|
||||
internal sealed class InMemoryRefreshTokenRepository : IRefreshTokenRepository, ISecondaryRefreshTokenRepository
|
||||
internal sealed class InMemoryRefreshTokenRepository : IRefreshTokenRepository
|
||||
{
|
||||
private readonly ConcurrentDictionary<Guid, RefreshTokenEntity> _tokens = new();
|
||||
public bool FailWrites { get; set; }
|
||||
@@ -130,7 +130,7 @@ internal sealed class InMemoryRefreshTokenRepository : IRefreshTokenRepository,
|
||||
public IReadOnlyCollection<RefreshTokenEntity> Snapshot() => _tokens.Values.ToList();
|
||||
}
|
||||
|
||||
internal sealed class InMemoryUserRepository : IUserRepository, ISecondaryUserRepository
|
||||
internal sealed class InMemoryUserRepository : IUserRepository
|
||||
{
|
||||
private readonly ConcurrentDictionary<Guid, UserEntity> _users = new();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user