Skip to content

Implement test run retention cleanup - #223

Open
damilolaedwards wants to merge 1 commit into
ethpandaops:masterfrom
damilolaedwards:fix-test-retention-noop
Open

Implement test run retention cleanup#223
damilolaedwards wants to merge 1 commit into
ethpandaops:masterfrom
damilolaedwards:fix-test-retention-noop

Conversation

@damilolaedwards

Copy link
Copy Markdown

Summary

cleanupTestHistory was a stub that never removed anything, so every finished test run stayed in the in-memory run map for the life of the coordinator process. On a deployment that runs cron or startup-scheduled tests continuously, this pins an ever-growing set of schedulers, task states, and buffered loggers with no bound, and makes the testRetentionTime setting a no-op regardless of what it's set to.

This change prunes runs whose status is terminal (success, failure, aborted, or skipped) once they are older than the configured retention window, leaving pending and running tests untouched. Evicting a run only drops the in-memory reference; persisted results are unaffected. Coordinator.GetTestByRunID already falls back to loading a run straight from the database when it is missing from the in-memory map, so a run's detail page and logs keep working the same way after eviction, just served from the database instead of memory.

Test plan

  • Added a test that seeds the run map with old finished runs, a recent finished run, a running run, and a pending run, then asserts only the old finished ones are evicted.
  • Added a test confirming a zero retention window still evicts an already-finished run rather than being treated as disabled.
  • go build ./...
  • go vet ./...
  • go test ./pkg/assertoor/...

cleanupTestHistory was a stub that never removed anything, so every
finished test run stayed in the in-memory run map for the life of the
process. On a coordinator that runs cron or startup-scheduled tests
continuously, this pins an ever-growing set of schedulers, task
states, and buffered loggers with no way to bound it, and makes the
testRetentionTime setting a no-op.

Prune runs whose status is terminal (success, failure, aborted, or
skipped) once they are older than the configured retention window,
leaving pending and running tests untouched. This only drops the
in-memory reference; persisted results are unaffected and continue to
be served from the database once a run is no longer in the map, the
same fallback path the test history endpoint already relies on.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant