Give the served done key a fingerprint a key holds, and wait for the store's grants in the rotation (issue 1945)
This commit is contained in:
@@ -364,7 +364,7 @@ func TestServedADoneKeyIsComposedAndGranted(t *testing.T) {
|
||||
}
|
||||
next := shelf["board"]
|
||||
next.Version = "2"
|
||||
fp := fpOf('n')
|
||||
fp := fpOf('c')
|
||||
raw, k, trunk := keyOfManifest(t, next, fp, "d00d0123456789ab")
|
||||
manifests, err := m.indexer.KeyValue(ctx, sdkdelivery.ManifestsBucket)
|
||||
if err != nil {
|
||||
@@ -407,8 +407,9 @@ func TestServedADoneKeyIsComposedAndGranted(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// 1945/AC2: the operator rotates the store's credential, the real verb: the compositions that carry it (the board's on
|
||||
// laptop, the store's grants on anchor) get a new revision, every other composition keeps its own, and nothing is sent.
|
||||
// 1945/AC2: the operator rotates the store's credential, the real verb: the compositions that carry it (the store's
|
||||
// grants on anchor, and the board's on laptop when it carries the credential) get a new revision, every other
|
||||
// composition keeps its own, and nothing is sent.
|
||||
func TestServedARotationRewritesOnlyTheCompositionsThatUseIt(t *testing.T) {
|
||||
m := aServedMesh(t)
|
||||
before := map[string]map[string]uint64{"anchor": m.revisions(t, "anchor"), "laptop": m.revisions(t, "laptop")}
|
||||
@@ -416,7 +417,9 @@ func TestServedARotationRewritesOnlyTheCompositionsThatUseIt(t *testing.T) {
|
||||
t.Fatalf("rotate: %v", err)
|
||||
}
|
||||
boardKey, _ := sdkdelivery.ComposedKey("laptop", "board", fpOf('b'))
|
||||
m.waitFor(t, nil, "laptop", boardKey, before["laptop"][boardKey])
|
||||
storeKey, _ := sdkdelivery.ComposedKey("anchor", "store", fpOf('a'))
|
||||
// The store's grants carry the consumer's credential: its composition moves with the rotation.
|
||||
m.waitFor(t, nil, "anchor", storeKey, before["anchor"][storeKey])
|
||||
moved := map[string]bool{}
|
||||
for node, was := range before {
|
||||
for k, rev := range m.revisions(t, node) {
|
||||
@@ -425,14 +428,13 @@ func TestServedARotationRewritesOnlyTheCompositionsThatUseIt(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
storeKey, _ := sdkdelivery.ComposedKey("anchor", "store", fpOf('a'))
|
||||
for k := range moved {
|
||||
if k != boardKey && k != storeKey {
|
||||
t.Errorf("%s moved: only the compositions carrying the credential do", k)
|
||||
}
|
||||
}
|
||||
if !moved[boardKey] {
|
||||
t.Errorf("the board's composition did not move: %v", moved)
|
||||
if !moved[storeKey] {
|
||||
t.Errorf("the store's composition did not move: %v", moved)
|
||||
}
|
||||
if n := m.declarationsSent(t); n != 0 {
|
||||
t.Errorf("%d declarations were sent", n)
|
||||
|
||||
Reference in New Issue
Block a user