Marco Ricci commited on 2024-12-12 11:59:47
Zeige 1 geänderte Dateien mit 44 Einfügungen und 3 Löschungen.
Using larger numbers of settings (and services) leads to a very low probability of actually finding a viable path of action in the state machine; the run is a no-op, save for the initial setup. Presumably, we need a larger pool of readily-assembled and/or more cross-compatible objects, instead of the stepwise approach employed here with service names, settings, and configurations. This needs to be addressed in a future commit, however.
... | ... |
@@ -2390,12 +2390,53 @@ class ConfigMergingStateMachine(stateful.RuleBasedStateMachine): |
2390 | 2390 |
target=settings, |
2391 | 2391 |
settings_list=strategies.lists( |
2392 | 2392 |
tests.vault_full_service_config(), |
2393 |
- min_size=10, |
|
2394 |
- max_size=10, |
|
2393 |
+ min_size=5, |
|
2394 |
+ max_size=5, |
|
2395 | 2395 |
unique_by=lambda obj: json.dumps(obj, sort_keys=True), |
2396 | 2396 |
), |
2397 | 2397 |
) |
2398 |
- def init_random_settings( |
|
2398 |
+ def init_random_full_settings( |
|
2399 |
+ self, settings_list: list[_types.VaultConfigGlobalSettings] |
|
2400 |
+ ) -> Iterable[_types.VaultConfigGlobalSettings]: |
|
2401 |
+ return stateful.multiple(*settings_list) |
|
2402 |
+ |
|
2403 |
+ @staticmethod |
|
2404 |
+ def build_reduced_vault_config_settings( |
|
2405 |
+ config: _types.VaultConfigGlobalSettings, |
|
2406 |
+ keys_to_purge: frozenset[str], |
|
2407 |
+ ) -> _types.VaultConfigGlobalSettings: |
|
2408 |
+ config2 = copy.deepcopy(config) |
|
2409 |
+ for key in keys_to_purge: |
|
2410 |
+ config2.pop(key, None) # type: ignore[misc] |
|
2411 |
+ return config2 |
|
2412 |
+ |
|
2413 |
+ # See comment on `init_random_full_settings`. |
|
2414 |
+ @stateful.initialize( |
|
2415 |
+ target=settings, |
|
2416 |
+ settings_list=strategies.lists( |
|
2417 |
+ strategies.builds( |
|
2418 |
+ build_reduced_vault_config_settings, |
|
2419 |
+ tests.vault_full_service_config(), |
|
2420 |
+ strategies.sets( |
|
2421 |
+ strategies.sampled_from([ |
|
2422 |
+ 'length', |
|
2423 |
+ 'repeat', |
|
2424 |
+ 'upper', |
|
2425 |
+ 'lower', |
|
2426 |
+ 'number', |
|
2427 |
+ 'space', |
|
2428 |
+ 'dash', |
|
2429 |
+ 'symbol', |
|
2430 |
+ ]), |
|
2431 |
+ max_size=7, |
|
2432 |
+ ), |
|
2433 |
+ ), |
|
2434 |
+ min_size=5, |
|
2435 |
+ max_size=5, |
|
2436 |
+ unique_by=lambda obj: json.dumps(obj, sort_keys=True), |
|
2437 |
+ ).filter(bool), |
|
2438 |
+ ) |
|
2439 |
+ def init_random_partial_settings( |
|
2399 | 2440 |
self, settings_list: list[_types.VaultConfigGlobalSettings] |
2400 | 2441 |
) -> Iterable[_types.VaultConfigGlobalSettings]: |
2401 | 2442 |
return stateful.multiple(*settings_list) |
2402 | 2443 |