-
Notifications
You must be signed in to change notification settings - Fork 221
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The tests introduced by commit b5cdc57 have proven to be rather unstable due to mistakes in their design. The tests were quite chaotically structured, and because of that images were deleted and pulled too often, causing several false positives [1, 2]. This changes the structure of the tests in a major way. The tests (resp. commands) are now run in a manner that better simulates the way Toolbox is actually used. From a clean state, through creating containers, using them and in the end deleting them. This should reduce the strain on the bandwidth and possibly even speed up the tests themselves. [1] #372 [2] #374 #375
- Loading branch information
1 parent
50683c9
commit 1e22327
Showing
14 changed files
with
148 additions
and
208 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env bats | ||
|
||
load helpers | ||
|
||
@test "Show usage screen when no command is given" { | ||
run_toolbox 1 | ||
is "${lines[0]}" "toolbox: missing command" "Usage line 1" | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env bats | ||
|
||
load helpers | ||
|
||
@test "Run list with zero containers and two images" { | ||
run_toolbox list | ||
is "${#lines[@]}" "3" "Expected number of lines of the output is 3 (Img: 3 + Spc: 0 + Cont: 0)" | ||
|
||
is "${lines[1]}" ".*registry.fedoraproject.org/.*" "First of the two images" | ||
is "${lines[2]}" ".*registry.fedoraproject.org/.*" "Second of the two images" | ||
} | ||
|
||
@test "Run list with zero containers (-c flag)" { | ||
run_toolbox list -c | ||
is "$output" "" "Output of list should be blank" | ||
} | ||
|
||
@test "Run list with zero images (-i flag)" { | ||
run_toolbox list -i | ||
is "${#lines[@]}" "3" "Expected number of lines of the output is 3" | ||
|
||
is "${lines[1]}" ".*registry.fedoraproject.org/.*" "First of the two images" | ||
is "${lines[2]}" ".*registry.fedoraproject.org/.*" "Second of the two images" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env bats | ||
|
||
load helpers | ||
|
||
@test "Create the default container" { | ||
run_toolbox -y create | ||
} | ||
|
||
@test "Create a container with a valid custom name ('not-running')" { | ||
run_toolbox -y create -c "not-running" | ||
} | ||
|
||
@test "Create a container with a custom image and name ('running';f29)" { | ||
run_toolbox -y create -c "running" -i fedora-toolbox:29 | ||
} | ||
|
||
@test "Try to create a container with invalid custom name" { | ||
run_toolbox 1 -y create -c "ß[email protected]€" | ||
is "${lines[0]}" "toolbox: invalid argument for '--container'" "Toolbox reports invalid argument for --container" | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env bats | ||
|
||
load helpers | ||
|
||
@test "Run list with three containers and two images" { | ||
run_toolbox list | ||
is "${#lines[@]}" "8" "Expected number of lines of the output is 8 (Img: 3 + Cont: 5 (duplication expected))" | ||
|
||
is "${lines[1]}" ".*registry.fedoraproject.org/.*" "The first of the two images" | ||
is "${lines[2]}" ".*registry.fedoraproject.org/.*" "The second of the two images" | ||
|
||
is "${lines[4]}" ".*fedora-toolbox-.*" "The default container should be first in the list" | ||
is "${lines[5]}" ".*not-running.*" "The container 'not-running' should be second" | ||
is "${lines[6]}" ".*running.*" "The container 'running' should be third (last)" | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env bats | ||
|
||
load helpers | ||
|
||
@test "Echo 'Hello World' inside of the default container" { | ||
run_toolbox run echo "Hello World" | ||
is "$output" "Hello World" "Should say 'Hello World'" | ||
} | ||
|
||
@test "Echo 'Hello World' inside of the 'running' container" { | ||
run_toolbox run -c running echo "Hello World" | ||
is "$output" "Hello World" "Should say 'Hello World'" | ||
} | ||
|
||
@test "Stop the 'running' container using 'podman stop'" { | ||
run_podman stop running | ||
is "${#lines[@]}" "1" "Expected number of lines of the output is 1 (with the id of the container)" | ||
} | ||
|
||
@test "Echo 'hello World' again in the 'running' container after being stopped and exit" { | ||
run_toolbox run -c running echo "Hello World" | ||
is "$output" "Hello World" "Should say 'Hello World'" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env bats | ||
|
||
load helpers | ||
|
||
@test "Try to remove a nonexistent container" { | ||
run_toolbox 1 rm nonexistentcontainer | ||
is "$output" "toolbox: failed to inspect $todelete" "Toolbox should fail with: no such container" | ||
} | ||
|
||
@test "Try to remove the running container 'running'" { | ||
run_toolbox 1 rm running | ||
is "$output" "toolbox: failed to remove container running" "Toolbox should fail to remove the running container" | ||
} | ||
|
||
@test "Remove the not running container 'not-running'" { | ||
run_toolbox rm not-running | ||
is "$output" "" "The output should be empty" | ||
} | ||
|
||
@test "Force remove the running container 'running'" { | ||
run_toolbox rm --force running | ||
is "$output" "" "The output should be empty" | ||
} | ||
|
||
@test "Force remove all remaining containers (only 1 should be left)" { | ||
run_toolbox rm --force --all | ||
is "$output" "" "The output should be empty" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env bats | ||
|
||
load helpers | ||
|
||
@test "Remove all images (2 should be present; --force should not be necessary)" { | ||
run_toolbox rmi --all | ||
is "$output" "" "The output should be empty" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters