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

Add test workflows based on salt-test #616

Merged
merged 25 commits into from
Feb 26, 2024

Conversation

agraul
Copy link
Member

@agraul agraul commented Jan 3, 2024

What does this PR do?

Replace the salt-toaster based unit and integration test workflows with salt-test based ones. While adding these workflows, I came across a number of tests I had to fix. Where possible, I cherry-picked upstream fixes.

The hostname is set to salt-test-container, which is used to conditionally disable tests that are problematic in GH Actions. If anyone has a better idea for either disabling these tests or know how to run them in GH Actions, I'm all for it.

Needs updates to https://build.opensuse.org/package/show/systemsmanagement:saltstack:products:testing:containers:leap15.5/salt-testsuite-ci, see link diff

agraul and others added 10 commits February 12, 2024 15:20
Some modules `import boto` to set log levels. The related tests don't
import `boto`. This can cause a problem when `boto` is not available.

Tests are skipped when HAS_BOTO in the test_boto_*.py is False. Not
trying to `import boto` can leave HAS_BOTO=True in the test file even
though HAS_BOTO is False on the application side. In this case, tests
are not skipped and fail.
`salt.utils.path.which` should not be mocked before `network.__utils__`. The
Salt loader calls `salt.utils.network.linux_interfaces`, which needs the real
`salt.utils.path.which`.
Signed-off-by: Pedro Algarvio <[email protected]>
(cherry picked from commit 3506e7f)
The same HAS_VCERT check is done in the runner module.
…reenaway original author

(cherry picked from commit 2c1040b)
…tests.

Signed-off-by: Pedro Algarvio <[email protected]>
(cherry picked from commit 672f658)
These tests require a Git repository container, which is hard to correctly set
up when executing the tests in the container in GH Actions.

Using --network host can help, but there was still an error (the git repos were
empty) when I tried to set this up.
@agraul agraul force-pushed the update-testing-workflows-salt-test branch from f569b37 to cf5699a Compare February 12, 2024 15:57
@agraul agraul changed the title Add unit test workflow based on salt-test Add test workflows based on salt-test Feb 12, 2024
@meaksh meaksh force-pushed the update-testing-workflows-salt-test branch 2 times, most recently from 63d013b to 2274c0f Compare February 21, 2024 12:03
@meaksh meaksh force-pushed the update-testing-workflows-salt-test branch from 2274c0f to 49fa25f Compare February 21, 2024 16:15
@meaksh meaksh force-pushed the update-testing-workflows-salt-test branch 7 times, most recently from 27db701 to fb02996 Compare February 22, 2024 10:18
Propagate GITHUB_ACTIONS variable to container environment
@meaksh meaksh force-pushed the update-testing-workflows-salt-test branch 2 times, most recently from fb02996 to c7be52c Compare February 22, 2024 11:16
@meaksh meaksh marked this pull request as ready for review February 22, 2024 12:53
Copy link
Contributor

@vzhestkov vzhestkov left a comment

Choose a reason for hiding this comment

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

In general looks good to me, just one comment about removed test_cmdmod.py.

from tests.support.runtests import RUNTIME_VARS

AVAILABLE_PYTHON_EXECUTABLE = salt.utils.path.which_bin(
["python", "python2", "python2.6", "python2.7"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if I understood why the whole test file was dropped, but I could assume due to missing python executable. Or am I wrong?

Copy link
Member

Choose a reason for hiding this comment

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

@meaksh
Copy link
Member

meaksh commented Feb 23, 2024

I've also pushed some of the commits from this PR upstream, via saltstack/salt#66130

@meaksh meaksh merged commit 918bbbc into openSUSE/release/3006.0 Feb 26, 2024
16 checks passed
@meaksh meaksh deleted the update-testing-workflows-salt-test branch February 26, 2024 10:40
meaksh added a commit that referenced this pull request Feb 26, 2024
* Add test workflows based on salt-test (#616)

* Add unit test workflow based on salt-test

* Add integration test workflow based on salt-test

* Adjust GH actions to run all tests subsets and include functional

* Add new GH action to trigger scenarios tests

* GH Actions: Fix Salt version in _version.txt file

When GH Actions are executed, they skip the default entrypoint for the
container, so we need to arrange the _version.txt file manually

Propagate GITHUB_ACTIONS variable to container environment
meaksh added a commit that referenced this pull request Oct 29, 2024
* Add test workflows based on salt-test (#616)

* Add unit test workflow based on salt-test

* Add integration test workflow based on salt-test

* Adjust GH actions to run all tests subsets and include functional

* Add new GH action to trigger scenarios tests

* GH Actions: Fix Salt version in _version.txt file

When GH Actions are executed, they skip the default entrypoint for the
container, so we need to arrange the _version.txt file manually

Propagate GITHUB_ACTIONS variable to container environment
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.

5 participants