Repository navigation
System tests refactor - #517
Conversation
|
Build failed.
|
|
Some tests have failed due the inconsistency of the registry (or the network), I need to work on that to make it more reliable. Pull the images first (in some tests) is an option, but then it doesn't test the toolbox's mechanism to pull the images the first time or when is asked for an image that is not been pulled yet. |
|
Build failed.
|
|
Build failed.
|
|
Build failed.
|
|
I added some helpers for pulling the images before using them on tests, but the registry is failing a lot today 😞 |
|
Hi @juanje! Thank you for working on this. Much appreciated!
Yes, the
I'm perfectly fine with adding a helper function for pulling the images. Toolbox's image pulling mechanism is simply a wrapper around the
Definitely, yes! I'm aware of those libraries but I was hesitant to use those because they are not packaged in Fedora (just the original
I'd love to see more tests but first we need to figure out solutions for some of the problems we're facing now (unreliable registry, #410 - this one might be solved thanks to your update). Also, in the future, we'd like to hook up Toolbox's tests with Podman's. We still have to discuss this matter with Podman developers to get more info about this, though. Again, thank you for working on this! |
|
Build succeeded.
|
Thanks to you, for all the good work you're putting here. I use Toolbox a lot since I installed Silverblue a month ago or so, and I love it 🥰
I was thinking abut this. I saw it failing now and then with Podman or Buildah, I guess is a known issue, but it must be affecting a lot of people.
That's right.
I got all the tests working (the registry issue might give some problems, but I think now is more resilient), I'd like to see your thoughts about them (when you have time). I add some asserts for the exit status of the commands, to make sure it was the right one. Actually, I found some cases where (I think) toolbox should return an exit code For the tests and helper functions I tried to follow this Shell Style Guide and use
Thanks to you @HarryMichal for take the time to review this and reply 😄 |
martymichal
left a comment
There was a problem hiding this comment.
I just quickly went through this, did not even run the tests locally or in a VM. I pointed out a few things that caught my attention.
I'll do a follow-up review in the future.
|
Build failed.
|
|
Build succeeded.
|
|
Build failed.
|
|
Build failed.
|
453638e to
1e6b5ac
Compare
|
Build failed.
|
1e6b5ac to
2b5bf11
Compare
|
Build failed.
|
2b5bf11 to
9769d43
Compare
|
Build failed.
|
|
Build succeeded.
|
|
Build succeeded.
|
03e9a66 to
17d880f
Compare
|
Build succeeded.
|
|
Hi @HarryMichal, I've been working on some of the feedback you gave me. Also, I did some more changes:
There are also more minor changes, improvements and a couple the tests more. Now there are 27 test and look like this: Now they all follow the convention and I think the prefix (the command tested) helps to see quickly what fails or succeeds. Sorry for give you this amount of changes, I know that maybe is too much for review 😞 |
martymichal
left a comment
There was a problem hiding this comment.
I perused the list of changes and found a few things that either need to be changed or discussed. Overall, I like where the PR has gotten and I'm confident this could get merged in the future.
Few more notes:
- I'd probably keep the numbering for the test files (e.g. instead of
create.batskeep it102-create.bats). It gives the power to change the order in which the tests are executed while currently they are executed alphabetically. - I noticed you removed
helpers.batsbecause you started relying onbats-support+bats-assert. That is definitely fine but I think that file will probably have to stay (even though the content will be different). The reason is that currently, the smart use of Skopeo to cache the images is done purely by Zuul but I think the tests will have to use some helper functions at least in that regard because the tests will most likely be run in different environments. I still need to examine this area more, so this is not exactly a very strong point now :).
Thank you for your continuous work on this! I'll try to check this out on my machine and play with it a bit.
|
The rebase against current |
Since commit b27795a, each section of the test suite starts and ends with a clean Podman state. This includes removing all images from the local containers storage. Therefore, the images get downloaded multiple times during the course of the test suite. This commit restores the earlier behaviour where the images would get downloaded only once, by copying them to separate directories outside the local containers storage and then restoring them when the tests are run. containers#517
Since commit b27795a, each section of the test suite starts and ends with a clean Podman state. This includes removing all images from the local containers storage. Therefore, the images get downloaded multiple times during the course of the test suite. This commit restores the earlier behaviour where the images would get downloaded only once, by copying them to separate directories outside the local containers storage and then restoring them when the tests are run. containers#517 containers#704
Since commit b27795a, each section of the test suite starts and ends with a clean Podman state. This includes removing all images from the local containers storage. Therefore, the images get downloaded multiple times during the course of the test suite. This commit restores the earlier behaviour where the images would get downloaded only once, by copying them to separate directories outside the local containers storage and then restoring them when the tests are run. containers#517 containers#704
Since commit b27795a, each section of the test suite starts and ends with a clean Podman state. This includes removing all images from the local containers storage. Therefore, the images get downloaded multiple times during the course of the test suite. This commit restores the earlier behaviour where the images would get downloaded only once, by copying them to separate directories outside the local containers storage and then restoring them when the tests are run. containers#517 containers#704
Co-authored-by: Juanje Ojeda <[email protected]> Co-authored-by: Ondřej Míchal <[email protected]> containers#517
77dc92f to
05c9c06
Compare
|
recheck |
|
Build failed.
|
|
recheck |
|
Build failed.
|
|
Thanks for all the work on this, @juanje & @HarryMichal ! Much appreciated. |
|
All the glory goes to @juanje. He did an amazing job! 🎉 |
|
Thanks to both @debarshiray and @HarryMichal for letting me contribute my grain of sand to this project. You're doing a great job! I think this project is great for developers and for normal users that like the terminal. |
Since the rewrite of the system test suite[0] we've relied on the Zuul playbooks for taking care of caching images using Skopeo for increasing the reliability of the tests (in the past the instability of the Fedora registry caused problems). This state is problematic if we want to use the tests in other environments than the Zuul CI. This moves the caching from Zuul into the system tests. Currently, Bats does not support officially suite-wide setup and teardown functions. The solution I chose was to add two new test files that are executed before and after all tests. This may complicate the execution of cherry-picked tests but that is not a very common use case anyway. The tests are now to some extent capable of adjusting to the host environment. This is meant in the sense of: I'm running on RHEL, the "default image" is UBI; I'm running on Fedora, the "default image" is fedora-toolbox. This mechanism relies on os-release, which is the same as what Toolbox itself uses. Along the road I chose to update the f29/fedora-toolbox:29 image to the fedora-toolbox:32 image because I did not want to maintain two versions of images (the name changed some time ago[1]). I also introduced or modified a number of helper functions to make better use of the caching and default system recognition. [0] containers#517 [1] containers#615
Since the rewrite of the system test suite[0] we've relied on the Zuul playbooks for taking care of caching images using Skopeo for increasing the reliability of the tests (in the past the instability of the Fedora registry caused problems). This state is problematic if we want to use the tests in other environments than the Zuul CI. This moves the caching from Zuul into the system tests. Currently, Bats does not support officially suite-wide setup and teardown functions. The solution I chose was to add two new test files that are executed before and after all tests. This may complicate the execution of cherry-picked tests but that is not a very common use case anyway. The tests are now to some extent capable of adjusting to the host environment. This is meant in the sense of: I'm running on RHEL, the "default image" is UBI; I'm running on Fedora, the "default image" is fedora-toolbox. This mechanism relies on os-release, which is the same as what Toolbox itself uses. Along the road I chose to update the f29/fedora-toolbox:29 image to the fedora-toolbox:32 image because I did not want to maintain two versions of images (the name changed some time ago[1]). I also introduced or modified a number of helper functions to make better use of the caching and default system recognition. [0] containers#517 [1] containers#615
Since the rewrite of the system test suite[0] we've relied on the Zuul playbooks for taking care of caching images using Skopeo for increasing the reliability of the tests (in the past the instability of the Fedora registry caused problems). This state is problematic if we want to use the tests in other environments than the Zuul CI. This moves the caching from Zuul into the system tests. Currently, Bats does not support officially suite-wide setup and teardown functions. The solution I chose was to add two new test files that are executed before and after all tests. This may complicate the execution of cherry-picked tests but that is not a very common use case anyway. The tests are now to some extent capable of adjusting to the host environment. This is meant in the sense of: I'm running on RHEL, the "default image" is UBI; I'm running on Fedora, the "default image" is fedora-toolbox. This mechanism relies on os-release, which is the same as what Toolbox itself uses. Along the road I chose to update the f29/fedora-toolbox:29 image to the fedora-toolbox:32 image because I did not want to maintain two versions of images (the name changed some time ago[1]). I also introduced or modified a number of helper functions to make better use of the caching and default system recognition. [0] containers#517 [1] containers#615
Since the rewrite of the system test suite[0] we've relied on the Zuul playbooks for taking care of caching images using Skopeo for increasing the reliability of the tests (in the past the instability of the Fedora registry caused problems). This state is problematic if we want to use the tests in other environments than the Zuul CI. This moves the caching from Zuul into the system tests. Currently, Bats does not support officially suite-wide setup and teardown functions. The solution I chose was to add two new test files that are executed before and after all tests. This may complicate the execution of cherry-picked tests but that is not a very common use case anyway. The tests are now to some extent capable of adjusting to the host environment. This is meant in the sense of: I'm running on RHEL, the "default image" is UBI; I'm running on Fedora, the "default image" is fedora-toolbox. This mechanism relies on os-release, which is the same as what Toolbox itself uses. Along the road I chose to update the f29/fedora-toolbox:29 image to the fedora-toolbox:32 image because I did not want to maintain two versions of images (the name changed some time ago[1]). I also introduced or modified a number of helper functions to make better use of the caching and default system recognition. [0] containers#517 [1] containers#615 containers#774
Since the rewrite of the system test suite[0] we've relied on the Zuul playbooks for taking care of caching images using Skopeo for increasing the reliability of the tests (in the past the instability of the Fedora registry caused problems). This state is problematic if we want to use the tests in other environments than the Zuul CI. This moves the caching from Zuul into the system tests. Currently, Bats does not support officially suite-wide setup and teardown functions. The solution I chose was to add two new test files that are executed before and after all tests. This may complicate the execution of cherry-picked tests but that is not a very common use case anyway. The tests are now to some extent capable of adjusting to the host environment. This is meant in the sense of: I'm running on RHEL, the "default image" is UBI; I'm running on Fedora, the "default image" is fedora-toolbox. This mechanism relies on os-release, which is the same as what Toolbox itself uses. [0] containers#517 containers#774
Since the rewrite of the system test suite[0] we've relied on the Zuul playbooks for taking care of caching images using Skopeo for increasing the reliability of the tests (in the past the instability of the Fedora registry caused problems). This state is problematic if we want to use the tests in other environments than the Zuul CI. This moves the caching from Zuul into the system tests. Currently, Bats does not support officially suite-wide setup and teardown functions. The solution I chose was to add two new test files that are executed before and after all tests. This may complicate the execution of cherry-picked tests but that is not a very common use case anyway. The tests are now to some extent capable of adjusting to the host environment. This is meant in the sense of: I'm running on RHEL, the "default image" is UBI; I'm running on Fedora, the "default image" is fedora-toolbox. This mechanism relies on os-release, which is the same as what Toolbox itself uses. [0] #517 #774
I'd like to propose a refactor of the system's tests. The main reason is that the tests have dependencies between them and with external conditions. By definition, tests should be able to work isolated and without any order or dependency.
Also, I think that using very common libraries for BATS as bats-support and bats-assert might make the tests more explicit and easy to maintain (and to contribute).
The helper was a bit complex for this project. It might fix a more complex project like libpod, but I think here makes less sense and make it harder to debug.
I implemented the same tests, but using some extra asserts (mostly for exit codes) and a couple of tests more. If you like the tests, I'd like to add some more.
The
README.mdand the Ansible playbooks are updated as well, but it can be improved.There are also some notes because I found some possible bugs or improvements (at Toolbox) while I was writing the tests.