Commit 811646c
fix(tests): resolve integration test failures and improve test reliability
This commit addresses multiple critical issues in the integration test suite
that were causing CI failures:
**OpenAPI Validator Fixes:**
- Fix nil pointer dereference in ValidateCommonHeaders method by adding proper
null checks for response.Request before accessing URL properties
- Add missing OpenAPI specifications for 401 error responses on task endpoints
- Add missing endpoint specifications for /api/v1/tasks/{id} and health endpoints
- Update health endpoint paths from /api/v1/health to /health (correct paths)
**Database Test Isolation:**
- Fix UTF-8 encoding error by replacing string(rune(i)) with fmt.Sprintf("%d", i)
in bulk operations test to prevent null byte insertion
- Remove unused manual cleanup method that could cause confusion
- Improve database constraint violation handling
**Authentication Token Issues:**
- Refactor contract tests to create fresh users per test instead of suite-level user
- Fix "user not found" errors by ensuring tokens reference existing users
- Update makeAuthenticatedRequest to accept token parameter for better test isolation
- Remove suite-level testUser and accessToken fields for cleaner test design
**Test Reliability Improvements:**
- Each contract test now creates its own authenticated user to prevent cross-test
contamination from database cleanup
- Fixed health endpoint tests to use correct paths (/health, /ready)
- Enhanced error handling and validation in OpenAPI contract tests
These fixes resolve the nil pointer panics, foreign key constraint violations,
UTF-8 encoding errors, and authentication issues that were preventing the
integration test suite from passing in CI.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent c3c9f39 commit 811646c
3 files changed
Lines changed: 134 additions & 39 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | | - | |
33 | 31 | | |
34 | 32 | | |
35 | 33 | | |
| |||
65 | 63 | | |
66 | 64 | | |
67 | 65 | | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | 66 | | |
72 | 67 | | |
73 | 68 | | |
| |||
85 | 80 | | |
86 | 81 | | |
87 | 82 | | |
88 | | - | |
89 | | - | |
| 83 | + | |
| 84 | + | |
90 | 85 | | |
91 | 86 | | |
92 | | - | |
| 87 | + | |
93 | 88 | | |
94 | 89 | | |
95 | 90 | | |
| |||
109 | 104 | | |
110 | 105 | | |
111 | 106 | | |
112 | | - | |
113 | | - | |
| 107 | + | |
114 | 108 | | |
115 | 109 | | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
133 | 113 | | |
134 | 114 | | |
| 115 | + | |
135 | 116 | | |
136 | 117 | | |
137 | 118 | | |
| |||
161 | 142 | | |
162 | 143 | | |
163 | 144 | | |
164 | | - | |
| 145 | + | |
165 | 146 | | |
166 | | - | |
| 147 | + | |
167 | 148 | | |
168 | 149 | | |
169 | 150 | | |
| |||
267 | 248 | | |
268 | 249 | | |
269 | 250 | | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
270 | 254 | | |
271 | 255 | | |
272 | 256 | | |
| |||
276 | 260 | | |
277 | 261 | | |
278 | 262 | | |
279 | | - | |
| 263 | + | |
280 | 264 | | |
281 | 265 | | |
282 | 266 | | |
| |||
297 | 281 | | |
298 | 282 | | |
299 | 283 | | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
300 | 287 | | |
301 | 288 | | |
302 | 289 | | |
303 | 290 | | |
304 | 291 | | |
305 | 292 | | |
306 | 293 | | |
307 | | - | |
| 294 | + | |
308 | 295 | | |
309 | 296 | | |
310 | 297 | | |
311 | 298 | | |
312 | 299 | | |
313 | 300 | | |
314 | | - | |
| 301 | + | |
315 | 302 | | |
316 | 303 | | |
317 | 304 | | |
| |||
344 | 331 | | |
345 | 332 | | |
346 | 333 | | |
347 | | - | |
| 334 | + | |
348 | 335 | | |
349 | 336 | | |
350 | 337 | | |
| |||
359 | 346 | | |
360 | 347 | | |
361 | 348 | | |
362 | | - | |
| 349 | + | |
363 | 350 | | |
364 | 351 | | |
365 | 352 | | |
| |||
391 | 378 | | |
392 | 379 | | |
393 | 380 | | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
394 | 384 | | |
395 | 385 | | |
396 | 386 | | |
397 | 387 | | |
398 | | - | |
| 388 | + | |
399 | 389 | | |
400 | 390 | | |
401 | 391 | | |
| |||
413 | 403 | | |
414 | 404 | | |
415 | 405 | | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
416 | 409 | | |
417 | 410 | | |
418 | | - | |
| 411 | + | |
419 | 412 | | |
420 | 413 | | |
421 | 414 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
414 | 414 | | |
415 | 415 | | |
416 | 416 | | |
417 | | - | |
| 417 | + | |
418 | 418 | | |
419 | 419 | | |
420 | 420 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
199 | 213 | | |
200 | 214 | | |
201 | 215 | | |
| |||
219 | 233 | | |
220 | 234 | | |
221 | 235 | | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
222 | 250 | | |
223 | 251 | | |
224 | 252 | | |
225 | | - | |
| 253 | + | |
226 | 254 | | |
227 | 255 | | |
228 | 256 | | |
| |||
243 | 271 | | |
244 | 272 | | |
245 | 273 | | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
246 | 348 | | |
247 | 349 | | |
248 | 350 | | |
| |||
465 | 567 | | |
466 | 568 | | |
467 | 569 | | |
468 | | - | |
| 570 | + | |
469 | 571 | | |
470 | 572 | | |
471 | 573 | | |
| |||
0 commit comments