Skip to content

test/system: Don't assume that no container will have /etc/kernel#1409

Merged
debarshiray merged 1 commit intocontainers:mainfrom
petraglyph:home-fallback
Dec 7, 2023
Merged

test/system: Don't assume that no container will have /etc/kernel#1409
debarshiray merged 1 commit intocontainers:mainfrom
petraglyph:home-fallback

Conversation

@petraglyph
Copy link
Copy Markdown
Contributor

The test "run: Ensure that $HOME is used as a fallback working directory" assumes /etc/kernel will not be present in containers, but this is not the case for Ubuntu (and Debian) containers. This patch switches the test to using a temporary directory (under /var/tmp which is not mounted by toolboxes) to ensure fallback is activated.

@softwarefactory-project-zuul
Copy link
Copy Markdown

Build failed.
https://softwarefactory-project.io/zuul/t/local/buildset/e3053c494f0046888d86eaab1ea0db4a

✔️ unit-test SUCCESS in 6m 58s
✔️ unit-test-migration-path-for-coreos-toolbox SUCCESS in 3m 43s
unit-test-restricted POST_FAILURE in 6m 50s
✔️ system-test-fedora-rawhide SUCCESS in 27m 21s
✔️ system-test-fedora-39 SUCCESS in 27m 10s
✔️ system-test-fedora-38 SUCCESS in 26m 36s
✔️ system-test-fedora-37 SUCCESS in 26m 14s

@martymichal martymichal added the 2. Testing Related to testing of Toolbox - unit, system,.. label Dec 3, 2023
Copy link
Copy Markdown
Member

@debarshiray debarshiray left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution!

We should definitely try to get the tests ready to be run on Ubuntu hosts, so that we can enable them in our CI. The tests do have lots of assumptions about running on Fedora hosts at the moment, which isn't good. So thanks for looking into that.

However, do Ubuntu hosts really not have /etc/kernel? So far, I tried Ubuntu 22.04, 22.10, 23.04 & 23.10 Desktop, and they all had `/etc/kernel.

I am not really opposed to the change, other than someone wanting to share /var/tmp between the host and container in future, but I want to understand the problem that you found.

Copy link
Copy Markdown
Member

@debarshiray debarshiray left a comment

Choose a reason for hiding this comment

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

The commit message could be slightly better. Something like:
"test/system: Don't assume that all host OSes will have /etc/kernel"


pushd /etc/kernel
local testdir
testdir="$(mktemp -d '/var/tmp/toolbox-test-XXXX')"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nitpick: the single quotes aren't necessary.

debarshiray pushed a commit to petraglyph/toolbox that referenced this pull request Dec 4, 2023
@debarshiray
Copy link
Copy Markdown
Member

I took the liberty to address the nits and updated the branch by rebasing against main. I am waiting for your response to my earlier question.

@petraglyph
Copy link
Copy Markdown
Contributor Author

petraglyph commented Dec 4, 2023

Ubuntu hosts do have the /etc/kernel directory, but so do Ubuntu containers. So when the test is run using an Ubuntu container it just enters the container at /etc/kernel without being forced to fallback.

You can simulate this on fedora if you temporarily add the following to /etc/os-release

ID=ubuntu
VERSION_ID="22.04"

@softwarefactory-project-zuul
Copy link
Copy Markdown

Build succeeded.
https://softwarefactory-project.io/zuul/t/local/buildset/fc837885ff294b86a2d66e4ec050dc60

✔️ unit-test SUCCESS in 9m 11s
✔️ unit-test-migration-path-for-coreos-toolbox SUCCESS in 4m 08s
✔️ unit-test-restricted SUCCESS in 8m 50s
✔️ system-test-fedora-rawhide SUCCESS in 29m 25s
✔️ system-test-fedora-39 SUCCESS in 29m 17s
✔️ system-test-fedora-38 SUCCESS in 31m 31s
✔️ system-test-fedora-37 SUCCESS in 29m 35s

Any image or container that has APT or systemd may have /etc/kernel.
eg., the arch-toolbox and ubuntu-toolbox images.

containers#1409

Signed-off-by: Penn Bauman <me@pennbauman.com>
@debarshiray
Copy link
Copy Markdown
Member

Ubuntu hosts do have the /etc/kernel directory, but so do Ubuntu containers. So when the test is run using an Ubuntu container it just enters the container at /etc/kernel without being forced to fallback.

Aha, okay, you are right. I didn't read your initial comment carefully.

You can simulate this on fedora if you temporarily add the following to /etc/os-release

ID=ubuntu
VERSION_ID="22.04"

Thanks for the detailed example. Let's merge this once the CI finishes.

@debarshiray
Copy link
Copy Markdown
Member

@pennbauman Since you spent some time running the test on non-Fedora hosts, would you mind submitting a new PR that runs this "fallback working directory" test on other images, and not just the default one? eg., Arch Linux, RHEL, Ubuntu, etc. like we do elsewhere.

@softwarefactory-project-zuul
Copy link
Copy Markdown

Build succeeded.
https://softwarefactory-project.io/zuul/t/local/buildset/7cf3ec79364a4633ab4e5ac87b0cc6b6

✔️ unit-test SUCCESS in 8m 54s
✔️ unit-test-migration-path-for-coreos-toolbox SUCCESS in 3m 47s
✔️ unit-test-restricted SUCCESS in 5m 33s
✔️ system-test-fedora-rawhide SUCCESS in 33m 59s
✔️ system-test-fedora-39 SUCCESS in 32m 14s
✔️ system-test-fedora-38 SUCCESS in 32m 09s
✔️ system-test-fedora-37 SUCCESS in 32m 34s

@debarshiray debarshiray merged commit 2f3ee0e into containers:main Dec 7, 2023
@petraglyph
Copy link
Copy Markdown
Contributor Author

@debarshiray I was thinking that would be a good next step. I will look into that when I have some time.

@debarshiray
Copy link
Copy Markdown
Member

@debarshiray I was thinking that would be a good next step. I will look into that when I have some time.

Thanks!

@debarshiray debarshiray changed the title test/system: switch HOME fallback to tmp dir (fix for Ubuntu hosts) test/system: Don't assume that no container will have /etc/kernel Dec 18, 2023
debarshiray pushed a commit to debarshiray/toolbox that referenced this pull request Jan 29, 2026
Any image or container that has APT or systemd may have /etc/kernel.
eg., the arch-toolbox and ubuntu-toolbox images.

containers#1409
containers#1750

Signed-off-by: Penn Bauman <me@pennbauman.com>
(backported from commit 2f3ee0e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2. Testing Related to testing of Toolbox - unit, system,..

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants