Skip to content

test(cluster): raise scheduledbackups cleanup timeout to 10m#940

Closed
aqeelat wants to merge 1 commit into
cloudnative-pg:feat/barman-plugin-supportfrom
aqeelat:fix/scheduledbackups-cleanup-timeout
Closed

test(cluster): raise scheduledbackups cleanup timeout to 10m#940
aqeelat wants to merge 1 commit into
cloudnative-pg:feat/barman-plugin-supportfrom
aqeelat:fix/scheduledbackups-cleanup-timeout

Conversation

@aqeelat

@aqeelat aqeelat commented Jul 6, 2026

Copy link
Copy Markdown

The barman-plugin-scheduledbackups test intermittently fails with context deadline exceeded during cleanup. The test logic passes; only namespace teardown exceeds the 5m budget.

Root cause: the CNPG instance pod has terminationGracePeriodSeconds=1800 and graceful Postgres shutdown (bounded by smartShutdownTimeout ~180s) takes ~2–3m. On GitHub runners (kind-in-Docker on a constrained VM) that stretches past 5m under load. No stuck finalizer — Cluster and ObjectStore carry none (the plugin sets no ObjectStore finalizer).

Verified by reproducing on an isolated, well-resourced cluster: full cleanup completes in ~3m (pod teardown ~2m + namespace GC ~40s). The 5m budget is simply too tight for the slow-runner case.

Fix: raise cleanup: 5m → 10m. Shutdown is bounded by smartShutdownTimeout, so this will not grow unbounded; 10m gives safe headroom. Confirmed green in fork CI.

Supplements #924.

The barman-plugin-scheduledbackups test intermittently fails with
'context deadline exceeded' during cleanup. The test logic passes; the
failure is the namespace teardown exceeding the 5m cleanup budget.

Root cause: the CNPG instance pod has terminationGracePeriodSeconds=1800
and its graceful Postgres shutdown (bounded by smartShutdownTimeout ~180s)
takes ~2-3m. On GitHub runners (kind-in-Docker on a constrained VM) that
shutdown stretches past 5m under load, so the namespace finalization times
out. No finalizer is stuck (Cluster and ObjectStore carry none), and the
ObjectStore has no plugin finalizer.

Verified by reproducing on an isolated, well-resourced cluster: full cleanup
completes in ~3m (pod teardown ~2m + namespace GC ~40s). The 5m budget is
simply too tight for the slow-runner case.

Raise cleanup to 10m. The shutdown is bounded by smartShutdownTimeout, so
this won't grow unbounded; 10m gives safe headroom on GitHub runners.

Signed-off-by: Abdullah Alaqeel <abdullah.t.aqeel@gmail.com>
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jul 6, 2026
@aqeelat

aqeelat commented Jul 6, 2026

Copy link
Copy Markdown
Author

Closing in favor of a proper fix: set a low spec.stopDelay on the test cluster so the instance is force-stopped promptly at teardown (interrupting the still-running immediate backup) instead of waiting it out. The graceful shutdown is correct; it just doesn't need to complete a backup the test doesn't require. Will open a follow-up PR.

@aqeelat aqeelat closed this Jul 6, 2026
itay-grudev pushed a commit that referenced this pull request Jul 6, 2026
The barman-plugin-scheduledbackups test intermittently fails with
'context deadline exceeded' during cleanup. The chart forces immediate:
true on scheduled backups (templates/scheduled-backups.yaml), so a backup
is still running when cleanup starts; Barman blocks instance shutdown
until it completes, pushing teardown past the 5m cleanup budget on GitHub
runners.

Expose cluster.stopDelay in the chart (values + schema + template), mapping
to the CNPG Cluster spec.stopDelay, which also sets the pod's
terminationGracePeriodSeconds. The scheduledbackups test sets stopDelay: 30
so the instance is force-stopped promptly at teardown, interrupting the
still-running backup. That's acceptable because this test only verifies a
backup is started from the ScheduledBackup; backup success is covered by
barman-plugin-backup-restore.

Result: passes reliably and runs in ~75s (down from ~6m, previously timing
out). Verified green in fork CI. This is the 'help it clean up faster'
approach rather than raising the cleanup timeout.

Supersedes #940. Supplements #924.

Signed-off-by: Abdullah Alaqeel <abdullah.t.aqeel@gmail.com>
@aqeelat aqeelat deleted the fix/scheduledbackups-cleanup-timeout branch July 6, 2026 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant