test: wait for the re-minted row before the new-holder request
Co-Authored-By: GPT-6 Astra <noreply@openai.com>
2 files changed,
+20
−15
internal/host/region_ha_g2_loss_root_linux_test.go+1 −0internal/host/region_ha_g2_pool_root_linux_test.go+19 −15
Intent
Human
<task-notification> <task-id>bsy947nv7</task-id> <tool-use-id>toolu_01T6F4wcQC6AJh7CEhfPfCdc</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/5555438b-7fa2-408d-b2c4-9fa87ea89332/tasks/bsy947nv7.output</output-file> <status>completed</status> <summary>Background command "F-A witness run 9" completed (exit code 0)</summary> </task-notification>
diff --git a/internal/host/region_ha_g2_loss_root_linux_test.go b/internal/host/region_ha_g2_loss_root_linux_test.go| index 65bbf5eb7..ff0137b72 100644 |
| --- a/internal/host/region_ha_g2_loss_root_linux_test.go |
| +++ b/internal/host/region_ha_g2_loss_root_linux_test.go |
| @@ -621,6 +621,7 @@ func g2LossNoDemand(t *testing.T, storage *g2Storage, audit release.Store, a *g2 |
| }() |
| g2Must(t, a.pools("ha")) |
| g2Must(t, a.isolationReady("no-demand/new-holder")) |
| + g2WaitRemintedRow(t, a, storage.deploy, "no-demand/new-holder") |
| signed := g2LossHopClient(ingress, mesh, time.Now) |
| self := a.state().Ref |
| started := time.Now() |
diff --git a/internal/host/region_ha_g2_pool_root_linux_test.go b/internal/host/region_ha_g2_pool_root_linux_test.go| index aacf00a81..5f9aee30e 100644 |
| --- a/internal/host/region_ha_g2_pool_root_linux_test.go |
| +++ b/internal/host/region_ha_g2_pool_root_linux_test.go |
| @@ -205,6 +205,24 @@ func g2Put(t *testing.T, store release.Store, key string, value []byte) { |
| func g2Serial(t *testing.T, store release.Store) { |
| g2Must(t, release.BumpSerial(t.Context(), store, time.Now())) |
| } |
| +func g2WaitRemintedRow(t *testing.T, a *g2Box, store release.Store, name string) { |
| + t.Helper() |
| + g2Serial(t, store) |
| + remintStarted := time.Now() |
| + nextSerial := remintStarted.Add(20 * time.Second) |
| + g2Wait(t, "A reminted eligible row for "+name, 180*time.Second, func() bool { |
| + row, err := a.reg.Get(g2Host) |
| + if err == nil && row != nil { |
| + return true |
| + } |
| + if !time.Now().Before(nextSerial) { |
| + g2Serial(t, store) |
| + nextSerial = time.Now().Add(20 * time.Second) |
| + } |
| + return false |
| + }) |
| + t.Logf("%s time_to_remint=%s", name, time.Since(remintStarted)) |
| +} |
| func g2ZeroAcquire(events []g2S3Event, ip, host string) error { |
| for _, event := range events { |
| if event.Source == ip && event.Method == "PUT" && event.Path == "/"+g2Data+"/instances/"+host+"/lock.json" && !event.Release { |
| @@ -629,21 +647,7 @@ func TestRootG2PoolIngress(t *testing.T) { |
| start = len(storage.snapshot()) |
| g2Must(t, a.pools("ha")) |
| g2Must(t, a.isolationReady("withdrawal/"+fault+"/eligible")) |
| - g2Serial(t, storage.deploy) |
| - remintStarted := time.Now() |
| - nextSerial := remintStarted.Add(20 * time.Second) |
| - g2Wait(t, "A reminted eligible row for "+fault, 180*time.Second, func() bool { |
| - row, err := a.reg.Get(g2Host) |
| - if err == nil && row != nil { |
| - return true |
| - } |
| - if !time.Now().Before(nextSerial) { |
| - g2Serial(t, storage.deploy) |
| - nextSerial = time.Now().Add(20 * time.Second) |
| - } |
| - return false |
| - }) |
| - t.Logf("withdrawal/%s time_to_remint=%s", fault, time.Since(remintStarted)) |
| + g2WaitRemintedRow(t, a, storage.deploy, "withdrawal/"+fault) |
| aRef := a.state().Ref |
| g2Served(t, client, "withdrawal/"+fault+"/awake", g2Host, aRef, func() { |
| g2Stopped(t, g2Peer(t, g2RPC{Action: "state"}), g2Host) |