Skip to content

Commit a50e687

Browse files
committed
tests/int: simplify assignments
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 <[email protected]>
1 parent a22ea82 commit a50e687

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed

tests/integration/hooks_so.bats

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,8 @@ function teardown() {
3030
bundle=$(pwd)
3131

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

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

tests/integration/tty.bats

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,7 @@ function teardown() {
153153
# make sure we're running
154154
testcontainer test_busybox running
155155

156-
tty_info_with_consize_size=$(
157-
cat <<EOF
156+
tty_info_with_consize_size='
158157
{
159158
"terminal": true,
160159
"consoleSize": {
@@ -167,9 +166,7 @@ function teardown() {
167166
"/bin/stty -a > /tmp/tty-info"
168167
],
169168
"cwd": "/"
170-
}
171-
EOF
172-
)
169+
}'
173170

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

182-
tty_info=$(
183-
cat <<EOF
179+
tty_info='
184180
{
185181
"args": [
186182
"/bin/cat",
187183
"/tmp/tty-info"
188184
],
189185
"cwd": "/"
190-
}
191-
EOF
192-
)
186+
}'
193187

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

0 commit comments

Comments
 (0)