Commit 29113c2
committed
refactor(strongswan-connections): consolidate 3-file test fixtures into single JSON
The previous test-mode layout stored three separate files per
scenario (-possible_connection_keys, -active_connection_keys,
-list_sas) and the plugin manipulated args.TEST by hand before
passing it to lib.lftest.test():
lib.lftest.test([args.TEST[0] + '-possible_connection_keys',
args.TEST[1], args.TEST[2]])
That direct index access crashed with IndexError on the natural
--test=path invocation (no trailing commas), because args.TEST
only had one element. Manually padding also meant the plugin
bypassed lib.lftest.test's own defensive length handling.
Collapse the three fixture files into a single JSON object with
`list_conns` and `list_sas` keys, both holding the raw VICI
"list of single-key dicts" shape. The test-mode path now calls
lib.lftest.test(args.TEST) directly and derives both key lists
from the fixture via the same _collect_keys() helper the
production path uses, so the test and production paths cannot
drift and the active_connection_keys fixture that could be
out-of-sync with list_sas is gone.
User-facing effect:
strongswan-connections --test=stdout/all-connections-active
strongswan-connections --test=stdout/all-connections-active,,0
both now work, and the table + perfdata rendering that the old
fixtures silently skipped (because format_sas_data was reading
bytes from str fixtures and crashing into a swallowed except)
are finally exercised.
Dead-code cleanup: drop get_possible_connection_keys() and
get_active_connection_keys() wrappers that only existed to feed
the deleted three-file convention; production path calls
_collect_keys() directly on session.list_conns() and
list(session.list_sas()).1 parent 9fc0e78 commit 29113c2
File tree
21 files changed
+342
-306
lines changed- check-plugins/strongswan-connections
- unit-test/stdout
21 files changed
+342
-306
lines changedLines changed: 16 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | | - | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
130 | 132 | | |
131 | 133 | | |
132 | 134 | | |
| |||
135 | 137 | | |
136 | 138 | | |
137 | 139 | | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | 140 | | |
149 | 141 | | |
150 | 142 | | |
| |||
306 | 298 | | |
307 | 299 | | |
308 | 300 | | |
309 | | - | |
310 | | - | |
| 301 | + | |
311 | 302 | | |
312 | 303 | | |
313 | 304 | | |
314 | 305 | | |
315 | 306 | | |
316 | 307 | | |
317 | 308 | | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
330 | 321 | | |
331 | 322 | | |
332 | 323 | | |
| |||
Lines changed: 58 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 0 additions & 53 deletions
This file was deleted.
Lines changed: 0 additions & 1 deletion
This file was deleted.
0 commit comments