-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
tests/e2e: Add Toolbox-specific test cases #7588
tests/e2e: Add Toolbox-specific test cases #7588
Conversation
@HarryMichal: GitHub didn't allow me to request PR reviews from the following users: debarshiray. Note that only containers members and repo collaborators can review this PR, and authors cannot review their own PRs. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
89d2369
to
8bed11c
Compare
test/e2e/toolbox_test.go
Outdated
|
||
session = podmanTest.Podman([]string{"run", "--dns", "none", ALPINE, | ||
"rm", "/etc/resolv.conf", ";", | ||
"touch", "/etc/resolv.conf"}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this syntax actually work? The usual convention seems to be:
podmanTest...( "sh", "-c", "this;that;theother")
...but this was just a detour for bringing me to my favorite rant: "run something and only check exit code" is not a test. Some typos can lead to a command passing but not actually doing anything. A much better idea is to check for unusual strings. For instance:
sh -c "rm /etc/resolv.conf && touch -d '1970-01-01 00:02:03' /etc/resolv.conf && stat -c %s:%Y /etc/resolv.conv"
...and confirm that you get an exact match on 0:123
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this syntax actually work? The usual convention seems to be:
Yes, I was not sure entirely how to go about the commands in the entry-point. Your idea seems to be the right one.
...but this was just a detour for bringing me to my favorite rant: "run something and only check exit code" is not a test.
Roger! The next iteration should fix this. Thank you!
2803b85
to
5a2ea0f
Compare
@rhatdan I'm waiting for CI churn |
We may want to add fedoraToolbox to the cached images - it's a ~60mb pull for three separate tests. |
Yes adding this to cached images makes sense. |
I still need to finish the test-cases before this can be merged. I keep running into problems :). Is it on me to cache the image or is that something done by you, guys? I wanted to avoid relying on the |
Great idea @HarryMichal , thanks for taking this on. |
1d42761
to
eb5ee25
Compare
The tests are failing on just one test case and I'm not sure if it is due to the test case not being correct or it's actually hitting a bug. The @rhatdan, what do you think? |
@HarryMichal see
|
@HarryMichal our CI environment changed today; you're going to need to rebase in order for us to merge this. |
1508039
to
e6b5c9d
Compare
I must say that the names of the tests are much clearer now :). Good work! |
/lgtm |
Did someone press re-run on a failed test here? If so, I think we have a problem. When I checked earlier this morning I saw a test failure that looked real. It is now gone, but there has been no push. That means this is a flake, and is going to come back to haunt us later on. The errors are both in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to see if this blocks merging. I want to understand the failures because I really do not want them to make their way into master.
|
||
session = podmanTest.Podman([]string{"create", "--name", "test", "--userns=keep-id", "--user", "root:root", fedoraToolbox, "sh", "-c", | ||
fmt.Sprintf("%s; %s; %s; sleep 1000", useradd, groupadd, usermod)}) | ||
session.WaitWithDefaultTimeout() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@HarryMichal I'm pretty sure the error is here: this is racy. Could you look into using WaitContainerReady()
? You would need to echo READY
before the sleep
, and adjust the podman logs = nil
test below, and also have to do this on all other tests; but I think that's the easiest safest way to proceed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WaitContainerReady()
does what I was trying to accomplish by calling sleep
. I did not know about it. Thank you! I'll adjust the code to make use of it.
e6b5c9d
to
566b553
Compare
I tried to make use of |
Ah! I forgot to adjust most of the tests to account for the fact the logs are not empty most of the time now because of the use of |
20cffe0
to
c3c9551
Compare
In the past, Toolbox[0] has been affected by several of Podman's bugs/changes of behaviour. This is one of the steps to assure that as Podman progresses, Podman itself and subsequently Toolbox do not regress. One of the other steps is including Toolbox's system tests in Podman's gating systems (which and to what extent is yet to be decided on). The tests are trying to stress parts of Podman that Toolbox needs for its functionality: permission to handle some system files, correct values/permissions/limits in certain parts, management of users and groups, mounting of paths,.. The list is most likely longer and therefore more commits will be needed to control every aspect of the Toolbox/Podman relationship :). Some test cases in test/e2e/toolbox_test.go rely on some tools being present in the base image[1]. That is not the case with the common ALPINE image or the basic Fedora image. Some tests might be duplicates of already existing tests. I'm more in favour of having those duplicates. Thanks to that it will be clear what functionality/behaviour Toolbox requires. [0] https://github.com/containers/toolbox [1] https://github.com/containers/toolbox/#image-requirements Signed-off-by: Ondřej Míchal <[email protected]>
c3c9551
to
a1e1a3a
Compare
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: edsantiago, HarryMichal The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Nice work! Let's get this in. |
In the past, Toolbox[0] has been affected by several of Podman's
bugs/changes of behaviour. This is one of the steps to assure that as
Podman progresses, Podman itself and subsequently Toolbox do not regress.
One of the other steps is including Toolbox's system tests in Podman's
gating systems (which and to what extent is yet to be decided on).
The tests are trying to stress parts of Podman that Toolbox needs for
its functionality: permission to handle some system files, correct
values/permissions/limits in certain parts, management of users and
groups, mounting of paths,.. The list is most likely longer and
therefore more commits will be needed to control every aspect of the
Toolbox/Podman relationship :).
Some test cases in test/e2e/toolbox_test.go rely on some tools being
present in the base image[1]. That is not the case with the common
ALPINE image or the basic Fedora image.
Some tests might be duplicates of already existing tests. I'm more in
favor of having those duplicates. Thanks to that it will be clear what
functionality/behaviour Toolbox requires.
[0] https://github.com/containers/toolbox
[1] https://github.com/containers/toolbox/#image-requirements
I'm opening the PR to get some feedback if these tests seem okay. I'm 100% sure that these are not all the tests cases we'd like to get covered but I think it's better to have something to start with and then pile on top of it :).
/cc @debarshiray @edsantiago