Skip to content

Commit ce1e5fc

Browse files
committed
tests: exit_code: Add various test cases for run action
Add a new test case to verify that run actions with scripts actually call a script which exists on the filesystem as well as some other interesting cases, like a script which doesn't exist, symlink scripts and missing files. Signed-off-by: Christopher Obbard <[email protected]>
1 parent 399092b commit ce1e5fc

File tree

9 files changed

+68
-0
lines changed

9 files changed

+68
-0
lines changed

tests/exit_test/exit_test.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ expect_failure debos bad.yaml
6868
expect_failure debos pre-machine-failure.yaml
6969
expect_failure debos post-machine-failure.yaml
7070
expect_failure debos overlay-non-existent-destination.yaml
71+
expect_failure debos run-broken-symlink.yaml
72+
expect_failure debos run-missing-script.yaml
73+
expect_failure debos run-no-exec.yaml
74+
expect_success debos run.yaml
7175
expect_failure rename_command NOT_DEBOS debos good.yaml
7276

7377
expect_failure $SUDO debos non-existent-file.yaml --disable-fakemachine
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
architecture: amd64
2+
3+
actions:
4+
- action: run
5+
description: Run a script with broken symlink
6+
chroot: true
7+
script: run/scripts/broken-symlink.sh
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
architecture: amd64
2+
3+
actions:
4+
- action: run
5+
description: Run a script which doesn't exist
6+
chroot: true
7+
script: run/scripts/missing-script.sh

tests/exit_test/run-no-exec.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
architecture: amd64
2+
3+
actions:
4+
- action: run
5+
description: Run script with no exec bit set
6+
chroot: true
7+
script: run/scripts/no-exec.sh

tests/exit_test/run.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
architecture: amd64
2+
3+
actions:
4+
- action: debootstrap
5+
suite: trixie
6+
variant: minbase
7+
merged-usr: true
8+
9+
- action: run
10+
description: Run a script with arguments
11+
script: run/scripts/test.sh argument1 argument2
12+
13+
- action: run
14+
description: Run a script without arguments
15+
script: run/scripts/test.sh
16+
17+
- action: run
18+
description: Run a script with arguments in a chroot
19+
chroot: true
20+
script: run/scripts/test.sh argument1 argument2
21+
22+
- action: run
23+
description: Run a script without arguments in chroot
24+
chroot: true
25+
script: run/scripts/test.sh
26+
27+
- action: run
28+
description: Run a script which is a symlink
29+
script: run/scripts/symlink-test.sh argument1 argument2
30+
31+
- action: run
32+
description: Run a script which is a symlink in chroot
33+
chroot: true
34+
script: run/scripts/symlink-test.sh argument1 argument2
35+
36+
- action: run
37+
description: Test running a command
38+
command: echo test
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
broken.sh

tests/exit_test/run/scripts/no-exec.sh

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test.sh
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
3+
echo "test from script; arguments: $@"

0 commit comments

Comments
 (0)