Skip to content

Commit

Permalink
tests/int: simplify assignments
Browse files Browse the repository at this point in the history
Assigning a multi-line value to a bash variable should not be so complex.

While at it, slightly reformat create_runtime_hook.

No functional change.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
  • Loading branch information
kolyshkin committed Jan 7, 2025
1 parent a22ea82 commit a50e687
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
9 changes: 2 additions & 7 deletions tests/integration/hooks_so.bats
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,8 @@ function teardown() {
bundle=$(pwd)

# To mount $HOOKLIBCR we need to do that in the container namespace
create_runtime_hook=$(
cat <<-EOF
pid=\$(cat - | jq -r '.pid')
touch "$LIBPATH/$HOOKLIBCR.1.0.0"
nsenter -m \$ns -t \$pid mount --bind "$bundle/$HOOKLIBCR.1.0.0" "$LIBPATH/$HOOKLIBCR.1.0.0"
EOF
)
create_runtime_hook="pid=\$(cat - | jq -r '.pid'); touch "$LIBPATH/$HOOKLIBCR.1.0.0" && \
nsenter -m \$ns -t \$pid mount --bind "$bundle/$HOOKLIBCR.1.0.0" "$LIBPATH/$HOOKLIBCR.1.0.0""

create_container_hook="touch ./lib/$HOOKLIBCC.1.0.0 && mount --bind $bundle/$HOOKLIBCC.1.0.0 ./lib/$HOOKLIBCC.1.0.0"

Expand Down
14 changes: 4 additions & 10 deletions tests/integration/tty.bats
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,7 @@ function teardown() {
# make sure we're running
testcontainer test_busybox running

tty_info_with_consize_size=$(
cat <<EOF
tty_info_with_consize_size='
{
"terminal": true,
"consoleSize": {
Expand All @@ -167,9 +166,7 @@ function teardown() {
"/bin/stty -a > /tmp/tty-info"
],
"cwd": "/"
}
EOF
)
}'

# Run the detached exec.
runc exec -t --pid-file pid.txt -d --console-socket "$CONSOLE_SOCKET" -p <(echo "$tty_info_with_consize_size") test_busybox
Expand All @@ -179,17 +176,14 @@ EOF
# Wait for the exec to finish.
wait_pids_gone 100 0.5 "$(cat pid.txt)"

tty_info=$(
cat <<EOF
tty_info='
{
"args": [
"/bin/cat",
"/tmp/tty-info"
],
"cwd": "/"
}
EOF
)
}'

# run the exec
runc exec -t -p <(echo "$tty_info") test_busybox
Expand Down

0 comments on commit a50e687

Please sign in to comment.