H-A-150: hold the apply's forget on bytes not of the digest with a test
The apply's fetch tells the composer of bytes that are not of the declared digest (fetch_first.go), but no test held it: with that call disabled every test of internal/apply passed. TestAStoreThatStaysAwayCostsOneBoundedWait now has a store that serves other bytes to two modules from one source, and the composer is told exactly once, with the declared digest. Builds: design 47 H H-A-150
This commit is contained in:
@@ -313,4 +313,20 @@ func TestAStoreThatStaysAwayCostsOneBoundedWait(t *testing.T) {
|
|||||||
if time.Since(began) > time.Second || missing.fetches() != 1 {
|
if time.Since(began) > time.Second || missing.fetches() != 1 {
|
||||||
t.Fatalf("a store that answered no was asked %d times", missing.fetches())
|
t.Fatalf("a store that answered no was asked %d times", missing.fetches())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// H-A-150: a store that serves other bytes than the declared digest's answered, so the resolution is forgotten: told once
|
||||||
|
// with the declared digest, though two modules name the same source.
|
||||||
|
other := newPretendStore(t, []byte("the manifest, not the blob"))
|
||||||
|
told = nil
|
||||||
|
d = declare(t, `{"id":"a.bundle-code","type":"archive","source":"`+other.url("a/code")+
|
||||||
|
`","digest":"`+aDigest+`","path":"`+dir+`/a"},{"id":"b.bundle-code","type":"archive","source":"`+other.url("a/code")+
|
||||||
|
`","digest":"`+aDigest+`","path":"`+dir+`/b"}`)
|
||||||
|
if _, _, err := ApplyMindingWindows(ctx, archHost(t), d, store.State{},
|
||||||
|
store.OriginDeclared, noServices, nil, nil, nil, nil); err == nil || !strings.Contains(err.Error(), "what arrived is") {
|
||||||
|
t.Fatalf("bytes not of the digest: %v", err)
|
||||||
|
}
|
||||||
|
if len(told) != 1 || !strings.HasPrefix(told[0], aDigest+" the apply's fetch failed: ") ||
|
||||||
|
!strings.Contains(told[0], "what arrived is") {
|
||||||
|
t.Fatalf("other bytes told %q: want the declared digest forgotten once", told)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user