The assigner took a tier progress for `pipeline.<branch>.<revision>` only (two dots), so the progress of a pipeline started again at the head, `<branch>.<revision>.again.<n>`, was never moved and read as an empty end: its later tiers were never wanted. One parse of the runner's seat's key forms (mesh-delivery-sdk pipelinekey, over the contract's key parsers) now reads a pipeline's key for the assigner's tier progress and the runner's mover keys; a pipeline-ended whose key is of no form is refused loudly and nothing of it is kept. Builds: design 47 H2 H-A-485
44 lines
1.7 KiB
Go
44 lines
1.7 KiB
Go
package pipelinekey
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
// H-A-485: every key form of a pipeline the seat mesh-pipeline-runner defines is read, the again form and the unfinished form as
|
|
// a take-in's, its branch and module unescaped; a key of no form, or whose parts do not read, is refused naming why.
|
|
func TestEveryPipelineKeyFormIsReadAndAnyOtherRefused(t *testing.T) {
|
|
for _, c := range []struct {
|
|
key string
|
|
want Key
|
|
why string
|
|
}{
|
|
{key: "main.265", want: Key{Form: FormRevision, Branch: "main", Revision: 265}},
|
|
{key: "main.265.again.2", want: Key{Form: FormAgain, Branch: "main", Revision: 265, N: 2}},
|
|
{key: "feat=2fx.12.unfinished.mesh-tools", want: Key{Form: FormUnfinished, Branch: "feat/x", Revision: 12, Module: "mesh-tools"}},
|
|
{key: "main.run.r7", want: Key{Form: FormRun, Branch: "main", Run: "r7"}},
|
|
{key: "main.40.published.lib.0=2e1=2e2", want: Key{Form: FormPublished, Branch: "main", Revision: 40, Package: "lib", Version: "0=2e1=2e2"}},
|
|
{key: "main", why: "no form"},
|
|
{key: "main.265.again", why: "no form"},
|
|
{key: "main.265.later.2", why: "no form"},
|
|
{key: "main.265.again.0", why: "its n"},
|
|
{key: "main.265.again.x", why: "its n"},
|
|
{key: "main.r1", why: "its revision"},
|
|
{key: "main.0", why: "its revision"},
|
|
{key: "ma=zz.5", why: "its branch"},
|
|
{key: "main.5.unfinished.=zz", why: "its module"},
|
|
{key: "main.5.6.7.8.9", why: "no form"},
|
|
} {
|
|
got, err := Parse(c.key)
|
|
if c.why != "" {
|
|
if err == nil || !strings.Contains(err.Error(), c.why) || !strings.Contains(err.Error(), FormAgain) {
|
|
t.Errorf("%s: read %+v (%v); want it refused, %s, naming the forms", c.key, got, err, c.why)
|
|
}
|
|
continue
|
|
}
|
|
if err != nil || got != c.want {
|
|
t.Errorf("%s: read %+v (%v); want %+v", c.key, got, err, c.want)
|
|
}
|
|
}
|
|
}
|