Revert: the registry seats still hold versions; the engine asks it again
The resolved definitions of oci-artifact-registry and container-image-registry
on mesh-delivery feat/47-H2 (42788501) both still hold versions, from the
registry part they include; D4a (ac99946f) only gave list a module filter and
a cursor. The validator's refusal came from a request that did not resolve
the includes, so nothing the definitions hold is changed: this reverts
845de026.
Builds: design 47 H2 §813 (7); H-A-415 (2) and its addendum
This commit is contained in:
@@ -36,13 +36,11 @@ func aWantNamingItsVersionIsResolvedThroughTheRegistrySeats(t *testing.T) {
|
||||
}}}
|
||||
entry := meshcatalog.CatalogEntry{Module: "mail", Fp: fp, Manifest: manifest, Artifacts: []meshcatalog.Artifact{
|
||||
{Ref: "mail:server", Kind: "upstream"}, {Ref: "mail:files", Kind: "archive"}, {Ref: "mail:web", Kind: "image"}}}
|
||||
// The seats hold mail/files and mail/web, each version a tag of its manifest; an archive's blob is what it is fetched
|
||||
// by (design 47 H2 §813 (7), H-A-415 (2): the version is read through list).
|
||||
// The seats hold mail/files and mail/web; versions newest first.
|
||||
held := map[string]string{
|
||||
"oci-artifact-registry.mail/files": `{"name":"mail/files","manifests":[{"digest":"` + d("8") + `","artifact":"` + d("2") +
|
||||
`","tags":["1.3.0"]},{"digest":"` + d("7") + `","artifact":"` + d("1") + `","tags":["1.2.3"]}]}`,
|
||||
"container-image-registry.mail/web": `{"name":"mail/web","manifests":[{"digest":"` + d("3") + `","tags":["1.2.3"]}]}`,
|
||||
"container-image-registry.mail/other": `{"name":"mail/other","manifests":[]}`,
|
||||
"oci-artifact-registry.mail/files": `{"name":"mail/files","versions":[{"name":"mail/files","kind":"archive","digest":"` + d("2") + `","version":"1.3.0"},{"name":"mail/files","kind":"archive","digest":"` + d("1") + `","version":"1.2.3"}]}`,
|
||||
"container-image-registry.mail/web": `{"name":"mail/web","versions":[{"name":"mail/web","kind":"image","digest":"` + d("3") + `","version":"1.2.3"}]}`,
|
||||
"container-image-registry.mail/other": `{"name":"mail/other","versions":[]}`,
|
||||
}
|
||||
for name, row := range map[string]struct {
|
||||
want meshwants.WantsByWantNodeModuleValue
|
||||
@@ -64,25 +62,17 @@ func aWantNamingItsVersionIsResolvedThroughTheRegistrySeats(t *testing.T) {
|
||||
calls := 0
|
||||
env.Registry = EntryCall(func(_ context.Context, seat, verb string, args any) (json.RawMessage, error) {
|
||||
calls++
|
||||
in := args.(map[string]string)
|
||||
// oci-artifact-registry is asked by the module, container-image-registry by the repository's name.
|
||||
if verb != "list" || (seat == "oci-artifact-registry") != (in["module"] == "mail" && in["name"] == "") {
|
||||
t.Errorf("%s: asked %s.%s %v", name, seat, verb, in)
|
||||
if verb != "versions" {
|
||||
t.Errorf("%s: asked %s.%s", name, seat, verb)
|
||||
}
|
||||
if seat == row.down {
|
||||
return nil, errors.New("no responders")
|
||||
}
|
||||
var repos []string
|
||||
for key, repo := range held {
|
||||
r, ok := strings.CutPrefix(key, seat+".")
|
||||
if ok && (r == in["name"] || (in["module"] != "" && strings.HasPrefix(r, in["module"]+"/"))) {
|
||||
repos = append(repos, repo)
|
||||
}
|
||||
}
|
||||
if len(repos) == 0 {
|
||||
answer, ok := held[seat+"."+args.(map[string]string)["name"]]
|
||||
if !ok {
|
||||
return nil, errors.New("not held")
|
||||
}
|
||||
return json.RawMessage(`{"repositories":[` + strings.Join(repos, ",") + `]}`), nil
|
||||
return json.RawMessage(answer), nil
|
||||
})
|
||||
env.Entry = EntryCall(func(context.Context, string, string, any) (json.RawMessage, error) {
|
||||
return nil, errors.New("not asked")
|
||||
@@ -321,8 +311,7 @@ func aResolutionWhoseFetchFailedIsForgotten(t *testing.T) {
|
||||
calls := 0
|
||||
env.Registry = EntryCall(func(context.Context, string, string, any) (json.RawMessage, error) {
|
||||
calls++
|
||||
return json.RawMessage(`{"repositories":[{"name":"mail/files","manifests":[{"digest":"sha256:` + strings.Repeat("e", 64) +
|
||||
`","artifact":"` + row.answer + `","tags":["1.2.3"]}]}]}`), nil
|
||||
return json.RawMessage(`{"versions":[{"digest":"` + row.answer + `","version":"1.2.3"}]}`), nil
|
||||
})
|
||||
env.Fetch = func(context.Context, string) ([]byte, error) { return body, row.fetch }
|
||||
env.Entry = EntryCall(func(context.Context, string, string, any) (json.RawMessage, error) {
|
||||
|
||||
Reference in New Issue
Block a user