diff --git a/internal/apply/store_away_test.go b/internal/apply/store_away_test.go index 58bd4b22..8dcea3ad 100644 --- a/internal/apply/store_away_test.go +++ b/internal/apply/store_away_test.go @@ -313,4 +313,20 @@ func TestAStoreThatStaysAwayCostsOneBoundedWait(t *testing.T) { if time.Since(began) > time.Second || missing.fetches() != 1 { 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) + } }