Review of 083: a message the store cannot take is held and retried on a ticker, not slept on, so enrolments are answered meanwhile; a newer one per subject supersedes; the password is replaced after the spend; the same presenter may finish after a lost answer; upgrades retry only on the store

This commit is contained in:
2026-09-22 14:23:03 +02:00
parent 1a41b88ed3
commit a3b7e830c8
7 changed files with 280 additions and 184 deletions
+9 -5
View File
@@ -42,10 +42,13 @@ func a(t *testing.T, to *settledAs, key string, v any) amqp.Delivery {
if err != nil {
t.Fatal(err)
}
return amqp.Delivery{Acknowledger: to, RoutingKey: key, Body: body}
tag++
return amqp.Delivery{Acknowledger: to, RoutingKey: key, Body: body, DeliveryTag: tag}
}
func quietServer() *Server { return &Server{log: log.New(io.Discard, "", 0), again: 1} }
func quietServer() *Server { return &Server{log: log.New(io.Discard, "", 0)} }
func (a *settledAs) held() bool { return !a.acked && !a.nacked && !a.rejected }
// A build result the store could not take right now is handed back; one it refused is rejected,
// as before; one it kept is acknowledged.
@@ -56,7 +59,7 @@ func TestABuildResultWaitsOutARestartingStore(t *testing.T) {
err error
want func(*settledAs) bool
}{
{"restarting", restarting, func(s *settledAs) bool { return s.requeued && !s.acked && !s.rejected }},
{"restarting", restarting, func(s *settledAs) bool { return s.held() }},
{"refused", errors.New("no such module"), func(s *settledAs) bool { return s.rejected && !s.nacked }},
{"kept", nil, func(s *settledAs) bool { return s.acked && !s.nacked }},
} {
@@ -79,7 +82,8 @@ func TestAnUpgradeWaitsOutARestartingStoreAndNothingElse(t *testing.T) {
err error
want func(*settledAs) bool
}{
{"restarting", restarting, func(s *settledAs) bool { return s.requeued && !s.acked }},
{"the store away, said by the upgrader", errors.Join(ErrTryAgain, restarting), func(s *settledAs) bool { return s.held() }},
{"a push that timed out", context.DeadlineExceeded, func(s *settledAs) bool { return s.acked && !s.nacked }},
{"cannot act", errors.New("anchor cannot be resolved"), func(s *settledAs) bool { return s.acked && !s.nacked }},
{"acted", nil, func(s *settledAs) bool { return s.acked && !s.nacked }},
} {
@@ -101,7 +105,7 @@ func TestACatchUpWaitsOutARestartingStore(t *testing.T) {
err error
want func(*settledAs) bool
}{
{"restarting", restarting, func(s *settledAs) bool { return s.requeued && !s.acked }},
{"restarting", restarting, func(s *settledAs) bool { return s.held() }},
{"unreadable", errors.New("a build row is malformed"), func(s *settledAs) bool { return s.acked && !s.nacked }},
{"nothing to replay", nil, func(s *settledAs) bool { return s.acked && !s.nacked }},
} {