Commit 4d25456
test(resources): share top.sls + clear master state on minion teardown
Two interacting regressions in the test_dynamic_discovery and
test_custom_pillar_key fixtures surfaced when running the resources
smoke list end-to-end:
1. ``temp_file`` does not save/restore prior file contents — it just
writes on enter and deletes on exit. The new module-scoped fixtures
each wrote their own ``top.sls`` via ``temp_file``, which clobbered
the package-scoped dummy ``top.sls``. When the module fixture
exited, the file was removed and the outer dummy fixture had
nothing to fall back on. Subsequent tests saw no pillar.
Fix: a new ``_shared_pillar_top`` package-scoped fixture writes
``top.sls`` once with entries for every minion id the test package
may use. Per-minion fixtures only contribute their own SLS file.
Minions whose fixture isn't requested simply never start, so their
top.sls entries are inert.
2. The dynamic and custom-key minions register resources with the
master, then shut down at module teardown. Their ``resource_grains``
bank entries persist past shutdown because the registry is only
cleaned by re-registration. A later test querying
``-G dummy_grain_1:one`` then sees stale ``dummy:custom-01`` /
``dummy:custom-02`` and waits for dead minions ("Minion did not
return").
Fix: ``_clear_minion_resource_registration`` writes an empty pillar
SLS, runs ``saltutil.refresh_pillar`` on the dying minion so its
``_register_resources_with_master`` ships an empty dict, then sleeps
for the master to flush its bank entries. Wired into the
``salt_minion_dynamic`` and ``salt_minion_custom_pillar_key``
teardown ``finally`` blocks.
Separately, fix ``test_pillar_addition_at_runtime_registers_new_resource``
to mutate ``dummy_resources.sls`` in place (read + write) instead of
nesting ``temp_file``. The nested temp_file deleted the package
fixture's file on inner-exit, leaving the primary minion with no
pillar for the subsequent multi-minion test.
After these fixes the resources smoke list runs clean:
264 unit passed, 28 skipped; 27 integration passed, 1 skipped.1 parent fcf3395 commit 4d25456
2 files changed
Lines changed: 126 additions & 75 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
37 | 41 | | |
38 | 42 | | |
39 | 43 | | |
| |||
42 | 46 | | |
43 | 47 | | |
44 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
45 | 53 | | |
46 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
47 | 66 | | |
48 | 67 | | |
49 | 68 | | |
| |||
63 | 82 | | |
64 | 83 | | |
65 | 84 | | |
66 | | - | |
67 | 85 | | |
68 | 86 | | |
69 | 87 | | |
70 | 88 | | |
71 | 89 | | |
72 | 90 | | |
73 | | - | |
| 91 | + | |
74 | 92 | | |
75 | 93 | | |
76 | 94 | | |
| |||
235 | 253 | | |
236 | 254 | | |
237 | 255 | | |
238 | | - | |
239 | | - | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
240 | 270 | | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
245 | 277 | | |
246 | | - | |
247 | | - | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
248 | 290 | | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | 291 | | |
257 | 292 | | |
258 | 293 | | |
259 | 294 | | |
260 | 295 | | |
261 | 296 | | |
262 | 297 | | |
263 | | - | |
264 | | - | |
265 | | - | |
| 298 | + | |
266 | 299 | | |
267 | 300 | | |
268 | 301 | | |
| |||
287 | 320 | | |
288 | 321 | | |
289 | 322 | | |
290 | | - | |
| 323 | + | |
291 | 324 | | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
297 | 332 | | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | 333 | | |
306 | 334 | | |
307 | 335 | | |
| |||
312 | 340 | | |
313 | 341 | | |
314 | 342 | | |
315 | | - | |
316 | | - | |
317 | | - | |
| 343 | + | |
318 | 344 | | |
319 | 345 | | |
320 | 346 | | |
| |||
347 | 373 | | |
348 | 374 | | |
349 | 375 | | |
350 | | - | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
351 | 390 | | |
352 | 391 | | |
353 | 392 | | |
| |||
381 | 420 | | |
382 | 421 | | |
383 | 422 | | |
384 | | - | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
385 | 435 | | |
386 | 436 | | |
387 | 437 | | |
| |||
Lines changed: 30 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
359 | 359 | | |
360 | 360 | | |
361 | 361 | | |
362 | | - | |
363 | | - | |
364 | | - | |
365 | | - | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
366 | 366 | | |
367 | 367 | | |
368 | 368 | | |
369 | 369 | | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
370 | 373 | | |
371 | | - | |
| 374 | + | |
372 | 375 | | |
373 | 376 | | |
374 | 377 | | |
| |||
381 | 384 | | |
382 | 385 | | |
383 | 386 | | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | | - | |
390 | | - | |
391 | | - | |
392 | | - | |
393 | | - | |
394 | | - | |
395 | | - | |
396 | | - | |
397 | | - | |
398 | | - | |
399 | | - | |
400 | | - | |
401 | | - | |
402 | | - | |
403 | | - | |
404 | | - | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
405 | 406 | | |
406 | | - | |
407 | | - | |
408 | | - | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
409 | 410 | | |
410 | 411 | | |
411 | 412 | | |
0 commit comments