-
Notifications
You must be signed in to change notification settings - Fork 1k
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
test/ctr.bats: fixes and improvements #4253
Commits on Oct 9, 2020
-
Fix issues like this one: > In ctr.bats line 69: > errorconfig=$(cat "$TESTDATA"/container_config.json | python -c 'import json,sys;obj=json.load(sys.stdin);obj["command"] = ["false"]; json.dump(obj, sys.stdout)') > ^-- SC2002: Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 37c9c24 - Browse repository at this point
Copy the full SHA 37c9c24View commit details -
test/ctr.bats: rm unneeded cleanup
Test cleanup (including stopping+removing all containers and pods, and stopping crio) is performed via teardown. Remove the cleanup from those test cases where it's not clearly part of the test itself. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 601e1e4 - Browse repository at this point
Copy the full SHA 601e1e4View commit details -
test/ctr.bats: add is_cgroup_v2, fix SC2046
Fixes warings like this one: > In ctr.bats line 195: > if test $(stat -f -c%T /sys/fs/cgroup) != cgroup2fs; then > ^----------------------------^ SC2046: Quote this to prevent word splitting. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for bea64ec - Browse repository at this point
Copy the full SHA bea64ecView commit details -
test/ctr.bats: fix "annotations passed through" test
Commit 5f49b2c added this test case. Obviously, `run crictl` do not output anything to stdout, and `run grep` do not fail if grep exits with non-zero exit code. So the test was not testing anything. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 86596bd - Browse repository at this point
Copy the full SHA 86596bdView commit details -
test/ctr: fix "privileged ctr -- check for rw mounts"
This [partially] fixes the test case. It was broken from the very beginning, since it was supposed to run a privileged container and check that /sys/fs/cgroup is mounted rw. Commit d3a50d8 ("privileged: set mounts to rw") added test/testdata/container_config_privileged.json file, but it is not used by the test (or any other tests). It also checks for ro mount while it should check for rw (based on what I understood). Finally, it used incorrect pod config while creating a container (not sure if it makes any difference, just observing). The test case was later amended to not check ro/rw bits since it was failing on some configurations (see commit 78badc8). This commit fixes the config used for container (and adds `edit_json` function to which hopefully other tests will be eventually converted), fixes the check for rw mount, and fixes the pod config used to create container. While at it, remove the never used container_config_privileged.json. The issues that are not fixed (will be addressed separately) are: - non-working check via jq; - excessive use of `run`. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 19e5214 - Browse repository at this point
Copy the full SHA 19e5214View commit details -
Commits a2ec1d4 and 247d465 added a few checks using jq in the following test cases: * ctr lifecycle * ctr execsync should not overwrite initial spec args * privileged ctr -- check for rw mounts Alas, those checks do not work (and never worked); jq always succeeds. This happened because 1. in `run cmd1 ... | cmd2` the part starting with the pipe character is not part of `run` statement; 2. `run` eats `cmd1 ...` output (into `$output` variable); so `cmd2` is provided with empty input. Now, 3. `jq` with empty input does not run any filters and thus succeeds (even with `-e`, see [1]). The fix is to add a separate check that the output is not empty. While at it, remove `run` where it's not needed from the other places in those three tests we fix. [1] jqlang/jq#1628 Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for eea57ad - Browse repository at this point
Copy the full SHA eea57adView commit details -
test/ctr: rm excessive use of run
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 27dd454 - Browse repository at this point
Copy the full SHA 27dd454View commit details -
This commit is brought to you by shellcheck -f diff ctr.bats | patch -p1 Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 4ab4128 - Browse repository at this point
Copy the full SHA 4ab4128View commit details