Add unit tests for osism/tasks thin task wrappers#2438
Merged
Conversation
Cover app config/queue routing, the setup_periodic_tasks receivers,
and the run/gather_facts/noop/run_on_change task bodies of
osism/tasks/{ansible,ceph,kolla,kubernetes,reconciler}.py. All
external effects -- the ansible runner, the Redis locks, the
subprocess call and the task-output stream -- are mocked, so the
tests need neither a broker nor a reachable Redis.
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Christian Berendt <berendt@osism.tech>
ideaship
approved these changes
Jul 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2354
Summary
Adds a unit-test suite for the thin task wrappers in
osism/tasks/{ansible,ceph,kolla,kubernetes,reconciler}.py. These modules are the Celery entry points that mostly delegate into the ansible runner, the Redis task locks, a subprocess call, and the task-output stream. The suite exercises that glue with every external effect mocked, so the tests need neither a broker nor a reachable Redis.Change set
A single commit,
7d892fc Add unit tests for osism/tasks thin task wrappers, adds one new file:tests/unit/tasks/test_task_wrappers.py(535 lines)The tests are grouped by concern:
setup_periodic_tasksreceivers — schedules when the Redis lock is acquired, skips when scheduling is disabled, skips when the lock is not acquired, and the no-op receiver.ansibletask bodies —gather_factsdelegates with defaults and forwardspublish=False;rundelegates with defaults, forwards its arguments, and aborts when the task lock is active;noopreturnsTrue.runbodies — parametrized acrosskolla/kubernetes/ceph: delegates with defaults, forwards overrides, and aborts when the task lock is active.reconciler.run— aborts when the task lock is active, returnsNonewhen the lock is not acquired, publishes output, skips output when publishing is off, and warns when the lock was already released.run_on_change— returnsNonewhen the lock is not acquired, runs the script without publishing, and warns when the lock was already released.Notes for the reviewer
osism/tasks/*modules and theirrun/gather_facts/noop/run_on_changebodies plus the app config and periodic-task wiring. No divergence from the issue.Implemented by planwerk-agent 4c14036 with Claude:claude-opus-4-8