From b79ac3ba50b087c33d325d2ea0ea6bd2c1767d6f Mon Sep 17 00:00:00 2001 From: thc1006 Date: Fri, 31 Jul 2026 09:13:02 +0800 Subject: [PATCH] fix(test): repair stale flap-state call arity that broke main's vet (merge-skew) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit storeFlapState/loadFlapState gained a `generation int64` param, but the telemetry-gap tests (#292) merged with the old 3-/2-arg calls, so `go vet ./...` — and every PR's Unit/Race/E2E, which all compile the test package — fails on main. Pass nsObj.Generation at all four call sites, matching the store/load generation-staleness contract and the production callers (ns.Generation). go vet clean; full controller suite green. This is why several open PRs show all-red CI: they merge a main whose tests do not compile. --- internal/controller/ntnslice_satread_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/controller/ntnslice_satread_test.go b/internal/controller/ntnslice_satread_test.go index 283e5292..25c74fae 100644 --- a/internal/controller/ntnslice_satread_test.go +++ b/internal/controller/ntnslice_satread_test.go @@ -182,7 +182,7 @@ func TestReconcile_UnknownSatellite_ResetsStreakKeepsDwell(t *testing.T) { key := client.ObjectKeyFromObject(nsObj) // Seed a confirmation + recovery streak AND a dwell clock from an earlier reliable window. dwell := fixedNow.Add(-30 * time.Second) - r.storeFlapState(key, nsObj.UID, slice.AntiFlapState{ + r.storeFlapState(key, nsObj.UID, nsObj.Generation, slice.AntiFlapState{ RecoveryObservedAt: fixedNow.Add(-200 * time.Second), ConsecutiveDegraded: 2, LastSwitchback: dwell, @@ -192,7 +192,7 @@ func TestReconcile_UnknownSatellite_ResetsStreakKeepsDwell(t *testing.T) { t.Fatalf("reconcile: %v", err) } - st := r.loadFlapState(key, nsObj.UID) + st := r.loadFlapState(key, nsObj.UID, nsObj.Generation) if !st.RecoveryObservedAt.IsZero() { t.Errorf("recovery clock must reset when satellite availability is unknown (H2), got %v", st.RecoveryObservedAt) } @@ -265,7 +265,7 @@ func TestReconcile_MetricsUnreliableSatelliteKnown_ResetsStreakKeepsDwell(t *tes key := client.ObjectKeyFromObject(nsObj) dwell := fixedNow.Add(-30 * time.Second) - r.storeFlapState(key, nsObj.UID, slice.AntiFlapState{ + r.storeFlapState(key, nsObj.UID, nsObj.Generation, slice.AntiFlapState{ RecoveryObservedAt: fixedNow.Add(-200 * time.Second), ConsecutiveDegraded: 2, LastSwitchback: dwell, @@ -275,7 +275,7 @@ func TestReconcile_MetricsUnreliableSatelliteKnown_ResetsStreakKeepsDwell(t *tes t.Fatalf("reconcile: %v", err) } - st := r.loadFlapState(key, nsObj.UID) + st := r.loadFlapState(key, nsObj.UID, nsObj.Generation) if !st.RecoveryObservedAt.IsZero() { t.Errorf("recovery clock must reset on unreliable metrics with a known satellite (H2), got %v", st.RecoveryObservedAt) }