Commit b770203
authored
fix(tests): create MinIO buckets from test to avoid flaky operator bu… (#882)
# Summary
The `e2e_om_ops_manager_backup_restore_minio` test continued to
experience intermittent failures even after PR #852 fixed the MinIO
operator's CA trust issue. The remaining flakiness was caused by a race
condition between the MinIO operator's bucket creation attempts and
MinIO's readiness to accept HTTPS connections.
**Why the MinIO operator still fails to create buckets (even with CA
trust fixed):**
Even though PR #852 resolved the x509 certificate trust issue by
providing the test CA to the MinIO operator, the operator still
occasionally fails with "connection refused" errors when attempting to
create buckets. This happens because:
1. The MinIO operator's reconcile loop triggers immediately after the
MinIO tenant pods become "Ready"
2. Pod readiness does not guarantee that MinIO is fully ready to accept
HTTPS connections
3. The operator attempts to create buckets via HTTPS API calls before
MinIO's TLS listener is fully initialized
4. This results in intermittent "connection refused" errors, causing
bucket creation to fail silently
The test then times out waiting for buckets that were never created.
**The fix:**
Instead of relying on the MinIO operator's timing-dependent bucket
creation, we now create the buckets directly from the test code using
boto3:
1. After the MinIO tenant pods are ready, call `_create_minio_buckets()`
which uses boto3's S3 client
2. Configure boto3 to use the test CA certificate for TLS verification
3. Implement retry logic (120s timeout, 5s intervals) to handle MinIO
startup timing
4. Check if buckets already exist (created by operator) or create them
via boto3
5. Log which method created each bucket for observability
This approach completely bypasses the operator's unreliable bucket
creation and makes the test deterministic.
## Proof of Work
5 independent test patches were run to verify the fix eliminates
flakiness:
| Patch # | Patch ID | Status | Build URL |
|---------|----------|--------|-----------|
| 1 | `69b02324c32e6b00075f770b` | ✅ Success (4/4) |
https://evergreen.mongodb.com/version/69b02324c32e6b00075f770b |
| 2 | `69b0232e8a5d860007735fc9` | ✅ Success (4/4) |
https://evergreen.mongodb.com/version/69b0232e8a5d860007735fc9 |
| 3 | `69b02339c03a4d00075eac0c` | ✅ Success (4/4) |
https://evergreen.mongodb.com/version/69b02339c03a4d00075eac0c |
| 4 | `69b02343f4bdb00007c3f6cd` | ✅ Success (4/4) |
https://evergreen.mongodb.com/version/69b02343f4bdb00007c3f6cd |
| 5 | `69b0234cc1f1690007bb9f21` | ✅ Success (4/4) |
https://evergreen.mongodb.com/version/69b0234cc1f1690007bb9f21 |
**Result: 20/20 tests passed (100% success rate)** all were created by
boto3
## Checklist
- [ ] Have you linked a jira ticket and/or is the ticket in the title?
- [ ] Have you checked whether your jira ticket required DOCSP changes?
- [x] Have you added changelog file?
- use `skip-changelog` label if not needed
- refer to [Changelog files and Release
Notes](https://github.com/mongodb/mongodb-kubernetes/blob/master/CONTRIBUTING.md#changelog-files-and-release-notes)
section in CONTRIBUTING.md for more details1 parent 2e92557 commit b770203
2 files changed
Lines changed: 26 additions & 33 deletions
File tree
- docker/mongodb-kubernetes-tests/tests/opsmanager
- fixtures/minio
Lines changed: 26 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
120 | | - | |
| 120 | + | |
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
126 | | - | |
| 125 | + | |
| 126 | + | |
127 | 127 | | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
| 128 | + | |
| 129 | + | |
135 | 130 | | |
136 | 131 | | |
137 | 132 | | |
138 | 133 | | |
139 | 134 | | |
140 | 135 | | |
141 | 136 | | |
142 | | - | |
| 137 | + | |
| 138 | + | |
143 | 139 | | |
144 | | - | |
145 | 140 | | |
146 | 141 | | |
147 | | - | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
148 | 145 | | |
149 | 146 | | |
150 | | - | |
151 | | - | |
| 147 | + | |
152 | 148 | | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
157 | 159 | | |
158 | 160 | | |
159 | 161 | | |
160 | | - | |
| 162 | + | |
161 | 163 | | |
162 | 164 | | |
163 | 165 | | |
| |||
214 | 216 | | |
215 | 217 | | |
216 | 218 | | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
221 | 222 | | |
222 | 223 | | |
223 | 224 | | |
| |||
Lines changed: 0 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | 112 | | |
121 | 113 | | |
122 | 114 | | |
| |||
0 commit comments