Skip to content

Fix unit tests#2971

Merged
Conan-Kudo merged 6 commits intomainfrom
fix_unit_tests
Mar 13, 2026
Merged

Fix unit tests#2971
Conan-Kudo merged 6 commits intomainfrom
fix_unit_tests

Conversation

@schaefi
Copy link
Collaborator

@schaefi schaefi commented Mar 12, 2026

This change is two fold

Fixed docopt docstring

When using doctopt argument information that contains the "|" symbol it gets wrongly evaluated as an option
in newer versions of docopt. This commit changes the argument information to use a "," instead

Fix unit tests

Due to us carrying a custom kiwi-revert-bls-default-for-suse.patch patch there is a different grub bootloader BLS behavior which causes some unit tests to fail when they run outside of the general source. This commit fixes it.

schaefi added 2 commits March 12, 2026 19:32
Due to us carrying a custom kiwi-revert-bls-default-for-suse.patch
patch there is a different grub bootloader BLS behavior
which causes some unit tests to fail when they run outside
of the general source. This commit fixes it.
When using doctopt argument information that contains
the "|" symbol it gets wrongly evaluated as an option
in newer versions of docopt. This commit changes the
argument information to use a "," instead
@schaefi schaefi requested a review from Conan-Kudo March 12, 2026 18:35
@schaefi schaefi self-assigned this Mar 12, 2026
@Conan-Kudo
Copy link
Member

The builds have failed.

@schaefi
Copy link
Collaborator Author

schaefi commented Mar 13, 2026

@Conan-Kudo There is little I can do here. The error from the build for x86_64 and aarch64 is

profile vmxFlavour not found for host arch i686

And that would actually be correct. This means in this mock environment the call for

import platform

print(platform.machine())

would return i686 and that is causing the test issues.

As such I believe something is wrong with the architecture emulation in the build environment
It's just an assumption though

@schaefi
Copy link
Collaborator Author

schaefi commented Mar 13, 2026

@Conan-Kudo wait maybe it's just me ... I took a closer look and there is some issue I overlooked.

Stay tuned, I'm on it

@schaefi
Copy link
Collaborator Author

schaefi commented Mar 13, 2026

@Conan-Kudo

urks this is a race condition in the parallel invocation of pytest. I see you are using 8 workers

PYTEST_XDIST_AUTO_NUM_WORKERS=8

I'm using 4 workers and in this scenario the problem does not happen. If I switch to 8 it fails for me in the same way. I believe this is because several tests mock the architecture to run an arch specific test. That arch mock is however global and if at the same time another test runs which does not work with this arch mock it fails.

I need to check where the race comes from :(

@Conan-Kudo
Copy link
Member

Well, that explains why it doesn't fail on RHEL... We don't have the ability to run pytest in parallel there. 😅

Make sure to not inherit arch settings from parallel runs
of the unit tests.
@schaefi
Copy link
Collaborator Author

schaefi commented Mar 13, 2026

@Conan-Kudo ok, I think I found the race condition. Can you give it a new try ? Thanks

@schaefi
Copy link
Collaborator Author

schaefi commented Mar 13, 2026

Thanks, still some issues, checking

schaefi added 2 commits March 13, 2026 12:13
It should not depend on the order of the tests if the
custom_args parameter secure_image_file got initialized
or not
The test was missing proper mocking and did not work
as a generic test on all archs.
@schaefi
Copy link
Collaborator Author

schaefi commented Mar 13, 2026

@Conan-Kudo ok next try please and thanks for your patience. race conditions are hard to debug, but there was also a test that was really not well written from my side and I actually wondered why it did not fail more often.

@schaefi
Copy link
Collaborator Author

schaefi commented Mar 13, 2026

This looks promising :)

@Conan-Kudo
Copy link
Member

Looks like everything passes now.

@schaefi
Copy link
Collaborator Author

schaefi commented Mar 13, 2026

@Conan-Kudo yes can you approve, then I'll zip a new release and you will be unblocked.

@Conan-Kudo Conan-Kudo merged commit 2c2aaef into main Mar 13, 2026
12 checks passed
@Conan-Kudo Conan-Kudo deleted the fix_unit_tests branch March 13, 2026 13:35
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.

2 participants