Skip to content

Meta: Unit test coverage for osism/ #2199

@berendt

Description

@berendt

Background

Follow-up to #2192 (foundation) and PR #2193 (pytest + Zuul CI). Once the test infrastructure has landed, actual unit test coverage has to be added module by module. This meta issue tracks the overall rollout plan so nothing gets lost and links all sub-issues.

Approach: start with pure-logic modules (fast feedback, no mocking), then move to mock-heavy helpers, tasks, services, API, and commands. Each sub-issue is self-contained and reviewable on its own.

Progress

Tier 1 — Pure logic (quick wins)

Tier 2 — Conductor helpers (pure logic + lightweight NetBox stubs)

Tier 3 — Conductor core (large modules, may split)

  • osism/tasks/conductor/sonic/interface.py (1.079 LOC)
  • osism/tasks/conductor/sonic/config_generator.py (2.201 LOC — likely two issues: base config + port/BGP/VLAN parts)
  • osism/tasks/conductor/sonic/{sync,exporter}.py
  • osism/tasks/conductor/{ironic,redfish}.py

Tier 4 — Utils package

  • osism/utils/__init__.py — Redis/NetBox/OpenStack clients, redlock, task-lock, task-output publisher
  • osism/utils/ssh.pyensure_known_hosts_file, get_host_identifiers, cleanup_ssh_known_hosts_for_node
  • osism/utils/rabbitmq.pyget_rabbitmq_node_addresses, subprocess mocks

Tier 5 — Tasks (non-conductor)

  • osism/tasks/__init__.pyConfig, get_container_version, run_ansible_in_environment, run_command, host-pattern parsing
  • osism/tasks/{ansible,ceph,kolla,kubernetes,reconciler}.py — thin task wrappers (combined issue)
  • osism/tasks/netbox.py
  • osism/tasks/openstack.py

Tier 6 — Services

  • osism/services/{websocket_manager,event_bridge}.pyEventMessage, filters, Redis bridge
  • osism/services/listener.pyBaremetalEvents state machine, exchange handling

Tier 7 — API

  • osism/api.py — utility functions + Pydantic models + inventory-secret masking
  • osism/api.py — endpoints (HTTP + WebSocket) via FastAPI TestClient

Tier 8 — Commands (CLI)

  • osism/main.py + entry point (OsismApp)
  • Task lifecycle: task, worker, reconciler, lock, service, container, configuration, set, noset
  • Workflow: apply, check, validate, wait, compose, sync, get, log, console
  • Hardware: baremetal, redfish, server, stress
  • OpenStack: compute, volume, manage, migrate, status, report, vault, amphora, octavia, loadbalancer
  • Network: netbox, sonic

Conventions for sub-issues

Out of scope here

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions