Skip to content

Add unit tests for OpenStack command group#2481

Open
berendt wants to merge 5 commits into
mainfrom
unit-tests-openstack-commands
Open

Add unit tests for OpenStack command group#2481
berendt wants to merge 5 commits into
mainfrom
unit-tests-openstack-commands

Conversation

@berendt

@berendt berendt commented Jul 17, 2026

Copy link
Copy Markdown
Member

Closes #2365

Adds unit tests for the OpenStack-facing CLI command group under osism/commands/, following the test targets listed in the issue.

New test files:

  • tests/unit/commands/test_migrate.pyRabbitmq3to4: kolla configuration validation, vhost preparation, queue/exchange classification, connection draining, deletion helpers, and the check/list/delete subcommand wiring including dry-run and error paths.
  • tests/unit/commands/test_octavia.py — both amphora wait helpers (poll loops, timeout bounds, query arguments).
  • tests/unit/commands/test_amphora.pyAmphoraRestore and AmphoraRotate including cleanup on failover errors, age-based rotation, and ConflictException handling.
  • tests/unit/commands/test_loadbalancer.py — configuration/password loaders, database status resets (exact SQL), and the list/reset/delete commands with prompt, failover, and finally cleanup handling.
  • tests/unit/commands/test_manage_commands.py — Celery .si(...) signature assembly for the image, flavor, dnsmasq, and project manage commands.

Extended test files:

  • test_compute.py — enable/disable, listing with project/domain filters and uptime details, live/cold migration classification and polling, migration list query assembly, start/stop eligibility, evacuation.
  • test_volume.py — stuck-volume listing across all five queried statuses and the VolumeRepair sequences.
  • test_status.pydisplay_time, Galera health checks, Database/Messaging in both log and script formats, RabbitMQ overview/alarm/partition parsing.
  • test_report.py — per-host processing for Memory, Lldp, Bgp, and Status including failure bookkeeping.
  • test_vault.pySetPassword/UnsetPassword and the Check failure chain with a real Fernet key round-trip.

Deviations from the issue text (the code moved on since it was written): loadbalancer.py and status.py now delegate database connections to osism.utils.mariadb.connect instead of calling pymysql.connect directly (the proxysql shard-user selection lives there), and report bgp --afi rejects invalid casing via argparse choices before take_action runs. Tests assert against the current code.

🤖 Generated with Claude Code

sourcery-ai[bot]

This comment was marked as off-topic.

@berendt
berendt force-pushed the unit-tests-openstack-commands branch from 683c99a to 88c7254 Compare July 17, 2026 13:21
berendt added 5 commits July 17, 2026 17:04
Cover the Rabbitmq3to4 command: kolla configuration validation, vhost
preparation, queue and exchange classification, connection draining,
deletion helpers, and the check/list/delete subcommand wiring including
dry-run and error paths.

Assisted-by: Claude:claude-fable-5
Signed-off-by: Christian Berendt <berendt@osism.tech>
Cover the amphora wait helpers (boot and delete polling loops), amphora
restore and rotate flows including cleanup on failover errors, and the
loadbalancer configuration loaders, database status resets, and the
list/reset/delete commands with prompt and failover handling.

Assisted-by: Claude:claude-fable-5
Signed-off-by: Christian Berendt <berendt@osism.tech>
Add coverage for compute service enable/disable, instance listing with
project and domain filters, live and cold migration classification and
polling, migration list query assembly, start/stop eligibility,
evacuation, stuck volume listing, and the volume repair sequences.

Assisted-by: Claude:claude-fable-5
Signed-off-by: Christian Berendt <berendt@osism.tech>
Add coverage for display_time, the Galera health checks, database and
messaging status commands in log and script formats, RabbitMQ overview
parsing with alarms and partitions, and the per-host memory, LLDP, BGP
and bootstrap status report processing.

Assisted-by: Claude:claude-fable-5
Signed-off-by: Christian Berendt <berendt@osism.tech>
Assert the Celery task signatures built by the image, flavor, dnsmasq
and project manage commands, and cover vault password set/unset and the
vault check failure chain including the Fernet key round-trip.

Assisted-by: Claude:claude-fable-5
Signed-off-by: Christian Berendt <berendt@osism.tech>
@berendt
berendt force-pushed the unit-tests-openstack-commands branch from 88c7254 to f405b5f Compare July 17, 2026 15:04
@berendt berendt moved this from New to In progress in Human Board Jul 17, 2026
@berendt berendt moved this from In progress to Ready for review in Human Board Jul 17, 2026
@berendt
berendt requested a review from ideaship July 17, 2026 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Ready for review

Development

Successfully merging this pull request may close these issues.

Unit tests for osism/commands/ — OpenStack (compute, volume, manage, migrate, status, report, vault, amphora, octavia, loadbalancer)

2 participants