blocked 4

This commit is contained in:
StellaOps Bot
2025-11-23 17:18:33 +02:00
parent c3ce1ebc25
commit fc99092dec
16 changed files with 88 additions and 25 deletions

View File

@@ -4,6 +4,7 @@ ROOT=$(cd "$(dirname "$0")/../../.." && pwd)
OUT="$ROOT/out/mirror/thin"
STAGE="$OUT/stage-v1"
CREATED="2025-11-23T00:00:00Z"
export STAGE CREATED
mkdir -p "$STAGE/layers" "$STAGE/indexes"
# 1) Seed deterministic content
@@ -12,6 +13,23 @@ cat > "$STAGE/layers/observations.ndjson" <<'DATA'
{"id":"obs-002","purl":"pkg:npm/lodash@4.17.21","advisory":"CVE-2024-9999","severity":"high","source":"vendor-b","timestamp":"2025-10-15T00:00:00Z"}
DATA
cat > "$STAGE/layers/time-anchor.json" <<'DATA'
{
"authority": "stellaops-airgap-test",
"generatedAt": "2025-11-01T00:00:00Z",
"anchors": [
{
"type": "roughtime",
"version": "1",
"publicKey": "base64:TEST_KEY_001",
"signature": "base64:TEST_SIG_001",
"timestamp": "2025-11-01T00:00:00Z",
"maxDistanceSeconds": 5
}
]
}
DATA
cat > "$STAGE/indexes/observations.index" <<'DATA'
obs-001 layers/observations.ndjson:1
obs-002 layers/observations.ndjson:2

View File

@@ -17,6 +17,7 @@ public class ProjectionEndpointTests : IClassFixture<WebApplicationFactory<Progr
public ProjectionEndpointTests(WebApplicationFactory<Program> factory)
{
var contentRoot = ResolveContentRoot();
_factory = factory.WithWebHostBuilder(builder =>
{
var fixturePath = GetProjectionFixturePath();
@@ -39,6 +40,8 @@ public class ProjectionEndpointTests : IClassFixture<WebApplicationFactory<Progr
services.RemoveAll<IComponentLookupRepository>();
services.AddSingleton<IComponentLookupRepository, InMemoryComponentLookupRepository>();
});
builder.UseSetting(WebHostDefaults.ContentRootKey, contentRoot);
});
}
@@ -77,10 +80,24 @@ public class ProjectionEndpointTests : IClassFixture<WebApplicationFactory<Progr
private static string GetProjectionFixturePath()
{
// Resolve docs/modules/sbomservice/fixtures/lnm-v1/projections.json relative to test bin directory.
var baseDir = AppContext.BaseDirectory;
var candidate = Path.GetFullPath(Path.Combine(
baseDir,
"../../../../../../docs/modules/sbomservice/fixtures/lnm-v1/projections.json"));
return candidate;
var baseDir = ResolveContentRoot();
return Path.Combine(baseDir, "docs", "modules", "sbomservice", "fixtures", "lnm-v1", "projections.json");
}
private static string ResolveContentRoot()
{
// Walk up from bin folder to repo root (containing docs/).
var dir = AppContext.BaseDirectory;
for (var i = 0; i < 6; i++)
{
var candidate = Path.GetFullPath(Path.Combine(dir, ".."));
if (Directory.Exists(Path.Combine(candidate, "docs")) &&
Directory.Exists(Path.Combine(candidate, "src")))
{
return candidate;
}
dir = candidate;
}
return AppContext.BaseDirectory;
}
}