1
0
Fork 0
mirror of https://github.com/imjasonh/git-k8s synced 2026-07-13 17:07:05 +00:00

Fix stale resourceVersion bug in push controller

The push controller updates status to InProgress then later to
Succeeded/Failed. The first UpdateStatus call returns a new object with
an updated resourceVersion, but the code was discarding it. Subsequent
status updates used the stale resourceVersion, causing 409 Conflict
errors and an infinite retry loop where transactions never reached a
terminal phase.

Fix: capture the returned object from the InProgress UpdateStatus so
subsequent calls use the correct resourceVersion.

Also adds better timeout diagnostics in e2e test helpers.

https://claude.ai/code/session_01QfFzqKQUsxxBsiZUhuJ3pG
This commit is contained in:
Claude 2026-02-28 04:09:56 +00:00
parent 32137c3bc4
commit 765007bb87
No known key found for this signature in database
2 changed files with 9 additions and 2 deletions

View file

@ -227,6 +227,7 @@ func waitForPushTransaction(t *testing.T, name string) *gitv1alpha1.GitPushTrans
ctx := context.Background()
deadline := time.Now().Add(pollTimeout)
var lastTxn *gitv1alpha1.GitPushTransaction
for time.Now().Before(deadline) {
txn, err := gitClient.GitPushTransactions(testNamespace).Get(ctx, name, metav1.GetOptions{})
if err != nil {
@ -234,6 +235,7 @@ func waitForPushTransaction(t *testing.T, name string) *gitv1alpha1.GitPushTrans
time.Sleep(pollInterval)
continue
}
lastTxn = txn
t.Logf("GitPushTransaction %q phase: %s", name, txn.Status.Phase)
switch txn.Status.Phase {
case gitv1alpha1.TransactionPhaseSucceeded:
@ -243,6 +245,9 @@ func waitForPushTransaction(t *testing.T, name string) *gitv1alpha1.GitPushTrans
}
time.Sleep(pollInterval)
}
if lastTxn != nil {
t.Logf("Last seen state: phase=%q message=%q resourceVersion=%s", lastTxn.Status.Phase, lastTxn.Status.Message, lastTxn.ResourceVersion)
}
t.Fatalf("timed out waiting for GitPushTransaction %q", name)
return nil
}