FP and None stay readable for build-agent's path until R4g; the gate's status comment and the checks verb now name mesh/check as what a main requires.
33 lines
1.2 KiB
Go
33 lines
1.2 KiB
Go
package delivery
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
// From R4e a modules value needs no old form (novox/hq ADR 0453 clause 6; issue 1851): a value with only the new
|
|
// fingerprint, or only the reason it has none, is written and read; an old value with fp or none still reads; a value
|
|
// with no fingerprint of either form and no reason is still refused.
|
|
func TestAModulesValueNeedsNoOldForm(t *testing.T) {
|
|
fp2 := SourcePrefix2 + strings.Repeat("a", 64)
|
|
for _, m := range []Module{
|
|
{FP2: fp2, Repository: "a/b", Commit: "c"},
|
|
{None2: "no lock", Repository: "a/b", Commit: "c"},
|
|
} {
|
|
data, err := EncodeModule(m)
|
|
if err != nil {
|
|
t.Fatalf("%+v was refused: %v", m, err)
|
|
}
|
|
back, err := DecodeModule(data)
|
|
if err != nil || back.FP2 != m.FP2 || back.None2 != m.None2 || back.FP != "" || back.None != "" {
|
|
t.Fatalf("decoded %+v, %v", back, err)
|
|
}
|
|
}
|
|
if _, err := DecodeModule([]byte(`{"v":1,"fp":"src1:x","repository":"a/b","commit":"c"}`)); err != nil {
|
|
t.Fatalf("an old value no longer reads: %v", err)
|
|
}
|
|
if _, err := EncodeModule(Module{Repository: "a/b", Commit: "c"}); err == nil {
|
|
t.Fatal("a value with no fingerprint and no reason was accepted")
|
|
}
|
|
}
|