publishconformance: a version held under another digest is refused though reserved with no digest yet (A-490j, A-490a)
Builds: design 47 G A-490j, A-490a Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
This commit is contained in:
@@ -92,22 +92,27 @@ type ReservedBed struct {
|
||||
// Reserve makes the builder hold the case's name at its version as reserved, its artifact as r says. A case that never calls
|
||||
// it has the builder hold no reservation.
|
||||
Reserve func(r Reservation)
|
||||
// Hold makes the holder hold the case's name at its version under another digest than the file's, as the first publish of it
|
||||
// stored (A-490, A-490j): a second publish with another digest is refused as the holder holds the first.
|
||||
Hold func()
|
||||
// PublishWhole sends the one-part publish of the case's file (its own digest) and reports what the holder did.
|
||||
PublishWhole func() Outcome
|
||||
}
|
||||
|
||||
// RunReserved runs the cases of a publish made while the build runs, over beds made by fresh (design 47 G A-490j): the builder
|
||||
// records a build's digests only when it ends, so a reserved artifact naming no digest yet takes the publish.
|
||||
// records a build's digests only when it ends, so a reserved artifact naming no digest yet takes the publish while the holder's own refusal of a version it holds under another digest stands. Package holders only: an image holder is no case of it (A-490j).
|
||||
func RunReserved(t *testing.T, fresh func(t *testing.T) ReservedBed) {
|
||||
t.Helper()
|
||||
for _, c := range []struct {
|
||||
name string
|
||||
reserve Reservation // 0: nothing reserved
|
||||
held bool // the holder holds the version under another digest already
|
||||
ok bool
|
||||
words string
|
||||
}{
|
||||
{name: "reserved, no digest yet: published", reserve: NoDigestYet, ok: true},
|
||||
{name: "reserved with the digest: published", reserve: SameDigest, ok: true},
|
||||
{name: "reserved with no digest yet, the version held under another digest: refused, nothing published", reserve: NoDigestYet, held: true, words: "is published with"},
|
||||
{name: "reserved for another digest: refused, naming the reservation", reserve: OtherDigest, words: "did not reserve"},
|
||||
{name: "nothing reserved: refused", words: "did not"},
|
||||
} {
|
||||
@@ -116,7 +121,17 @@ func RunReserved(t *testing.T, fresh func(t *testing.T) ReservedBed) {
|
||||
if c.reserve != 0 {
|
||||
b.Reserve(c.reserve)
|
||||
}
|
||||
if c.held {
|
||||
b.Hold()
|
||||
}
|
||||
o := b.PublishWhole()
|
||||
if c.held {
|
||||
// Refused whether it ends with an error or only with the event refused, and never said published.
|
||||
if o.Event != "refused" || !strings.Contains(o.Reason, c.words) {
|
||||
t.Fatalf("answered %+v; want refused with %q in its reason, and nothing published", o, c.words)
|
||||
}
|
||||
return
|
||||
}
|
||||
if c.ok {
|
||||
if o.Err != nil || o.Event != "published" {
|
||||
t.Fatalf("answered %+v; want no error and published said", o)
|
||||
|
||||
Reference in New Issue
Block a user