carlos / platform Public

test: harden the pool witness peer fixture

Co-Authored-By: GPT-6 Astra <noreply@openai.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 5241b37fff41077be09c0fd535ac2a87e0801a39 parent ea20263
5 files changed, +297 −94
  • internal/host/region_ha_g2_peer_test.go +106 −0
  • internal/host/region_ha_g2_pool_root_linux_test.go +38 −25
  • internal/host/region_ha_g2_root_fixture_test.go +145 −68
  • scripts/region-ha-g2-pool-witness.py +2 −1
  • scripts/region_ha_g2_pool_witness_test.py +6 −0

Intent

Human

<task-notification> <task-id>b2ex5i93n</task-id> <tool-use-id>toolu_01DUM9aofea8eDCeiAsEh5mj</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/5555438b-7fa2-408d-b2c4-9fa87ea89332/tasks/b2ex5i93n.output</output-file> <status>completed</status> <summary>Background command "Run F-B witness live, run 7" completed (exit code 0)</summary> </task-notification>

diff --git a/internal/host/region_ha_g2_peer_test.go b/internal/host/region_ha_g2_peer_test.go
new file mode 100644
index 000000000..a3c3140b2
--- /dev/null
+++ b/internal/host/region_ha_g2_peer_test.go
@@ -0,0 +1,106 @@
+//go:build linux && rootrunner
+
+package host
+
+import (
+ "errors"
+ "net/http"
+ "net/http/httptest"
+ "strings"
+ "testing"
+ "time"
+
+ "github.com/carlosframework/platform/internal/release"
+)
+
+func TestG2PoolJournalBoundary(t *testing.T) {
+ now := time.Unix(100, 123456000)
+ for _, tc := range []struct{ output, previous, want string }{
+ {"entry\n-- cursor: s=new;i=1", "s=old;i=0", "s=new;i=1"},
+ {"-- No entries --", "s=old;i=0", "s=old;i=0"},
+ {"", "s=old;i=0", "s=old;i=0"},
+ {"-- No entries --", "", "since=@100.123456"},
+ {"", "", "since=@100.123456"},
+ } {
+ got, err := g2JournalBoundary(tc.output, tc.previous, now)
+ if err != nil || got != tc.want {
+ t.Fatalf("output=%q previous=%q: %q, %v", tc.output, tc.previous, got, err)
+ }
+ }
+ if _, err := g2JournalBoundary("entry without cursor", "old", now); err == nil {
+ t.Fatal("malformed journal output accepted")
+ }
+ for _, marker := range []string{"s=new;i=1", "since=@100.123456"} {
+ arg, err := g2JournalAfter(marker)
+ g2Must(t, err)
+ want := "--after-cursor=" + marker
+ if strings.HasPrefix(marker, "since=") {
+ want = "--" + marker
+ }
+ if arg != want {
+ t.Fatalf("got %q want %q", arg, want)
+ }
+ }
+ if _, err := g2JournalAfter(""); err == nil {
+ t.Fatal("empty boundary accepted")
+ }
+}
+
+func TestG2PoolPeerHelperFailure(t *testing.T) {
+ calls := make(chan g2Call)
+ handler := g2PeerHandler("fixture-token", calls)
+ finished := make(chan struct{})
+ go func() {
+ defer close(finished)
+ for range 2 {
+ call := <-calls
+ call.result <- g2PeerAction(t, func(scope testing.TB) any {
+ if call.request.Action == "fail" {
+ g2Must(scope, errors.New("journalctl failed: permission denied"))
+ }
+ return g2State{IID: "peer-still-running"}
+ })
+ }
+ }()
+ for _, action := range []string{"fail", "state"} {
+ req := httptest.NewRequest("POST", "/", strings.NewReader(`{"Action":"`+action+`"}`))
+ req.Header.Set("Authorization", "Bearer fixture-token")
+ response := httptest.NewRecorder()
+ handler.ServeHTTP(response, req)
+ state, err := g2DecodePeer(action, response.Result())
+ if action == "fail" {
+ if response.Code != http.StatusInternalServerError || err == nil || !strings.Contains(err.Error(), "journalctl failed: permission denied") || !strings.Contains(err.Error(), g2FixtureError) {
+ t.Fatalf("lost helper failure: status=%d err=%v body=%s", response.Code, err, response.Body.String())
+ }
+ } else if err != nil || state.IID != "peer-still-running" {
+ t.Fatalf("peer did not survive: %+v %v", state, err)
+ }
+ }
+ <-finished
+}
+
+func TestG2PoolSerialSignal(t *testing.T) {
+ store := release.NewDirStore(t.TempDir())
+ for want := int64(1); want <= 2; want++ {
+ g2Serial(t, store)
+ doc, _, err := release.ReadSerial(t.Context(), store)
+ if err != nil || doc.Schema != 1 || doc.Serial != want {
+ t.Fatalf("serial signal ignored: %+v %v; want %d", doc, err, want)
+ }
+ }
+}
+
+func TestG2PoolLeftoverResponse(t *testing.T) {
+ valid := g2Response{Status: 503, Headers: http.Header{"Retry-After": {"10"}}, Body: []byte("instance failed to wake\n")}
+ g2Must(t, g2LeftoverResponse(valid))
+ for _, bad := range []g2Response{
+ {Status: 503, Body: valid.Body},
+ {Status: 200, Headers: valid.Headers, Body: valid.Body},
+ {Status: 503, Headers: valid.Headers, Body: []byte(g2C1Body)},
+ {Status: 503, Headers: valid.Headers, Body: valid.Body, Err: errors.New("read error")},
+ } {
+ if g2LeftoverResponse(bad) == nil {
+ t.Fatalf("accepted unrelated refusal: %+v", bad)
+ }
+ }
+}
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 d97519354..ec969d97c 100644
--- a/internal/host/region_ha_g2_pool_root_linux_test.go
+++ b/internal/host/region_ha_g2_pool_root_linux_test.go
@@ -85,6 +85,15 @@ func g2C1(response g2Response) error {
return nil
}
+func g2LeftoverResponse(response g2Response) error {
+ if response.Err != nil || response.Status != 503 ||
+ !slices.Equal(response.Headers.Values("Retry-After"), []string{"10"}) ||
+ string(response.Body) != "instance failed to wake\n" {
+ return fmt.Errorf("expected leftover-data refusal: %+v", response)
+ }
+ return nil
+}
+
func g2ServedDelivery(response g2Response, ref string) (g2Delivery, error) {
var delivery g2Delivery
if response.Err != nil || response.Status != 200 {
@@ -192,7 +201,7 @@ func g2Put(t *testing.T, store release.Store, key string, value []byte) {
g2Must(t, err)
}
func g2Serial(t *testing.T, store release.Store) {
- g2Put(t, store, "control/serial", []byte(strconv.FormatInt(time.Now().UnixNano(), 10)))
+ g2Must(t, release.BumpSerial(t.Context(), store, time.Now()))
}
func g2ZeroAcquire(events []g2S3Event, ip, host string) error {
for _, event := range events {
@@ -477,13 +486,15 @@ func TestRootG2PoolIngress(t *testing.T) {
g2Must(t, g2AbsentPrefix(t.Context(), storage.data, fresh, true))
}
g2Outcome(t, client, projection+"/absent-leftover", fresh, "GET", "", "", func(response g2Response) error {
- if response.Err != nil || response.Status != 503 {
- return fmt.Errorf("expected leftover-data refusal: %+v", response)
- }
- journal := g2Peer(t, g2RPC{Action: "journal", Value: journalCursor}).AgentJournal
- if !strings.Contains(journal, "activator: wake "+fresh+": instance lease refused: leftover data") {
- return errors.New("B has not yet refused leftover data")
+ if err := g2LeftoverResponse(response); err != nil {
+ return err
}
+ var journal string
+ g2Wait(t, "B leftover-data journal evidence", 10*time.Second, func() bool {
+ checkNegative()
+ journal = g2Peer(t, g2RPC{Action: "journal", Value: journalCursor}).AgentJournal
+ return strings.Contains(journal, "activator: wake "+fresh+": instance lease refused: leftover data")
+ })
t.Logf("B leftover-data evidence host=%s journal=%s", fresh, journal)
return nil
}, checkNegative)
@@ -578,12 +589,16 @@ 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)
g2Wait(t, "A reminted eligible row", 60*time.Second, func() bool { row, err := a.reg.Get(g2Host); return err == nil && row != nil })
aRef := a.state().Ref
- served("withdrawal/"+fault+"/awake", g2Host, aRef)
+ g2Served(t, client, "withdrawal/"+fault+"/awake", g2Host, aRef, func() {
+ g2Stopped(t, g2Peer(t, g2RPC{Action: "state"}), g2Host)
+ g2Must(t, g2ZeroAcquire(storage.snapshot()[start:], os.Getenv("G2_B_IP"), g2Host))
+ })
awake := a.state()
- if awake.TenantPIDs[g2Host] == "0" {
+ if awake.TenantPIDs[g2Host] == "" || awake.TenantPIDs[g2Host] == "0" || !strings.Contains(awake.TenantCgroups[g2Host], "populated 1") {
t.Fatal("withdrawal fixture never woke")
}
if fault == "blocked-stop" {
@@ -597,20 +612,20 @@ func TestRootG2PoolIngress(t *testing.T) {
g2Serial(t, storage.deploy)
g2Refused(t, client, "withdrawal/"+fault+"/fenced", g2Host, "")
if fault != "clean" {
- state := a.state()
- found := false
- for _, row := range state.Rows {
- if row.Host == g2Host {
- found = true
+ g2Wait(t, "withdrawal fault evidence "+fault, 60*time.Second, func() bool {
+ state := a.state()
+ found := false
+ for _, row := range state.Rows {
+ if row.Host == g2Host {
+ found = true
+ }
}
- }
- if !found {
- t.Fatal("row removed before stop/duties were proven", fault)
- }
- g2Must(t, g2ZeroAcquire(storage.snapshot()[boundary:], a.ip, g2Host))
- if fault == "pending-release" && len(state.Owed) == 0 {
- t.Fatal("pending release fixture produced no durable obligation")
- }
+ if !found {
+ t.Fatal("row removed before stop/duties were proven", fault)
+ }
+ g2Must(t, g2ZeroAcquire(storage.snapshot()[boundary:], a.ip, g2Host))
+ return fault != "pending-release" || len(state.Owed) > 0
+ })
if fault == "blocked-stop" {
g2Command(t, "systemctl", "kill", "--kill-whom=main", "--signal=CONT", "carlos-instance-control.service")
}
@@ -644,9 +659,7 @@ func TestRootG2PoolIngress(t *testing.T) {
t.Fatal("registry deletion preceded acknowledged release")
}
state := a.state()
- if state.TenantPIDs[g2Host] != "0" && state.TenantPIDs[g2Host] != "" {
- t.Fatal("row removed with a live tenant", state)
- }
+ g2Stopped(t, state, g2Host)
return true
})
g2Must(t, g2ZeroAcquire(storage.snapshot()[boundary:], a.ip, g2Host))
diff --git a/internal/host/region_ha_g2_root_fixture_test.go b/internal/host/region_ha_g2_root_fixture_test.go
index fb6074297..24bc8cc47 100644
--- a/internal/host/region_ha_g2_root_fixture_test.go
+++ b/internal/host/region_ha_g2_root_fixture_test.go
@@ -65,6 +65,7 @@ const (
g2Secret = "g2fix-secret-only-disposable-minio"
g2PoolViolation = "G2_POOL_VIOLATION"
g2EnvironmentNotReady = "G2_ENVIRONMENT_NOT_READY"
+ g2FixtureError = "G2_FIXTURE_ERROR"
g2IsolationTimeout = 180 * time.Second
g2PeerTimeout = g2IsolationTimeout + 180*time.Second
)
@@ -215,35 +216,36 @@ func g2PublishedIsolation(ctx context.Context, uid int, run func(context.Context
}
type g2Box struct {
- t *testing.T
- role, iid, ip string
- config g2Config
- reg *registry.Registry
- audit *sql.DB
- uid, gid int
- env map[string]string
- units []string
- isolation []g2IsolationEvidence
+ t testing.TB
+ role, iid, ip string
+ config g2Config
+ reg *registry.Registry
+ audit *sql.DB
+ uid, gid int
+ env map[string]string
+ units []string
+ isolation []g2IsolationEvidence
+ journalBoundary string
}
-func g2Must(t *testing.T, err error) {
+func g2Must(t testing.TB, err error) {
t.Helper()
if err != nil {
t.Fatal(err)
}
}
-func g2JSON(t *testing.T, value any) []byte {
+func g2JSON(t testing.TB, value any) []byte {
t.Helper()
data, err := json.Marshal(value)
g2Must(t, err)
return data
}
-func g2Write(t *testing.T, path string, data []byte, mode os.FileMode) {
+func g2Write(t testing.TB, path string, data []byte, mode os.FileMode) {
t.Helper()
g2Must(t, os.MkdirAll(filepath.Dir(path), 0755))
g2Must(t, os.WriteFile(path, data, mode))
}
-func g2Command(t *testing.T, name string, args ...string) string {
+func g2Command(t testing.TB, name string, args ...string) string {
t.Helper()
ctx, cancel := context.WithTimeout(context.Background(), 90*time.Second)
defer cancel()
@@ -255,7 +257,7 @@ func g2Command(t *testing.T, name string, args ...string) string {
}
return strings.TrimSpace(string(out))
}
-func g2Wait(t *testing.T, why string, timeout time.Duration, fn func() bool) {
+func g2Wait(t testing.TB, why string, timeout time.Duration, fn func() bool) {
t.Helper()
deadline := time.Now().Add(timeout)
for time.Now().Before(deadline) {
@@ -329,8 +331,12 @@ func g2Certificates(t *testing.T) (cert, key, ca string) {
func g2NewBox(t *testing.T, role string, config g2Config) *g2Box {
t.Helper()
iid, ip := g2Prereqs(t, role)
- b := &g2Box{t: t, role: role, iid: iid, ip: ip, config: config}
- b.uid, b.gid = generationRunnerRegistryUser(t)
+ uid, gid := generationRunnerRegistryUser(t)
+ return g2ConfigureBox(t, role, config, iid, ip, uid, gid)
+}
+
+func g2ConfigureBox(t testing.TB, role string, config g2Config, iid, ip string, uid, gid int) *g2Box {
+ b := &g2Box{t: t, role: role, iid: iid, ip: ip, config: config, uid: uid, gid: gid}
if _, err := user.LookupGroup(socketsGroup); err == nil {
t.Fatal("refuse existing socket-consumer group")
}
@@ -629,19 +635,39 @@ type g2RPC struct {
}
type g2Call struct {
request g2RPC
- result chan any
+ result chan g2Reply
+}
+type g2Reply struct {
+ value any
+ err error
}
-func TestRootG2Peer(t *testing.T) {
- _, ip := g2Prereqs(t, "B")
- calls := make(chan g2Call)
- stop := make(chan os.Signal, 1)
- signal.Notify(stop, syscall.SIGTERM, syscall.SIGINT)
- defer signal.Stop(stop)
- listener, err := net.Listen("tcp", net.JoinHostPort(ip, "9444"))
- g2Must(t, err)
- server := &http.Server{ReadHeaderTimeout: 5 * time.Second, Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- if subtle.ConstantTimeCompare([]byte(r.Header.Get("Authorization")), []byte("Bearer "+os.Getenv("G2_TOKEN"))) != 1 {
+type g2PeerFailure struct{ message string }
+type g2PeerScope struct{ *testing.T }
+
+func (t g2PeerScope) Fatal(args ...any) { panic(g2PeerFailure{fmt.Sprint(args...)}) }
+func (t g2PeerScope) Fatalf(format string, args ...any) {
+ panic(g2PeerFailure{fmt.Sprintf(format, args...)})
+}
+
+func g2PeerAction(t *testing.T, action func(testing.TB) any) (reply g2Reply) {
+ defer func() {
+ if failure := recover(); failure != nil {
+ if known, ok := failure.(g2PeerFailure); ok {
+ reply.err = fmt.Errorf("%s: %s", g2FixtureError, known.message)
+ t.Log(reply.err)
+ } else {
+ panic(failure)
+ }
+ }
+ }()
+ reply.value = action(g2PeerScope{t})
+ return
+}
+
+func g2PeerHandler(token string, calls chan<- g2Call) http.Handler {
+ return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ if subtle.ConstantTimeCompare([]byte(r.Header.Get("Authorization")), []byte("Bearer "+token)) != 1 {
http.Error(w, "denied", 403)
return
}
@@ -650,7 +676,7 @@ func TestRootG2Peer(t *testing.T) {
http.Error(w, "request", 400)
return
}
- call := g2Call{request: req, result: make(chan any, 1)}
+ call := g2Call{request: req, result: make(chan g2Reply, 1)}
select {
case calls <- call:
case <-r.Context().Done():
@@ -658,34 +684,77 @@ func TestRootG2Peer(t *testing.T) {
}
select {
case result := <-call.result:
- json.NewEncoder(w).Encode(result)
+ if result.err != nil {
+ http.Error(w, result.err.Error(), http.StatusInternalServerError)
+ return
+ }
+ json.NewEncoder(w).Encode(result.value)
case <-r.Context().Done():
return
}
- })}
+ })
+}
+
+func g2JournalBoundary(output, previous string, at time.Time) (string, error) {
+ for _, line := range strings.Split(output, "\n") {
+ if cursor, ok := strings.CutPrefix(line, "-- cursor: "); ok && strings.TrimSpace(cursor) != "" {
+ return strings.TrimSpace(cursor), nil
+ }
+ }
+ if output = strings.TrimSpace(output); output != "" && output != "-- No entries --" {
+ return "", fmt.Errorf("missing journal cursor: %s", output)
+ }
+ if previous != "" {
+ return previous, nil
+ }
+ return fmt.Sprintf("since=@%d.%06d", at.Unix(), at.Nanosecond()/1000), nil
+}
+
+func g2JournalAfter(boundary string) (string, error) {
+ if boundary == "" {
+ return "", errors.New("journal boundary required")
+ }
+ if strings.HasPrefix(boundary, "since=@") {
+ return "--" + boundary, nil
+ }
+ return "--after-cursor=" + boundary, nil
+}
+
+func TestRootG2Peer(t *testing.T) {
+ iid, ip := g2Prereqs(t, "B")
+ uid, gid := generationRunnerRegistryUser(t)
+ calls := make(chan g2Call)
+ stop := make(chan os.Signal, 1)
+ signal.Notify(stop, syscall.SIGTERM, syscall.SIGINT)
+ defer signal.Stop(stop)
+ listener, err := net.Listen("tcp", net.JoinHostPort(ip, "9444"))
+ g2Must(t, err)
+ server := &http.Server{ReadHeaderTimeout: 5 * time.Second, Handler: g2PeerHandler(os.Getenv("G2_TOKEN"), calls)}
t.Cleanup(func() { server.Close() })
go server.Serve(listener)
var box *g2Box
+ configured := false
for {
select {
case <-stop:
return
case call := <-calls:
- switch call.request.Action {
- case "ready":
- call.result <- map[string]string{"iid": os.Getenv("G2_B_IID")}
- case "configure":
- if box != nil {
- t.Fatal("already configured")
+ reply := g2PeerAction(t, func(scope testing.TB) any {
+ switch call.request.Action {
+ case "ready":
+ return map[string]string{"iid": iid}
+ case "configure":
+ if configured {
+ scope.Fatal("already configured")
+ }
+ configured = true
+ box = g2ConfigureBox(scope, "B", call.request.Config, iid, ip, uid, gid)
+ return box.state()
+ case "shutdown":
+ return true
}
- box = g2NewBox(t, "B", call.request.Config)
- call.result <- box.state()
- case "shutdown":
- call.result <- true
- return
- default:
if box == nil {
- t.Fatal("configure first")
+ scope.Fatal("configure first")
}
var isolationErr error
switch call.request.Action {
@@ -694,39 +763,51 @@ func TestRootG2Peer(t *testing.T) {
case "pools":
isolationErr = box.pools(call.request.Value)
case "freeze":
- g2Command(t, "systemctl", "kill", "--kill-whom=main", "--signal=STOP", "carlos-edge.service")
+ g2Command(scope, "systemctl", "kill", "--kill-whom=main", "--signal=STOP", "carlos-edge.service")
case "thaw":
- g2Command(t, "systemctl", "kill", "--kill-whom=main", "--signal=CONT", "carlos-edge.service")
+ g2Command(scope, "systemctl", "kill", "--kill-whom=main", "--signal=CONT", "carlos-edge.service")
case "journal-cursor":
state := box.state()
- cursor := g2Command(t, "journalctl", "-u", "carlos-edge.service", "--no-pager", "--show-cursor", "-n", "0")
- if !strings.HasPrefix(cursor, "-- cursor: ") {
- t.Fatal("missing journal cursor", cursor)
- }
- state.AgentJournal = strings.TrimPrefix(cursor, "-- cursor: ")
- call.result <- state
- continue
+ at := time.Now()
+ output := g2Command(scope, "journalctl", "-u", "carlos-edge.service", "--no-pager", "--show-cursor", "-n", "1")
+ boundary, err := g2JournalBoundary(output, box.journalBoundary, at)
+ g2Must(scope, err)
+ box.journalBoundary, state.AgentJournal = boundary, boundary
+ return state
case "journal":
- if call.request.Value == "" {
- t.Fatal("journal cursor required")
- }
+ arg, err := g2JournalAfter(call.request.Value)
+ g2Must(scope, err)
state := box.state()
- state.AgentJournal = g2Command(t, "journalctl", "-u", "carlos-edge.service", "--no-pager", "-n", "2000", "--after-cursor="+call.request.Value)
- call.result <- state
- continue
+ state.AgentJournal = g2Command(scope, "journalctl", "-u", "carlos-edge.service", "--no-pager", "-n", "2000", arg)
+ return state
case "state":
default:
- t.Fatal("invalid fixture action", call.request.Action)
+ scope.Fatal("invalid fixture action ", call.request.Action)
}
if isolationErr != nil {
- call.result <- g2State{IID: box.iid, Isolation: slices.Clone(box.isolation), IsolationError: isolationErr.Error()}
- continue
+ return g2State{IID: box.iid, Isolation: slices.Clone(box.isolation), IsolationError: isolationErr.Error()}
}
- call.result <- box.state()
+ return box.state()
+ })
+ call.result <- reply
+ if call.request.Action == "shutdown" {
+ return
}
}
}
}
+
+func g2DecodePeer(action string, response *http.Response) (g2State, error) {
+ defer response.Body.Close()
+ var state g2State
+ if response.StatusCode != http.StatusOK {
+ raw, err := io.ReadAll(io.LimitReader(response.Body, 64<<10))
+ return state, fmt.Errorf("peer %s: HTTP %d: %s (body read: %v)", action, response.StatusCode, strings.TrimSpace(string(raw)), err)
+ }
+ err := json.NewDecoder(response.Body).Decode(&state)
+ return state, err
+}
+
func g2Peer(t *testing.T, req g2RPC) g2State {
t.Helper()
client := &http.Client{Timeout: g2PeerTimeout}
@@ -735,12 +816,8 @@ func g2Peer(t *testing.T, req g2RPC) g2State {
request.Header.Set("Authorization", "Bearer "+os.Getenv("G2_TOKEN"))
response, err := client.Do(request)
g2Must(t, err)
- defer response.Body.Close()
- if response.StatusCode != 200 {
- t.Fatalf("peer %s: %d", req.Action, response.StatusCode)
- }
- var state g2State
- g2Must(t, json.NewDecoder(response.Body).Decode(&state))
+ state, err := g2DecodePeer(req.Action, response)
+ g2Must(t, err)
if req.Action == "start" || req.Action == "pools" {
t.Logf("peer ISOLATION_READINESS %s", g2JSON(t, state.Isolation))
}
diff --git a/scripts/region-ha-g2-pool-witness.py b/scripts/region-ha-g2-pool-witness.py
index 048fcd36e..0dafb0fc8 100644
--- a/scripts/region-ha-g2-pool-witness.py
+++ b/scripts/region-ha-g2-pool-witness.py
@@ -27,6 +27,7 @@ MINIO_URL = ("https://github.com/minio/minio/releases/download/RELEASE.2025-09-0
MINIO_SHA = "5c83cd2cf151717ba0243f73e1c7802ff36e272b67144bdd7f1f7d684fd6f03d"
PASS = "PASS TestRootG2PoolIngress"
ENVIRONMENT_NOT_READY = "G2_ENVIRONMENT_NOT_READY"
+FIXTURE_ERROR = "G2_FIXTURE_ERROR"
REQUIRED_CASES = (["signed-hop-ineligible", "concurrent-posts", "eligible-low-headroom",
"no-eligible-peer", "host-advertised-wrong-pool"] +
[f"{projection}/{shape}" for projection in ("old-row-startup", "row-absent")
@@ -62,7 +63,7 @@ def validate_tip(worktree, expected):
def verify_environment(log):
- failures = [line for line in log.splitlines() if ENVIRONMENT_NOT_READY in line]
+ failures = [line for line in log.splitlines() if ENVIRONMENT_NOT_READY in line or FIXTURE_ERROR in line]
if failures:
raise RuntimeError("\n".join(failures))
diff --git a/scripts/region_ha_g2_pool_witness_test.py b/scripts/region_ha_g2_pool_witness_test.py
index 6bd833271..063bc7c62 100644
--- a/scripts/region_ha_g2_pool_witness_test.py
+++ b/scripts/region_ha_g2_pool_witness_test.py
@@ -117,6 +117,12 @@ class DriverOfflineTest(unittest.TestCase):
with self.subTest(phase=phase), self.assertRaisesRegex(RuntimeError, history.replace('[', r'\[').replace(']', r'\]')):
driver.verify_result({"Status": "Failed"}, history + "\nG2_POOL_VIOLATION", phase)
+ def test_fixture_failure_is_never_mutation_acceptance(self):
+ for phase in ("baseline", "mutant", "restored"):
+ with self.subTest(phase=phase), self.assertRaisesRegex(RuntimeError, "G2_FIXTURE_ERROR"):
+ driver.verify_result({"Status": "Failed"},
+ "G2_POOL_VIOLATION\nG2_FIXTURE_ERROR: journalctl failed", phase)
+
def test_mutation_does_not_edit_source(self):
with tempfile.TemporaryDirectory(dir=os.environ["TMPDIR"]) as directory:
root = Path(directory)