Commit a769f15
authored
fix(tests/Bigtable): implement uuid-based isolation and reliable resource cleanup (#2880)
## Description
- **UUID-based Isolation**: Refactored the Bigtable integration tests to
generate a single `uniqueID` at the start of the test run, which is used
as a suffix for all temporary table names.
- **Centralized Cleanup Utility**: Added the `CleanupBigtableTables`
function to `tests/common.go` to identify and delete all tables matching
the specific `uniqueID`.
- **Reliable Teardown**: Replaced `defer` calls with the `t.Cleanup`
hook and `context.Background()` to ensure that test-specific tables are
consistently removed, even if the test fails or times out.
**Why it was required**:
- **Prevent Resource leaks**: Previous test runs frequently leaked
tables when teardown logic was interrupted, leading to significant
clutter in the toolbox-testing-438616 project.
- **Resource Limit Near-Exhaustion**: The Bigtable instance was found to
have **876** tables currently in use, approaching the standard cloud
limit of **1,000 tables**. This cleanup is critical to maintain the
health of the shared testing environment.
- **Enable Concurrency**: Strict isolation ensures that parallel builds
in CI/CD do not interfere with or accidentally delete resources
belonging to other active test runs.
Reference Doc -
[https://docs.google.com/document/d/1LzOVRhuwU6z88FFE5ocyJ_7MIhY0kdpRFnuqU_yYAPg/edit?resourcekey=0-dcyFbd8jFgPgULqmeUlRjQ&tab=t.1rq6wvhsf9yn](https://docs.google.com/document/d/1LzOVRhuwU6z88FFE5ocyJ_7MIhY0kdpRFnuqU_yYAPg/edit?resourcekey=0-dcyFbd8jFgPgULqmeUlRjQ&tab=t.1rq6wvhsf9yn
)
> Should include a concise description of the changes (bug or feature),
it's
> impact, along with a summary of the solution
## PR Checklist
> Thank you for opening a Pull Request! Before submitting your PR, there
are a
> few things you can do to make sure it goes smoothly:
- [ ] Make sure you reviewed
[CONTRIBUTING.md](https://github.com/googleapis/genai-toolbox/blob/main/CONTRIBUTING.md)
- [ ] Make sure to open an issue as a
[bug/issue](https://github.com/googleapis/genai-toolbox/issues/new/choose)
before writing your code! That way we can discuss the change, evaluate
designs, and agree on the general idea
- [ ] Ensure the tests and linter pass
- [ ] Code coverage does not decrease (if any source code was changed)
- [ ] Appropriate docs were updated (if necessary)
- [ ] Make sure to add `!` if this involve a breaking change
🛠️ Fixes #<issue_number_goes_here>1 parent ddf409d commit a769f15
2 files changed
Lines changed: 59 additions & 35 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
68 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
72 | | - | |
73 | | - | |
74 | | - | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
75 | 94 | | |
76 | 95 | | |
77 | 96 | | |
| |||
85 | 104 | | |
86 | 105 | | |
87 | 106 | | |
88 | | - | |
89 | | - | |
| 107 | + | |
90 | 108 | | |
91 | 109 | | |
92 | 110 | | |
93 | 111 | | |
94 | | - | |
95 | | - | |
| 112 | + | |
96 | 113 | | |
97 | 114 | | |
98 | | - | |
99 | | - | |
| 115 | + | |
100 | 116 | | |
101 | 117 | | |
102 | 118 | | |
| |||
225 | 241 | | |
226 | 242 | | |
227 | 243 | | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
| 244 | + | |
234 | 245 | | |
235 | 246 | | |
236 | 247 | | |
237 | | - | |
| 248 | + | |
238 | 249 | | |
239 | 250 | | |
240 | 251 | | |
241 | 252 | | |
242 | 253 | | |
243 | 254 | | |
244 | | - | |
| 255 | + | |
245 | 256 | | |
246 | 257 | | |
247 | 258 | | |
248 | | - | |
| 259 | + | |
249 | 260 | | |
250 | | - | |
| 261 | + | |
251 | 262 | | |
252 | 263 | | |
253 | 264 | | |
254 | 265 | | |
255 | 266 | | |
256 | | - | |
| 267 | + | |
257 | 268 | | |
258 | 269 | | |
259 | 270 | | |
260 | 271 | | |
261 | 272 | | |
262 | | - | |
| 273 | + | |
263 | 274 | | |
264 | 275 | | |
265 | 276 | | |
266 | 277 | | |
267 | 278 | | |
268 | 279 | | |
269 | | - | |
| 280 | + | |
270 | 281 | | |
271 | 282 | | |
272 | 283 | | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
| 284 | + | |
283 | 285 | | |
284 | | - | |
| 286 | + | |
285 | 287 | | |
286 | 288 | | |
287 | 289 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
1102 | 1103 | | |
1103 | 1104 | | |
1104 | 1105 | | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
0 commit comments