Skip to content

Conversation

mkoncek
Copy link
Collaborator

@mkoncek mkoncek commented Sep 5, 2025

This pull request implements a guest provisioning using the mock tool. Mock provides isolation similar to containers but also easy access to the file system similar to local provisioning. Moreover, it provides resource reuse, and it should be easily possible to run tests on newly built packages.

This plugin has minimal custom configuration and leaves it to mock's configuration.

See #4097 for follow-up issues to be addressed later.

Pull Request Checklist

  • implement the feature
  • modify the json schema
  • include a release note

@mkoncek
Copy link
Collaborator Author

mkoncek commented Sep 8, 2025

This plugin will require importing the mockbuild module.
Moreover I have not yet written tests.

@happz happz added step | provision Stuff related to the provision step plugin | mock Related to mock provision plugin labels Sep 9, 2025
@happz happz added this to planning Sep 9, 2025
@github-project-automation github-project-automation bot moved this to backlog in planning Sep 9, 2025
@happz happz moved this from backlog to review in planning Sep 9, 2025
@psss psss changed the title Mock provisioning Implement the mock provision plugin Sep 9, 2025
@mkoncek
Copy link
Collaborator Author

mkoncek commented Sep 10, 2025

Some comments and important notes are in the related Issue: #255

@psss psss added this to the 1.58 milestone Sep 11, 2025
@mcasquer
Copy link
Collaborator

@mkoncek could you update the PR description including some information regarding this new plugin?, the purpose of the PR is clear but it'd nice having more background e.g. of use cases, invocation..

@mcasquer
Copy link
Collaborator

@mkoncek moreover, is there a plan to include documentation along with this new plugin? I cannot find anything other than _run_ansible docstring

@mkoncek
Copy link
Collaborator Author

mkoncek commented Sep 17, 2025

@mkoncek moreover, is there a plan to include documentation along with this new plugin? I cannot find anything other than _run_ansible docstring

Right, of course, it would take some time though. I usually write more detailed documentation after having some prototype, but I don't expect many further changes.

@happz
Copy link
Collaborator

happz commented Sep 18, 2025

One followup note: I miss the goodies we have in Command.run() - friendly command, logging, duration, exit code logging, stdout/stderr, timing events. I don't think it's a blocker, but I strongly believe the "run command on a guest" situation in log file should be plugin-agnostic - extra messages don't hurt as much as missing ones, makes the investigation of issues ridden with exceptions based on which provision plugin was used. It should be fixed ASAP.

@mkoncek
Copy link
Collaborator Author

mkoncek commented Sep 18, 2025

  1. I would start mirroring the functionality found in Command.run. There are a few questions related to dry run for example. Whether we should actually enter mock and run echo $command or just print the cmd.
  2. I agree that the logging as written by me was quite ad-hoc and more for development. It does need to be unified with the rest of the sources.
  3. I noticed that I had to write:
stdout = MockShell.Stream(lambda text: output_logger("out", text, 'yellow', level = 0))
stderr = MockShell.Stream(lambda text: output_logger("err", text, 'yellow', level = 0))

to get any output, I know that for example the container provision uses level=2, but I could not see the logs even when running tmt -vvv.

@mkoncek
Copy link
Collaborator Author

mkoncek commented Sep 19, 2025

As i mentioned elsewhere, for this plugin to work, it needs to install a mock plugin into the mockbuild directory. Where should such file be placed in the source base of this project?

@LecrisUT
Copy link
Collaborator

As i mentioned elsewhere, for this plugin to work, it needs to install a mock plugin into the mockbuild directory. Where should such file be placed in the source base of this project?

We don't have one, but you could make one like contrib or third_party and others will comment if they have a specific preference.

@happz
Copy link
Collaborator

happz commented Sep 22, 2025

  1. I would start mirroring the functionality found in Command.run. There are a few questions related to dry run for example. Whether we should actually enter mock and run echo $command or just print the cmd.
  2. I agree that the logging as written by me was quite ad-hoc and more for development. It does need to be unified with the rest of the sources.
  3. I noticed that I had to write:
stdout = MockShell.Stream(lambda text: output_logger("out", text, 'yellow', level = 0))
stderr = MockShell.Stream(lambda text: output_logger("err", text, 'yellow', level = 0))

to get any output, I know that for example the container provision uses level=2, but I could not see the logs even when running tmt -vvv.

It would help collecting these improvements in an issue.

Copy link
Collaborator

@LecrisUT LecrisUT left a comment

Choose a reason for hiding this comment

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

Oh, I had some pending review comments that I did not submit, I think I had more, but will re-review tomorrow.

@thrix thrix enabled auto-merge (squash) October 8, 2025 18:42
@thrix thrix merged commit 60b137f into teemtee:main Oct 8, 2025
26 checks passed
@github-project-automation github-project-automation bot moved this from merge to done in planning Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci | full test Pull request is ready for the full test execution plugin | mock Related to mock provision plugin step | provision Stuff related to the provision step
Projects
Status: done
Development

Successfully merging this pull request may close these issues.

Add support for running tests under mock
6 participants