From 3fada6eca4e6d5f643b34748406c43e1b13170f9 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Wed, 25 Oct 2023 18:56:53 -0700 Subject: [PATCH] tests/int: fix flaky "runc run with tmpfs perm" 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 (cherry picked from commit 6d27922005cb1b6d3bae325d28dd6a877b6375d4) Signed-off-by: Kir Kolyshkin --- tests/integration/run.bats | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/integration/run.bats b/tests/integration/run.bats index 88540c763..3669f521c 100644 --- a/tests/integration/run.bats +++ b/tests/integration/run.bats @@ -72,7 +72,7 @@ function teardown() { runc run test_tmpfs [ "$status" -eq 0 ] - [ "$output" = "$mode" ] + [ "${lines[0]}" = "$mode" ] } @test "runc run with tmpfs perms" { @@ -83,13 +83,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. @@ -98,7 +98,7 @@ 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. @@ -106,7 +106,7 @@ function teardown() { update_config '.mounts[-1].options = ["mode=0410"]' runc run test_tmpfs [ "$status" -eq 0 ] - [ "$output" = "410" ] + [ "${lines[0]}" = "410" ] } @test "runc run [joining existing container namespaces]" {