Skip to content

Integration test: check_ansible_facts freshness #2403

@berendt

Description

@berendt

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Ready

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions