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

Kola: update to handle torcx deprecation / docker and containerd sysext #465

Merged
merged 10 commits into from Oct 17, 2023

Conversation

t-lo
Copy link
Member

@t-lo t-lo commented Oct 13, 2023

This PR prepares kola for torcx deprecation. It is a prerequisite for flatcar/scripts#1216 .

  • A new "sysext" test module has been introduced; the existing sysext.go has been moved there from the systemd module.
    • two additional tests for disabling the docker and containerd sysexts have been added there, too.
  • The "torcx" test module has been removed entirely - it contained a single test (explicitly enabling docker) which needed to be extended to cover sysext docker. That test has been moved to docker/enable_docker.go.
  • Torcx tests are made to run conditionally and will run only for major version below a certain threshold (currently up to version 3745 but this will need to be updated depending on when Contrib: Deprecate torcx, ship containerd / docker as sysexts scripts#1216 gets merged).
  • New sysext tests run for major versions greater than 3746 (same conditions apply)
  • A number of tests have been amended to better handle sysext environments (some implicit assumptions don't hold true anymore): kola/tests/bpf/bpf.go and kola/tests/systemd/journald.go.
  • kola/cluster/cluster.go has been extended to print SSH commands before execution (log level INFO) and command output after execution (log level DEBUG).

How to use

Note that the sysext.custom-oem test may still fail - it tries to download a devcontainer which might not exist for your particular image version.

Testing done

  • Built a mantle container and ran the full suite of tests locally (see "How to use" above) on an AMD64 OS image built from the latest torcx-deprecation-docker-sysext branch.

This change updates kola to handle torcx deprecation. Newer releases of
Flatcar won't ship torcx anymore, while current stable and LTS will
still use it.

Kola tests have been updated to conditionally run torcx tests based on
the OS release version. Also, first basic sysext tests have been added
in a separate kola module. Currently, tests only focus on disabling
sysexts.

Sysext tests formerly residing in the systemd module have been moved to
the new sysext module.

Furthermore, the docker enable test has been generalised to also work
with syysext and moved from the torcx module to the docker module.
This change adds a logger to kola/cluster which is used to log SSH
commands (at INFO level) and stdout and stderr of the command execution
(at DEBUG level) to the console kola has been started on.

This is useful for understanding test failures from console output
alone.

Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
This change adapts the bpf execsnoop test to work with sysext - the bcc
container logs differ a bit when run on sysext docker.

Also, the test is made more robust as docker log line parsing is now
wrapped into a retry loop instead of being one-shot.

Lastly, the change removes the additional c.run() wrapper around the
test function.

Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
Journal filtering for user units appears to be racy / flakey in Flatcar;
sometimes, journalctl --user --unit=... works, and sometimes it does
not.

This change updates the user unit journal test to not filter by unit but
instead read the full user journal. Additionally, a retry loop is added
around log retrieval to avoid potential race conditions.

Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
Comment on lines 48 to 52
output := c.MustSSH(m,
`test ! -f /usr/bin/containerd || echo "ERROR"`)
if string(output) == "ERROR" {
c.Errorf("/usr/bin/containerd exists even when sysext is disabled!")
}
Copy link
Member

Choose a reason for hiding this comment

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

The test would be more robust by asserting what we expect instead of what we don't expect.
I think the easiest way would be:

Suggested change
output := c.MustSSH(m,
`test ! -f /usr/bin/containerd || echo "ERROR"`)
if string(output) == "ERROR" {
c.Errorf("/usr/bin/containerd exists even when sysext is disabled!")
}
# Assert that the containerd binary does not exist
_ = c.MustSSH(m, `test ! -f /usr/bin/containerd`)

Copy link
Member Author

Choose a reason for hiding this comment

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

I disagree - the suggestion makes the command fail instead of creating a meaningful test outcome. This would imply the test itself is broken.

In general, tests should end in one of 3 ways:

  1. The test succeeded, signalling the build is healthy (containerd is not present).
  2. The test failed, signalling an issue with the build (containerd is present).
  3. The test is broken, signalling an issue with the test suite (either "test" or "echo" are broken, or SSH failed.)

I want to communicate 2., not 3.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, it makes sense to distinguish that. The test is still not robust because it checks for errors explicitly. What you can change is to use && echo SUCCESS and if string(output) != "SUCCESS" { to handle more things that can get wrong.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll reverse the check and catch test returning 1 (if the binary is not present).

Copy link
Member Author

Choose a reason for hiding this comment

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

Done, please have another look.

Copy link
Member

Choose a reason for hiding this comment

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

What I meant was that == "ERROR" is too narrow and the test will silently break if it returns ERROR\n or the empty string. Therefore it's better to use something like != "SUCCESS".

@t-lo t-lo force-pushed the t-lo/torcx-deprecation-tests-updates branch from 7deb834 to 2f40955 Compare October 16, 2023 09:29
@t-lo t-lo requested a review from pothos October 16, 2023 09:29
@t-lo
Copy link
Member Author

t-lo commented Oct 16, 2023

Addressed all feedback, thank you for your review @pothos !

Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
@t-lo t-lo force-pushed the t-lo/torcx-deprecation-tests-updates branch from 2f40955 to e8d9164 Compare October 16, 2023 10:09
@t-lo t-lo requested review from tormath1 and a team October 16, 2023 11:13
kola/tests/systemd/journald.go Outdated Show resolved Hide resolved
kola/tests/systemd/journald.go Outdated Show resolved Hide resolved
kola/tests/bpf/bpf.go Outdated Show resolved Hide resolved
kola/tests/sysext/disable_containerd.go Outdated Show resolved Hide resolved
Co-authored-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
@t-lo t-lo requested a review from tormath1 October 16, 2023 13:52
@t-lo t-lo force-pushed the t-lo/torcx-deprecation-tests-updates branch 2 times, most recently from ac393eb to f7a20fb Compare October 16, 2023 15:19
Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
@t-lo t-lo force-pushed the t-lo/torcx-deprecation-tests-updates branch from f7a20fb to 1a30986 Compare October 17, 2023 06:24
Copy link
Contributor

@tormath1 tormath1 left a comment

Choose a reason for hiding this comment

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

LGTM - a last nit-pick. Feel free to rebase or not your commits. Thanks for this work!

Co-authored-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
@t-lo t-lo merged commit 313aa7e into flatcar-master Oct 17, 2023
0 of 2 checks passed
@t-lo t-lo deleted the t-lo/torcx-deprecation-tests-updates branch October 17, 2023 10:23
t-lo added a commit to flatcar/scripts that referenced this pull request Oct 17, 2023
This change bumps the image ref of the mantle container to
ghcr.io/flatcar/mantle:git-20a2f8ffee8c8a1a042b1da99f0f59312110f285.
This version includes 2 PRs (flatcar/mantle#465
and flatcar/mantle#466) which add support for
sysext docker / torcx removal in the OS image.

Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
t-lo added a commit to flatcar/scripts that referenced this pull request Oct 19, 2023
This change bumps the image ref of the mantle container to
ghcr.io/flatcar/mantle:git-20a2f8ffee8c8a1a042b1da99f0f59312110f285.
This version includes 2 PRs (flatcar/mantle#465
and flatcar/mantle#466) which add support for
sysext docker / torcx removal in the OS image.

Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
t-lo added a commit to flatcar/scripts that referenced this pull request Oct 19, 2023
This change bumps the image ref of the mantle container to
ghcr.io/flatcar/mantle:git-20a2f8ffee8c8a1a042b1da99f0f59312110f285.
This version includes 2 PRs (flatcar/mantle#465
and flatcar/mantle#466) which add support for
sysext docker / torcx removal in the OS image.

Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
t-lo added a commit to flatcar/scripts that referenced this pull request Oct 20, 2023
This change bumps the image ref of the mantle container to
ghcr.io/flatcar/mantle:git-20a2f8ffee8c8a1a042b1da99f0f59312110f285.
This version includes 2 PRs (flatcar/mantle#465
and flatcar/mantle#466) which add support for
sysext docker / torcx removal in the OS image.

Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
t-lo added a commit to flatcar/scripts that referenced this pull request Oct 20, 2023
This change bumps the image ref of the mantle container to
ghcr.io/flatcar/mantle:git-20a2f8ffee8c8a1a042b1da99f0f59312110f285.
This version includes 2 PRs (flatcar/mantle#465
and flatcar/mantle#466) which add support for
sysext docker / torcx removal in the OS image.

Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
t-lo added a commit to flatcar/scripts that referenced this pull request Oct 23, 2023
This change bumps the image ref of the mantle container to
ghcr.io/flatcar/mantle:git-20a2f8ffee8c8a1a042b1da99f0f59312110f285.
This version includes 2 PRs (flatcar/mantle#465
and flatcar/mantle#466) which add support for
sysext docker / torcx removal in the OS image.

Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
t-lo added a commit to flatcar/scripts that referenced this pull request Oct 26, 2023
This change bumps the image ref of the mantle container to
ghcr.io/flatcar/mantle:git-20a2f8ffee8c8a1a042b1da99f0f59312110f285.
This version includes 2 PRs (flatcar/mantle#465
and flatcar/mantle#466) which add support for
sysext docker / torcx removal in the OS image.

Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
t-lo added a commit to flatcar/scripts that referenced this pull request Oct 27, 2023
This change bumps the image ref of the mantle container to
ghcr.io/flatcar/mantle:git-20a2f8ffee8c8a1a042b1da99f0f59312110f285.
This version includes 2 PRs (flatcar/mantle#465
and flatcar/mantle#466) which add support for
sysext docker / torcx removal in the OS image.

Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants