Part of #2400. Follow-up to #2368.
What
Cover osism.utils.check_ansible_facts() (osism/utils/__init__.py:563) against live Redis. It uses a real SCAN cursor over ansible_facts* keys and inspects ansible_date_time.epoch to decide staleness, emitting loguru warnings.
Scope
- No
ansible_facts* keys present → warns "No Ansible facts found ...".
- Fresh facts (recent epoch) → no stale-host warning.
- Stale facts (epoch older than
max_age) → host reported as stale.
- Facts without
ansible_date_time.epoch → skipped (debug), no crash.
- Malformed JSON value → handled gracefully.
Where
New file tests/integration/test_facts.py. Seed keys directly via the Redis client (ansible_facts<host> → JSON). Assert on log output using the existing loguru_logs fixture (see tests/conftest.py); it may need to be made available to the integration suite. Clean up seeded keys at the end of each test.
Part of #2400. Follow-up to #2368.
What
Cover
osism.utils.check_ansible_facts()(osism/utils/__init__.py:563) against live Redis. It uses a realSCANcursor overansible_facts*keys and inspectsansible_date_time.epochto decide staleness, emitting loguru warnings.Scope
ansible_facts*keys present → warns "No Ansible facts found ...".max_age) → host reported as stale.ansible_date_time.epoch→ skipped (debug), no crash.Where
New file
tests/integration/test_facts.py. Seed keys directly via the Redis client (ansible_facts<host>→ JSON). Assert on log output using the existingloguru_logsfixture (seetests/conftest.py); it may need to be made available to the integration suite. Clean up seeded keys at the end of each test.