Skip to content

Qmctl tests #831

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 4, 2025
Merged

Qmctl tests #831

merged 1 commit into from
Jun 4, 2025

Conversation

ArtiomDivak
Copy link
Collaborator

@ArtiomDivak ArtiomDivak commented May 19, 2025

Closes: https://issues.redhat.com/browse/VROOM-28614

Summary by Sourcery

Add tmt tests to check qmctl functionality ( cp, show, exec and ecexin). First, the test install and set up QM, and then run the scripts that check the output of each of the qm commands.

Tests:

  • 'qmctl_cp.sh' runs the qmctl cp command and copy file_to_copy.txt into QM and compares the text inside the file that was created.
  • qmctl_exec.cp runs the qmctl exec command that creates and new Alpine container and check if it was created inside QM
  • qmctl_execin.sh runs the qmctl execin command that creates a new file inside the new Alpine container and checks if it was really created
  • qmctl_show.sh runs the qmctl show command that saves its output into a file, and compares it to the expected file

Copy link
Contributor

sourcery-ai bot commented May 19, 2025

Reviewer's Guide

Introduce a new end-to-end bash test suite for the qmctl tool, consisting of a top-level runner that sets up prerequisites and invokes modular validation scripts for show, exec, execin, and cp commands, leveraging expected-output files and FMF metadata for automated discovery.

File-Level Changes

Change Details Files
Add top-level test runner for qmctl commands
  • Verify existence of the qmctl script
  • Install qm package and run setup
  • Sequentially invoke sub-scripts for show, exec, cp, and execin with exit-on-failure logic
tests/qmctl-test/test_qmctl.sh
Implement output validation helper
  • Run qmctl with a given action and capture output to a temp file
  • Compare actual output against expected file using diff
  • Report match results and exit with appropriate status
tests/qmctl-test/scripts/check_output.sh
Add individual command test scripts
  • Test that exec runs a podman container and verifies its creation
  • Test that execin can create and read a file inside the container
  • Test that cp transfers a file into the VM and validate via exec
tests/qmctl-test/scripts/qmctl_exec.sh
tests/qmctl-test/scripts/qmctl_execin.sh
tests/qmctl-test/scripts/qmctl_cp.sh
Include expected output and test data files
  • Provide expected output for the show command
  • Supply source and target files for copy tests
  • Add FMF metadata for automated test discovery
tests/qmctl-test/files/qmctl_show_expected.txt
tests/qmctl-test/files/file-to-copy.txt
tests/qmctl-test/files/file-to-check-cp.txt
tests/qmctl-test/main.fmf

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 and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

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.

@Yarboa
Copy link
Collaborator

Yarboa commented May 20, 2025

@ArtiomDivak
Please explain the tests in details under PR description
It is not clear, if it is running on c9s or prepared setup, i see you install qm and run setup script.
https://github.com/containers/qm/pull/831/files#diff-a173a3574d16d8660efcc31cbe8cc1c2a4fa0e5e6e8749e1f46cbaf828d039c0R12

We already have tests for that, which is running under the gates,
Why not just run the test against prepared c9s or fedora machines? or later AutoSD/RHIVOS?

@Yarboa
Copy link
Collaborator

Yarboa commented May 27, 2025

@ArtiomDivak why do you need that one ?

https://github.com/containers/qm/pull/831/files#diff-62167416cbf755d01c6862a21b7c61efdaf638352c055d6c4829f732d431fb10

Just compare the command to the output of
/usr/lib/systemd/system-generators/podman-system-generator --dryrun

@ArtiomDivak ArtiomDivak force-pushed the issue-806 branch 5 times, most recently from b8305ee to 4854da3 Compare May 29, 2025 05:34
@Yarboa
Copy link
Collaborator

Yarboa commented May 29, 2025

@ArtiomDivak nice,
Please consider better output for successful scenario
please refer that https://artifacts.dev.testing-farm.io/0fb2e5de-d4df-410b-808c-45a66a8fd704/work-kvm-tier-0qiwdzgfu/plans/e2e/kvm-tier-0/execute/data/guest/default-0/tests/qmctl-test-6/output.txt

Please take a look at other tests,
For example tests/ffi/sys_read_only/test.sh

@ArtiomDivak ArtiomDivak force-pushed the issue-806 branch 2 times, most recently from aa94a68 to 13e54a0 Compare June 1, 2025 06:00
Copy link
Collaborator

@Yarboa Yarboa left a comment

Choose a reason for hiding this comment

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

LGTM

@dougsland dougsland merged commit daec692 into containers:main Jun 4, 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.

3 participants