Skip to content

Conversation

ArtiomDivak
Copy link
Collaborator

@ArtiomDivak ArtiomDivak commented Jul 27, 2025

  • Replace qmctl_cp.sh with qmctl_cp_bidirectional.sh for better test coverage
  • Replace qmctl_show.sh with qmctl_show_variants.sh for more comprehensive testing
  • Add dedicated qmctl_error_handling.sh and qmctl_json_output.sh test scripts
  • Update existing qmctl_exec.sh and qmctl_execin.sh test scripts
  • Enhance test utilities in tests/e2e/lib/utils with improved test framework
  • Update main test runner test_qmctl.sh to use new script structure

Closes #870

Summary by Sourcery

Refactor and expand end-to-end qmctl test suite to improve coverage and test framework support

New Features:

  • Add comprehensive bi-directional copy tests with qmctl_cp_bidirectional.sh
  • Add varied show command tests with qmctl_show_variants.sh
  • Add dedicated error handling tests with qmctl_error_handling.sh
  • Add JSON output validation tests with qmctl_json_output.sh

Enhancements:

  • Refactor qmctl_exec.sh and qmctl_execin.sh for container lifecycle management, cleanup, and messaging
  • Update test runner (test_qmctl.sh) to orchestrate new script structure
  • Enhance shared test utilities in tests/e2e/lib/utils for improved framework support

Tests:

  • Replace original qmctl_cp.sh and qmctl_show.sh with expanded variants to cover more scenarios

Copy link
Contributor

sourcery-ai bot commented Jul 27, 2025

Reviewer's Guide

This PR overhauls the qmctl end-to-end test suite by reorganizing and expanding test scripts, standardizing utility functions, and updating the main runner to leverage the new structure. It replaces and introduces dedicated scripts for copy, show, JSON output, and error handling, refactors existing exec/execin tests with robust setup and cleanup, and integrates these into a unified framework.

File-Level Changes

Change Details Files
Replaced and added dedicated test scripts for comprehensive coverage
  • Replaced qmctl_cp.sh with qmctl_cp_bidirectional.sh
  • Replaced qmctl_show.sh with qmctl_show_variants.sh
  • Added qmctl_error_handling.sh and qmctl_json_output.sh
  • Removed deprecated scripts qmctl_cp.sh and qmctl_show.sh
tests/qmctl-test/scripts/qmctl_cp_bidirectional.sh
tests/qmctl-test/scripts/qmctl_show_variants.sh
tests/qmctl-test/scripts/qmctl_error_handling.sh
tests/qmctl-test/scripts/qmctl_json_output.sh
tests/qmctl-test/scripts/qmctl_cp.sh (deleted)
tests/qmctl-test/scripts/qmctl_show.sh (deleted)
Enhanced existing test scripts with robust container lifecycle management and unified messaging
  • Parameterized container name and ensured creation, startup, cleanup in qmctl_execin.sh
  • Cleaned up pre-existing containers, added info/fail/pass messaging in qmctl_exec.sh
  • Replaced raw echo statements with info_message/fail_message/pass_message
tests/qmctl-test/scripts/qmctl_execin.sh
tests/qmctl-test/scripts/qmctl_exec.sh
Updated main test runner to orchestrate new script structure
  • Swapped old script calls to new variants in test_qmctl.sh
  • Added invocations for JSON and error-handling tests
  • Standardized failure and success reporting via fail_message and pass_message
tests/qmctl-test/test_qmctl.sh
Improved end-to-end utility library with standardized test functions
  • Introduced run_test helper for consistent test execution
  • Unified info_message, pass_message, fail_message across scripts
  • Streamlined temp file handling and exit-code assertions
tests/e2e/lib/utils

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @ArtiomDivak - I've reviewed your changes - here's some feedback:

  • Consider centralizing the repeated container setup and teardown logic (name, creation, cleanup) into your shared utils to reduce code duplication across exec, execin, and cp test scripts.
  • Use dynamically generated container names and temp file paths (e.g. via mktemp) instead of hard-coded “alpine-podman” and /tmp/* to avoid collisions when running tests in parallel.
  • Add strict mode flags (set -euo pipefail) at the top of each test script to ensure any unexpected failures or undefined variables cause immediate test failures.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider centralizing the repeated container setup and teardown logic (name, creation, cleanup) into your shared utils to reduce code duplication across exec, execin, and cp test scripts.
- Use dynamically generated container names and temp file paths (e.g. via mktemp) instead of hard-coded “alpine-podman” and /tmp/* to avoid collisions when running tests in parallel.
- Add strict mode flags (set -euo pipefail) at the top of each test script to ensure any unexpected failures or undefined variables cause immediate test failures.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@ArtiomDivak ArtiomDivak force-pushed the issue-870 branch 2 times, most recently from c92263a to c7954f7 Compare July 27, 2025 04:55
@ArtiomDivak ArtiomDivak force-pushed the issue-870 branch 7 times, most recently from 4b67e9e to 2aa3ffc Compare July 29, 2025 07:30
@ArtiomDivak ArtiomDivak requested a review from dougsland July 31, 2025 06:42
@ArtiomDivak ArtiomDivak force-pushed the issue-870 branch 2 times, most recently from f8e8cdd to 50b529c Compare August 4, 2025 17:22
Copy link
Collaborator

@dougsland dougsland left a comment

Choose a reason for hiding this comment

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

we are almost there

@ArtiomDivak ArtiomDivak force-pushed the issue-870 branch 7 times, most recently from a58b699 to 0e1c2ca Compare August 10, 2025 05:15
@ArtiomDivak ArtiomDivak force-pushed the issue-870 branch 2 times, most recently from 15782c2 to 2c2a9b4 Compare August 12, 2025 05:52
@ArtiomDivak ArtiomDivak force-pushed the issue-870 branch 3 times, most recently from 18c6674 to 4b18b4a Compare August 12, 2025 14:00
- Replace qmctl_cp.sh with qmctl_cp_bidirectional.sh for better test coverage
- Replace qmctl_show.sh with qmctl_show_variants.sh for more comprehensive testing
- Add dedicated qmctl_error_handling.sh and qmctl_json_output.sh test scripts
- Update existing qmctl_exec.sh and qmctl_execin.sh test scripts
- Enhance test utilities in tests/e2e/lib/utils with improved test framework
- Update main test runner test_qmctl.sh to use new script structure

Addresses issue containers#870

Signed-off-by: Artiom Divak <[email protected]>
@dougsland dougsland merged commit 966e255 into containers:main Aug 12, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CI/CD: create a test for qmctl
3 participants