Commit 0697ae1
committed
Fix flaky test: automatic host removal job crashes on sites without login secret
The execute_host_removal_job cron job (running every minute in the
ui-job-scheduler) builds its automation_configs dict by iterating over
wato_site_ids(), which includes all remote sites with replication enabled
regardless of whether they have a login secret.
During composition tests, this creates a race window:
between the REST API call that creates a new
site connection (sites.create() writes site config to disk without a
secret) and the subsequent login call (sites.login() adds the secret),
the site is visible to the scheduler but has no secret. If the cron job
fires in that window records a crash report.
The composition tests detects this crash report in teardown and fails.
The failure is flaky because whether the cron job
coincides with the setup window is non-deterministic.
Every other cron job that contacts remote sites (execute_sync_remote_sites,
execute_host_label_sync_job) already guards against this by filtering
through sites_ready_for_remote_automation(), which requires "secret" to
be present. Apply the same guard to execute_host_removal_job by skipping
any site that is neither local nor has a secret configured.
Change-Id: Idb73bf0755eeb157a2969f438918ed7bd0bd44121 parent 57a1f32 commit 0697ae1
2 files changed
Lines changed: 9 additions & 8 deletions
File tree
- cmk/gui/watolib
- tests/unit/cmk/gui/watolib
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
28 | 31 | | |
29 | 32 | | |
30 | 33 | | |
| |||
70 | 73 | | |
71 | 74 | | |
72 | 75 | | |
73 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
74 | 80 | | |
75 | 81 | | |
76 | 82 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | 61 | | |
67 | 62 | | |
68 | 63 | | |
| |||
0 commit comments