Skip to content

Convert the test suite into a Python package - #24

Merged
openshift-merge-bot[bot] merged 1 commit into
openstack-k8s-operators:mainfrom
jancervenka:move-tests-to-python-package
Nov 9, 2026
Merged

openshift-merge-bot[bot] merged 1 commit into
openstack-k8s-operators:mainfrom
jancervenka:move-tests-to-python-package

Conversation

@jancervenka

@jancervenka jancervenka commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Move the tests/ directory inside the lightspeed-tests Python package and add a CLI entrypoint called lightspeed-tests for running the tests.

The CLI entrypoint doesn support --config argument right now, there is a separate ticket for adding this option.

@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • New Features
    • Install and run the test suite using the lightspeed-tests command or its lightspeed-test alias.
    • The command includes a default configuration and supports selecting tests, previewing test collection, and saving JUnit results.
  • Documentation
    • Updated setup and test guidance for Python 3.12, including configuration overrides and prerequisites for integration and model-dependent tests.
    • Updated playbook guidance to use the new test command.

The package adds lightspeed-tests and lightspeed-test commands that run pytest with package-level configuration. The default YAML configuration and tests now reside in the package. The README and playbook instructions use the new commands.

Changes: Lightspeed test runner

Layer / File(s) Summary
Package runner and test discovery
pyproject.toml, src/rhos_lightspeed_tests/*, src/rhos_lightspeed_tests/tests/integration/*
The project registers two console commands. main() runs pytest with the package configuration and returns its exit status. Pytest settings and the default YAML file move into the package, and the Ruff ignore pattern follows the new test path.
Runner usage and configuration documentation
README.md, playbooks/README.md, playbooks/run_lightspeed_tests.yaml, src/rhos_lightspeed_tests/tests/integration/test_goose_responses.py
The README documents installation, configuration, test selection, and test prerequisites. The playbook and Goose test instructions use lightspeed-tests.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant lightspeed-tests
  participant rhos_lightspeed_tests.main
  participant pytest
  User->>lightspeed-tests: Run command with arguments
  lightspeed-tests->>rhos_lightspeed_tests.main: Invoke entry point
  rhos_lightspeed_tests.main->>pytest: Pass package config, root directory, pyargs, and arguments
  pytest-->>rhos_lightspeed_tests.main: Return exit status
Loading

Suggested reviewers: omkarjoshi0304

Merge Risk: Minimal · up to 53d9f

No actionable merge-blocking risk remains in the reviewed changes.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly describes the main change: moving the test suite into the Python package and providing a package-based test structure.
Description check Passed The description directly explains the test-suite relocation and the new lightspeed-tests CLI entrypoint. It also notes the current --config limitation.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 3 files. (5 skipped: 5 unsupported.)

Finishing Touches
Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Central YAML (base), Organization UI (inherited)
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 9bced751-742c-4c7f-b1fc-e3f4a44429ef
Commits

Reviewing files that changed from the base of the PR and between da653da and 53d9f30.

Files selected for processing: 17
  • README.md
  • playbooks/README.md
  • playbooks/run_lightspeed_tests.yaml
  • pyproject.toml
  • src/rhos_lightspeed_tests/__init__.py
  • src/rhos_lightspeed_tests/config.py
  • src/rhos_lightspeed_tests/default.yaml
  • src/rhos_lightspeed_tests/pytest.ini
  • src/rhos_lightspeed_tests/tests/__init__.py
  • src/rhos_lightspeed_tests/tests/conftest.py
  • src/rhos_lightspeed_tests/tests/e2e/__init__.py
  • src/rhos_lightspeed_tests/tests/integration/__init__.py
  • src/rhos_lightspeed_tests/tests/integration/test_goose_responses.py
  • src/rhos_lightspeed_tests/tests/integration/test_metrics_endpoint.py
  • src/rhos_lightspeed_tests/tests/integration/test_okp_virtualization_filter.py
  • src/rhos_lightspeed_tests/tests/integration/test_query_endpoint.py
  • tests/unit/__init__.py
Files with no reviewable changes: 9
  • src/rhos_lightspeed_tests/tests/integration/test_query_endpoint.py
  • src/rhos_lightspeed_tests/tests/init.py
  • src/rhos_lightspeed_tests/tests/integration/test_okp_virtualization_filter.py
  • src/rhos_lightspeed_tests/tests/e2e/init.py
  • src/rhos_lightspeed_tests/tests/conftest.py
  • src/rhos_lightspeed_tests/tests/integration/init.py
  • src/rhos_lightspeed_tests/tests/integration/test_metrics_endpoint.py
  • src/rhos_lightspeed_tests/default.yaml
  • tests/unit/init.py
Files skipped from review as they are similar to previous changes: 1
  • playbooks/README.md

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

@jancervenka
jancervenka force-pushed the move-tests-to-python-package branch 2 times, most recently from 222b10e to 5ffa2d9 Compare November 3, 2026 08:04
@jancervenka
jancervenka marked this pull request as ready for review November 3, 2026 08:04

@coderabbitai coderabbitai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Fix comments: Fix CodeRabbit comments on this PR

Comment thread src/rhos_lightspeed_tests/__init__.py Resolved
@jancervenka
jancervenka force-pushed the move-tests-to-python-package branch from 5ffa2d9 to da653da Compare November 3, 2026 09:11

@lpiwowar lpiwowar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM, thank you! 🎉 Couple of non-blocking comments, plus I think @malingatembo should take a look since there is a slight chance it might have an impact on the job he introduced in openstack-k8s-operators/lightspeed-operator. I think it should be alright but one never knows I guess. I suggest waiting for his ack.

Comment thread README.md Resolved
Move the tests/ directory inside the lightspeed-tests
Python package and add a CLI entrypoint for running the tests.
@malingatembo

Copy link
Copy Markdown
Collaborator

@jancervenka , I have reviewed the PR and it looks good. 🥳 Our ci job passes test/integration, which would break with the new layout.
I have raised on PR [1] on our operator to replace test/integration with -k integration. I'll ask to have the change on the operator merged and then test the result of the the PRs in zuul.

[1] openstack-k8s-operators/lightspeed-operator#153

openshift-merge-bot Bot pushed a commit to openstack-k8s-operators/lightspeed-operator that referenced this pull request Nov 9, 2026
Update the CI job to use -k integration instead of hardcoding it to
tests/integration so our tests don't break when Jan's packaging PR
(openstack-k8s-operators/lightspeed-tests#24)
merges. The tests in Jan's PR are moving into the Python package itself,
therefore looking for the old root directory will fail. This PR switches
to keyword filtering to grab the exact same tests across both the old
and new layouts.

Signed-off-by: malingatembo <tembomalinga@gmail.com>

@lpiwowar lpiwowar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@lpiwowar

lpiwowar commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

/approve

Adding /approve since @jancervenka is in approvers. It should have been assigned automatically.

@openshift-ci

openshift-ci Bot commented Nov 9, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jancervenka, lpiwowar

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [jancervenka,lpiwowar]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the approved label Nov 9, 2026
@openshift-merge-bot
openshift-merge-bot Bot merged commit ba1b358 into openstack-k8s-operators:main Nov 9, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants