Skip to content

Commit 7e20a43

Browse files
committed
test/system: Use a variable for the container name
#1715
1 parent 236590e commit 7e20a43

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

test/system/101-create.bats

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,23 +50,27 @@ teardown() {
5050
@test "create: With a custom name (using option --container)" {
5151
pull_default_image
5252

53-
run --separate-stderr "$TOOLBX" create --container "custom-containerName"
53+
local container="custom-containerName"
54+
55+
run --separate-stderr "$TOOLBX" create --container "$container"
5456

5557
assert_success
56-
assert_line --index 0 "Created container: custom-containerName"
57-
assert_line --index 1 "Enter with: toolbox enter custom-containerName"
58+
assert_line --index 0 "Created container: $container"
59+
assert_line --index 1 "Enter with: toolbox enter $container"
5860
assert [ ${#lines[@]} -eq 2 ]
5961
assert [ ${#stderr_lines[@]} -eq 0 ]
6062
}
6163

6264
@test "create: With a custom image and name (using option --container)" {
6365
pull_distro_image fedora 34
6466

65-
run --separate-stderr "$TOOLBX" create --container "fedora34" --image fedora-toolbox:34
67+
local container="fedora34"
68+
69+
run --separate-stderr "$TOOLBX" create --container "$container" --image fedora-toolbox:34
6670

6771
assert_success
68-
assert_line --index 0 "Created container: fedora34"
69-
assert_line --index 1 "Enter with: toolbox enter fedora34"
72+
assert_line --index 0 "Created container: $container"
73+
assert_line --index 1 "Enter with: toolbox enter $container"
7074
assert [ ${#lines[@]} -eq 2 ]
7175
assert [ ${#stderr_lines[@]} -eq 0 ]
7276
}
@@ -143,15 +147,17 @@ teardown() {
143147

144148
pull_distro_image arch latest
145149

150+
local container="arch-toolbox-latest"
151+
146152
run --separate-stderr "$TOOLBX" create --distro arch
147153

148154
assert_success
149-
assert_line --index 0 "Created container: arch-toolbox-latest"
155+
assert_line --index 0 "Created container: $container"
150156

151157
if [ "$system_id" = "arch" ]; then
152158
assert_line --index 1 "Enter with: toolbox enter"
153159
else
154-
assert_line --index 1 "Enter with: toolbox enter arch-toolbox-latest"
160+
assert_line --index 1 "Enter with: toolbox enter $container"
155161
fi
156162

157163
assert [ ${#lines[@]} -eq 2 ]
@@ -160,7 +166,7 @@ teardown() {
160166
run podman ps --all
161167

162168
assert_success
163-
assert_output --regexp "Created[[:blank:]]+arch-toolbox-latest"
169+
assert_output --regexp "Created[[:blank:]]+$container"
164170
}
165171

166172
@test "create: Arch Linux ('--release latest')" {

0 commit comments

Comments
 (0)