Skip to content

Conversation

@kolyshkin
Copy link
Contributor

@kolyshkin kolyshkin commented Feb 8, 2022

Based on and currently includes #3367 and #3371. Draft until those are merged.

This is a set of bash code cleanups for integration tests, mostly done for correctness, uniformity, and readability.

Please review commit by commit, and see individual commit messages for details.

@kolyshkin kolyshkin changed the title ests/int: nits and cleanups tests/int: nits and cleanups Feb 8, 2022
@kolyshkin kolyshkin mentioned this pull request Feb 10, 2022
@kolyshkin
Copy link
Contributor Author

As per comments, #3367 (comment), it makes sense to change CGROUP_UNIFIED to CGROUP_V1 and CGROUP_V2.

@kolyshkin kolyshkin force-pushed the more-tests-nits branch 4 times, most recently from 92d25b6 to bd0c4c0 Compare February 10, 2022 22:41
@kolyshkin
Copy link
Contributor Author

Waiting for #3367 to be merged.

@kolyshkin kolyshkin marked this pull request as ready for review March 22, 2022 22:57
@kolyshkin kolyshkin force-pushed the more-tests-nits branch 3 times, most recently from fbbd8be to 0996d10 Compare March 22, 2022 23:33
@kolyshkin
Copy link
Contributor Author

@tianon PTAL 🙏🏻

Strictly speaking, == is for [[ only, not for [ / test,
and, unlike =, the right side is a pattern.

To avoid confusion, use =. In cases where we compare with empty string,
use -z instead.

Keep using [[ in some cases since it does not require quoting the left
and right side of comparison (I trust shellcheck on that one).

This should have no effect (other than the code being a tad more
strict).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This makes it work similar to all the other variables we use as binary
flags.

The new 'shellcheck disable' is due to a bug in shellcheck (basically,
it does not track the scope of variables or execution order, assuming
everything is executed as soon as it is seen).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This test requires both rootless and root, which does not make sense.

Remove the rootless part.

Fixes: d41a273
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
The variable $ROOTLESS, as set by helpers.bash and used in many places,
provides the same value as $EUID which is always set by bash. Since we
are using bash, we can rely on $EUID being omnipresent.

Modify all uses accordingly, and since the value is known to be a
number, omit the quoting.

Similarly, replace all uses of $(id -u) to $EUID.

Do some trivial cleanups along the way, such as
 - simplify some if A; then B; to A && B;
 - do not use [[ instead of [ where not necessary.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
@kolyshkin
Copy link
Contributor Author

@thaJeztah @mrunalp PTAL (this is already blessed by @tianon).

@kolyshkin
Copy link
Contributor Author

@thaJeztah @mrunalp @AkihiroSuda @cyphar PTAL (this is already blessed by @tianon).

@kolyshkin
Copy link
Contributor Author

@thaJeztah @mrunalp @AkihiroSuda @cyphar Very PTAL. Background story: I am working to add some tests and just caught myself redoing these cleanups from scratch. Believe me, it does not feel good at all.

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

sorry, for some reason missed the pings 🙀

@thaJeztah thaJeztah merged commit aac0181 into opencontainers:main May 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants