Let a key wait queued for a package version, so it is not failed before the package is published (issue 1587, S15, ADR 0500 §6)
waits names <name>@<version> on a queued key only; an older reader reads it as queued.
This commit is contained in:
@@ -96,3 +96,23 @@ func TestOnlyAPushFailureIsBuiltAgainBeforeTheFingerprintChanges(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// A key whose module's lock names a version of the group's package not yet published waits, queued, saying which
|
||||
// (ADR 0500 clause 6): an older reader reads it as queued, and only a queued key waits.
|
||||
func TestAKeyWaitsQueuedForAPackageVersion(t *testing.T) {
|
||||
b := BuilderBuild{State: BuildQueued, Manifest: digestOf('4'), Waits: "@novox/mesh-sdk@0.1.15"}
|
||||
data, err := EncodeBuilderBuild(b)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
back, err := DecodeBuilderBuild(data)
|
||||
if err != nil || back.Waits != b.Waits || back.State != BuildQueued {
|
||||
t.Fatalf("decoded %+v, %v", back, err)
|
||||
}
|
||||
building := BuilderBuild{State: BuildBuilding, By: "x", Waits: "@novox/mesh-sdk@0.1.15"}
|
||||
if _, err := EncodeBuilderBuild(building); err == nil {
|
||||
t.Fatal("a building key that waits was accepted")
|
||||
}
|
||||
if _, err := EncodeBuilderBuild(BuilderBuild{State: BuildQueued, Waits: "mesh-sdk"}); err == nil {
|
||||
t.Fatal("a wait naming no version was accepted")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user