Document and verify published product imports

This commit is contained in:
2026-12-02 16:49:46 +00:00
parent 56483f9064
commit e5d91cb19b
32 changed files with 330 additions and 265 deletions

View File

@@ -24,12 +24,22 @@ func TestInventoryImportInstallsValidatedBaselineAndRetriesSave(t *testing.T) {
if err != nil {
t.Fatal(err)
}
paths := artifacts.NewLocalStore(cfg.Pipeline.Workspace.Root).SessionPathsFor(cfg.Session.Campaign, cfg.Session.SessionID)
if err := os.MkdirAll(paths.Root, 0755); err != nil {
t.Fatal(err)
}
if err := writeRestoreMarker(paths); err != nil {
t.Fatal(err)
}
if _, err := executeRestorePlan(ctx, cfg, current, plan, nil, fake); err != nil {
t.Fatal(err)
}
if err := installInventoryBaseline(ctx, cfg, plan, &failingRestoreManifestStore{}); err == nil {
t.Fatal("expected final manifest save to fail")
}
if err := requireCompleteRestore(paths); err == nil {
t.Fatal("failed save did not retain the incomplete-restore marker")
}
path := artifacts.SessionManifestPathForCampaign(cfg.Pipeline.Workspace.Root, cfg.Session.Campaign, cfg.Session.SessionID)
if _, err := os.Stat(path); !os.IsNotExist(err) {
t.Fatalf("failed save installed manifest: %v", err)
@@ -41,11 +51,13 @@ func TestInventoryImportInstallsValidatedBaselineAndRetriesSave(t *testing.T) {
if err := installInventoryBaseline(ctx, cfg, retry, &manifest.LocalStore{}); err != nil {
t.Fatal(err)
}
if err := clearRestoreMarker(paths); err != nil {
t.Fatal(err)
}
loaded, err := (&manifest.LocalStore{}).Load(ctx, path)
if err != nil {
t.Fatal(err)
}
paths := artifacts.NewLocalStore(cfg.Pipeline.Workspace.Root).SessionPathsFor(cfg.Session.Campaign, cfg.Session.SessionID)
if !artifacts.SuppliedTranscriptCoverage(paths, loaded.SuppliedProducts)["trim"] {
t.Fatalf("trimmed transcript unavailable after retry: %#v", loaded.SuppliedProducts)
}