Skip to content

Commit 42b77c1

Browse files
committed
Add bats test for the shell tty fixes
Signed-off-by: Anders F Björklund <[email protected]>
1 parent 4a0287e commit 42b77c1

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

hack/bats/tests/shell.bats

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# SPDX-FileCopyrightText: Copyright The Lima Authors
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
load "../helpers/load"
5+
6+
NAME=dummy
7+
8+
local_setup_file() {
9+
for INSTANCE in "$NAME"; do
10+
limactl delete --force "$INSTANCE" || :
11+
done
12+
}
13+
14+
@test 'create dummy instance' {
15+
run -0 create_dummy_instance "$NAME" '.disk = "1M"'
16+
}
17+
18+
@test 'lima stopped lima instance' {
19+
# check that the "tty" flag is used, also for stdin
20+
limactl shell --tty=false "$NAME" true </dev/null
21+
}
22+
23+
@test 'yes | stopped lima instance' {
24+
# check that stdin is verified and not just crashing
25+
bash -c "yes | limactl shell --tty=true $NAME true"
26+
}
27+
28+
@test 'delete dummy instance' {
29+
run_e -0 limactl delete --force "$NAME"
30+
assert_info "Deleted \"${NAME}\""
31+
}

0 commit comments

Comments
 (0)