Skip to content

Commit 898f02c

Browse files
committed
advanced input validation test
1 parent bea7d07 commit 898f02c

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

tests/parallax-cli-checks.bats

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,43 @@ load helpers.bash
6363
[[ "$output" =~ "Storage validation failed" ]]
6464
}
6565

66+
@test "Advanced --roStoragePath directory is initialized" {
67+
# Populate the storage dir with a dummy file
68+
# This way the directory is neither empty or with a store structure
69+
touch "$RO_STORAGE/dummy-file"
70+
71+
run "$PARALLAX_BINARY" \
72+
--podmanRoot "$PODMAN_ROOT" \
73+
--roStoragePath "$RO_STORAGE" \
74+
--mksquashfsPath "$MKSQUASHFS_PATH" \
75+
--log-level info \
76+
--migrate \
77+
--image alpine:latest
78+
79+
# Expect a non-zero exit code and a validation error
80+
[ "$status" -ne 0 ]
81+
[[ "$output" =~ "Storage validation failed" ]]
82+
83+
# Bootstrap RO_STORAGE with a pulled image, this satisfies the dir structure validation
84+
run "$PODMAN_BINARY" \
85+
--root "$RO_STORAGE" \
86+
--runroot "$PODMAN_RUNROOT" \
87+
pull alpine:latest
88+
[ "$status" -eq 0 ]
89+
90+
# Now migration should pass
91+
run "$PARALLAX_BINARY" \
92+
--podmanRoot "$PODMAN_ROOT" \
93+
--roStoragePath "$RO_STORAGE" \
94+
--mksquashfsPath "$MKSQUASHFS_PATH" \
95+
--log-level info \
96+
--migrate \
97+
--image alpine:latest
98+
99+
[ "$status" -eq 0 ]
100+
[[ "$output" =~ "Migration successfully completed" ]]
101+
}
102+
66103
@test "Fails RMI when --roStoragePath directory is non-empty" {
67104
# Populate the storage dir with a dummy file
68105
# This way the directory is neither empty or with a store structure

0 commit comments

Comments
 (0)