CAT-RD8: minio asks the assigner's seat-holders once and follows its events, no reads, no cache on a timer
This commit is contained in:
@@ -59,7 +59,7 @@ func newRig(t *testing.T) *rig {
|
||||
write("links/mesh-shanks-brother.secret", "brother-link-secret\n")
|
||||
write("links/mesh-novox-nextcloud.secret", "nextcloud-link-secret\n")
|
||||
grants := write("grants/mesh.json", grantFile)
|
||||
s, err := newServer(cfg, filepath.Join(dir, "links"), grants)
|
||||
s, err := newServer(cfg, filepath.Join(dir, "links"), grants, nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -165,36 +165,24 @@ func TestRefusals(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// 1516/AC4: with the controller unreadable a seat share is refused naming why; a good read serves a second ask within
|
||||
// 60 s from the cache and is read again after.
|
||||
func TestSeatsUnreadableAndCached(t *testing.T) {
|
||||
// 1516/AC4 and ADR 0615: with no first view of the seat-holders yet a seat share is refused naming why; once it is
|
||||
// answered every ask is served from the picture, with no read of the owner's state and none on a timer.
|
||||
func TestSeatsUnreadableAndFollowed(t *testing.T) {
|
||||
r := newRig(t)
|
||||
r.seatsErr = errors.New("the controller did not answer")
|
||||
r.seatsErr = errors.New("no first view of mesh-delivery-assigner.seat-holders yet")
|
||||
_, err := r.s.link("g14.mesh-files", ask("mesh-shanks-brother", "put", nil))
|
||||
if err == nil || !strings.Contains(err.Error(), "the controller did not answer") || !strings.Contains(err.Error(), "node-files") {
|
||||
if err == nil || !strings.Contains(err.Error(), "no first view") || !strings.Contains(err.Error(), "node-files") {
|
||||
t.Fatalf("not refused naming why: %v", err)
|
||||
}
|
||||
r.seatsErr = nil
|
||||
put := func() {
|
||||
t.Helper()
|
||||
for range 3 {
|
||||
if _, err := r.s.link("g14.mesh-files", ask("mesh-shanks-brother", "put", nil)); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
r.now = r.now.Add(10 * time.Minute) // time changes nothing: the picture is current by its events
|
||||
}
|
||||
put() // a failed read is not cached: this reads again
|
||||
put() // served from the cache
|
||||
if r.seatsCalls != 2 {
|
||||
t.Fatalf("the controller was asked %d times, want 2 (one failure, one good read)", r.seatsCalls)
|
||||
}
|
||||
r.now = r.now.Add(59 * time.Second)
|
||||
put()
|
||||
if r.seatsCalls != 2 {
|
||||
t.Fatalf("an ask within 60 s read the seats again (%d calls)", r.seatsCalls)
|
||||
}
|
||||
r.now = r.now.Add(2 * time.Second)
|
||||
put()
|
||||
if r.seatsCalls != 3 {
|
||||
t.Fatalf("the seats were not read again after 60 s (%d calls)", r.seatsCalls)
|
||||
if r.seatsCalls != 4 {
|
||||
t.Fatalf("the picture was asked %d times, want 4 (one refused, three served)", r.seatsCalls)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user