Add local publication attempt discovery
This commit is contained in:
@@ -38,3 +38,21 @@ func TestRecoveryFacadeErrorUnwrapsCancellation(t *testing.T) {
|
||||
t.Fatalf("error=%v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestListPublicationAttemptsReadsExplicitExternalStore(t *testing.T) {
|
||||
directory := t.TempDir()
|
||||
good := filepath.Join(directory, "attempt-a.json")
|
||||
if err := os.WriteFile(good, []byte(`{"format_version":1,"evidence":{"tag":"v1.2.3"}}`), 0600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := os.WriteFile(filepath.Join(directory, "attempt-b.json"), []byte("{"), 0600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
listed, err := releasekit.ListPublicationAttempts(context.Background(), releasekit.PublicationAttemptsRequest{RecordDir: directory})
|
||||
if err != nil || listed.RecordDir != directory || len(listed.Attempts) != 1 || len(listed.Diagnostics) != 1 {
|
||||
t.Fatalf("listing=%#v error=%v", listed, err)
|
||||
}
|
||||
if listed.Attempts[0].RecordPath != good || listed.Attempts[0].Evidence.Tag != "v1.2.3" || listed.Diagnostics[0].Kind != "record_format" {
|
||||
t.Fatalf("listing=%#v", listed)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user