Skip to content

Commit

Permalink
tests/int: fix flaky "runc run with tmpfs perm"
Browse files Browse the repository at this point in the history
Apparently, sometimes a short-lived "runc run" produces result with \r
and sometimes without. As a result, we have an occasional failure of
"runc run with tmpfs perms" test.

The solution (to the flaky test) is to use the first line of the output
(like many other tests do).

Signed-off-by: Kir Kolyshkin <[email protected]>
  • Loading branch information
kolyshkin committed Oct 26, 2023
1 parent edd00eb commit 6d27922
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/integration/run.bats
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function teardown() {

runc run test_tmpfs
[ "$status" -eq 0 ]
[ "$output" = "$mode" ]
[ "${lines[0]}" = "$mode" ]
}

@test "runc run with tmpfs perms" {
Expand All @@ -101,13 +101,13 @@ function teardown() {
# Directory is to be created by runc.
runc run test_tmpfs
[ "$status" -eq 0 ]
[ "$output" = "444" ]
[ "${lines[0]}" = "444" ]

# Run a 2nd time with the pre-existing directory.
# Ref: https://github.com/opencontainers/runc/issues/3911
runc run test_tmpfs
[ "$status" -eq 0 ]
[ "$output" = "444" ]
[ "${lines[0]}" = "444" ]

# Existing directory, custom perms, no mode on the mount,
# so it should use the directory's perms.
Expand All @@ -116,15 +116,15 @@ function teardown() {
# shellcheck disable=SC2016
runc run test_tmpfs
[ "$status" -eq 0 ]
[ "$output" = "710" ]
[ "${lines[0]}" = "710" ]

# Add back the mode on the mount, and it should use that instead.
# Just for fun, use different perms than was used earlier.
# shellcheck disable=SC2016
update_config '.mounts[-1].options = ["mode=0410"]'
runc run test_tmpfs
[ "$status" -eq 0 ]
[ "$output" = "410" ]
[ "${lines[0]}" = "410" ]
}

@test "runc run [runc-dmz]" {
Expand Down

0 comments on commit 6d27922

Please sign in to comment.