Skip to content
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

WIP Extend test coverage of openQA::Git #5851

Closed

Conversation

r-richardson
Copy link
Contributor

I'm trying to get openQA::Git test coverage to 100% though its not working yet. My test is currently still running commit and push on my actual git dev branch even though i mocked run_cmd_with_log_return_error (which is used by openQA::Git) to simply return success or failures. I've also tried using set_series for the MockObject instead but that did not help so far

okurz and others added 2 commits August 13, 2024 13:11
docs/Contributing.asciidoc already suggests to setup the test database
manually or run tests with `KEEP_DB=1` to make development more
efficient. We can make this process even easier to discover and use by
extracting a make target "setup-database".
use OpenQA::Git;

my $mock = Test::MockModule->new('OpenQA::Utils');
$mock->redefine('run_cmd_with_log_return_error', sub {
Copy link
Contributor

Choose a reason for hiding this comment

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

Have a look at t/16-utils-runcmd.t
run_cmd_with_log_return_error is an imported function, so it is already defined in OpenQA::Git when you create the OpenQA::Util mock.
Just do it like in t/16-utils-runcmd.t

Maybe the tests from there should be moved to your new test?
It would be a bit weird to have them in separate files.

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