Files
open-cluster-management/test
Jian Zhu 72e2ded8cc 🐛 Fix flaky e2e test: addon CSR cleanup race condition (#1449)
## Problem
The addon management e2e test "Template type addon should be configured
by addon deployment config for proxy" fails intermittently with:
"Stop creating csr since there are too many csr created already on hub"

## Root Cause
Race condition between CSR deletion in AfterEach and API/cache consistency:
1. AfterEach deletes CSRs via API
2. Returns success immediately after Delete() calls succeed
3. Next test's BeforeEach starts before deletions fully propagate
4. CSR controller's indexer cache still shows deleted CSRs
5. haltAddonCSRCreation() checks cache, sees >=10 CSRs, halts creation

## Solution
Modified AfterEach CSR cleanup to verify deletions complete:
- After deleting CSRs, return error to force Eventually() to retry
- Only return success when List() confirms 0 CSRs remain
- Ensures API consistency before next test starts
- Added logging to show CSR cleanup count for debugging

This ensures the cache has time to sync and prevents accumulation
of phantom CSRs across ordered test runs.

Signed-off-by: Jian Zhu <jiazhu@redhat.com>
Signed-off-by: zhujian <jiazhu@redhat.com>
2026-03-18 01:34:12 +00:00
..
2026-01-27 10:26:32 +00:00
2026-03-17 03:41:06 +00:00
2026-01-27 10:26:32 +00:00
2024-04-11 01:39:23 +00:00
2023-06-13 05:21:07 -04:00