feat: Add MongoIdempotencyStoreOptions for MongoDB configuration
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
feat: Implement BsonJsonConverter for converting BsonDocument and BsonArray to JSON fix: Update project file to include MongoDB.Bson package test: Add GraphOverlayExporterTests to validate NDJSON export functionality refactor: Refactor Program.cs in Attestation Tool for improved argument parsing and error handling docs: Update README for stella-forensic-verify with usage instructions and exit codes feat: Enhance HmacVerifier with clock skew and not-after checks feat: Add MerkleRootVerifier and ChainOfCustodyVerifier for additional verification methods fix: Update DenoRuntimeShim to correctly handle file paths feat: Introduce ComposerAutoloadData and related parsing in ComposerLockReader test: Add tests for Deno runtime execution and verification test: Enhance PHP package tests to include autoload data verification test: Add unit tests for HmacVerifier and verification logic
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using StellaOps.Graph.Indexer.Analytics;
|
||||
using StellaOps.Graph.Indexer.Ingestion.Sbom;
|
||||
|
||||
namespace StellaOps.Graph.Indexer.Tests;
|
||||
|
||||
public sealed class GraphOverlayExporterTests
|
||||
{
|
||||
[Fact]
|
||||
public async Task ExportAsync_WritesDeterministicNdjson()
|
||||
{
|
||||
var snapshot = GraphAnalyticsTestData.CreateLinearSnapshot();
|
||||
var engine = new GraphAnalyticsEngine(new GraphAnalyticsOptions { MaxPropagationIterations = 3 });
|
||||
var result = engine.Compute(snapshot);
|
||||
|
||||
var tempDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString("N"));
|
||||
Directory.CreateDirectory(tempDir);
|
||||
|
||||
try
|
||||
{
|
||||
var writer = new FileSystemSnapshotFileWriter(tempDir);
|
||||
var exporter = new GraphOverlayExporter();
|
||||
|
||||
await exporter.ExportAsync(snapshot, result, writer, CancellationToken.None);
|
||||
|
||||
var clustersPath = Path.Combine(tempDir, "overlays", "clusters.ndjson");
|
||||
var centralityPath = Path.Combine(tempDir, "overlays", "centrality.ndjson");
|
||||
|
||||
var clusterLines = await File.ReadAllLinesAsync(clustersPath);
|
||||
var centralityLines = await File.ReadAllLinesAsync(centralityPath);
|
||||
|
||||
Assert.Equal(result.Clusters.Length, clusterLines.Length);
|
||||
Assert.Equal(result.CentralityScores.Length, centralityLines.Length);
|
||||
|
||||
// Ensure deterministic ordering by node id
|
||||
var clusterNodeIds = clusterLines.Select(line => System.Text.Json.JsonDocument.Parse(line).RootElement.GetProperty("node_id").GetString()).ToArray();
|
||||
var sorted = clusterNodeIds.OrderBy(id => id, StringComparer.Ordinal).ToArray();
|
||||
Assert.Equal(sorted, clusterNodeIds);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (Directory.Exists(tempDir))
|
||||
{
|
||||
Directory.Delete(tempDir, recursive: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user