test/system: Silence SC2086
Otherwise https://www.shellcheck.net/ would complain: Line 28: run --separate-stderr $TOOLBOX --version ^------^ SC2086 (info): Double quote to prevent globbing and word splitting. See: https://www.shellcheck.net/wiki/SC2086 https://github.com/containers/toolbox/pull/1365
This commit is contained in:
parent
fd7ca125fc
commit
3c2adf57aa
10 changed files with 212 additions and 212 deletions
|
@ -25,7 +25,7 @@ setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "version: Check version using option --version" {
|
@test "version: Check version using option --version" {
|
||||||
run --separate-stderr $TOOLBOX --version
|
run --separate-stderr "$TOOLBOX" --version
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert_output --regexp '^toolbox version [0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?$'
|
assert_output --regexp '^toolbox version [0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?$'
|
||||||
|
|
|
@ -24,7 +24,7 @@ setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "help: Try to run toolbox with no command" {
|
@test "help: Try to run toolbox with no command" {
|
||||||
run $TOOLBOX
|
run "$TOOLBOX"
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: missing command"
|
assert_line --index 0 "Error: missing command"
|
||||||
|
@ -39,7 +39,7 @@ setup() {
|
||||||
skip "Test works only if man is in PATH"
|
skip "Test works only if man is in PATH"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
run $TOOLBOX help
|
run "$TOOLBOX" help
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert_line --index 0 --partial "toolbox(1)"
|
assert_line --index 0 --partial "toolbox(1)"
|
||||||
|
@ -51,7 +51,7 @@ setup() {
|
||||||
skip "Test works only if man is not in PATH"
|
skip "Test works only if man is not in PATH"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
run $TOOLBOX help
|
run "$TOOLBOX" help
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert_line --index 0 "toolbox - Tool for containerized command line environments on Linux"
|
assert_line --index 0 "toolbox - Tool for containerized command line environments on Linux"
|
||||||
|
@ -63,14 +63,14 @@ setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "help: Use flag '--help' (it should show usage screen)" {
|
@test "help: Use flag '--help' (it should show usage screen)" {
|
||||||
run $TOOLBOX --help
|
run "$TOOLBOX" --help
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert_output --partial "toolbox - Tool for containerized command line environments on Linux"
|
assert_output --partial "toolbox - Tool for containerized command line environments on Linux"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "help: Try to run toolbox with non-existent command (shows usage screen)" {
|
@test "help: Try to run toolbox with non-existent command (shows usage screen)" {
|
||||||
run $TOOLBOX foo
|
run "$TOOLBOX" foo
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: unknown command \"foo\" for \"toolbox\""
|
assert_line --index 0 "Error: unknown command \"foo\" for \"toolbox\""
|
||||||
|
@ -78,7 +78,7 @@ setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "help: Try to run toolbox with non-existent flag (shows usage screen)" {
|
@test "help: Try to run toolbox with non-existent flag (shows usage screen)" {
|
||||||
run $TOOLBOX --foo
|
run "$TOOLBOX" --foo
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: unknown flag: --foo"
|
assert_line --index 0 "Error: unknown flag: --foo"
|
||||||
|
@ -86,7 +86,7 @@ setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "help: Try to run 'toolbox create' with non-existent flag (shows usage screen)" {
|
@test "help: Try to run 'toolbox create' with non-existent flag (shows usage screen)" {
|
||||||
run $TOOLBOX create --foo
|
run "$TOOLBOX" create --foo
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: unknown flag: --foo"
|
assert_line --index 0 "Error: unknown flag: --foo"
|
||||||
|
@ -94,7 +94,7 @@ setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "help: Try to run 'toolbox enter' with non-existent flag (shows usage screen)" {
|
@test "help: Try to run 'toolbox enter' with non-existent flag (shows usage screen)" {
|
||||||
run $TOOLBOX enter --foo
|
run "$TOOLBOX" enter --foo
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: unknown flag: --foo"
|
assert_line --index 0 "Error: unknown flag: --foo"
|
||||||
|
@ -102,7 +102,7 @@ setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "help: Try to run 'toolbox help' with non-existent flag (shows usage screen)" {
|
@test "help: Try to run 'toolbox help' with non-existent flag (shows usage screen)" {
|
||||||
run $TOOLBOX help --foo
|
run "$TOOLBOX" help --foo
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: unknown flag: --foo"
|
assert_line --index 0 "Error: unknown flag: --foo"
|
||||||
|
@ -110,7 +110,7 @@ setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "help: Try to run 'toolbox init-container' with non-existent flag (shows usage screen)" {
|
@test "help: Try to run 'toolbox init-container' with non-existent flag (shows usage screen)" {
|
||||||
run $TOOLBOX init-container --foo
|
run "$TOOLBOX" init-container --foo
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: unknown flag: --foo"
|
assert_line --index 0 "Error: unknown flag: --foo"
|
||||||
|
@ -118,7 +118,7 @@ setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "help: Try to run 'toolbox list' with non-existent flag (shows usage screen)" {
|
@test "help: Try to run 'toolbox list' with non-existent flag (shows usage screen)" {
|
||||||
run $TOOLBOX list --foo
|
run "$TOOLBOX" list --foo
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: unknown flag: --foo"
|
assert_line --index 0 "Error: unknown flag: --foo"
|
||||||
|
@ -126,7 +126,7 @@ setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "help: Try to run 'toolbox rm' with non-existent flag (shows usage screen)" {
|
@test "help: Try to run 'toolbox rm' with non-existent flag (shows usage screen)" {
|
||||||
run $TOOLBOX rm --foo
|
run "$TOOLBOX" rm --foo
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: unknown flag: --foo"
|
assert_line --index 0 "Error: unknown flag: --foo"
|
||||||
|
@ -134,7 +134,7 @@ setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "help: Try to run 'toolbox rmi' with non-existent flag (shows usage screen)" {
|
@test "help: Try to run 'toolbox rmi' with non-existent flag (shows usage screen)" {
|
||||||
run $TOOLBOX rmi --foo
|
run "$TOOLBOX" rmi --foo
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: unknown flag: --foo"
|
assert_line --index 0 "Error: unknown flag: --foo"
|
||||||
|
@ -142,7 +142,7 @@ setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "help: Try to run 'toolbox run' with non-existent flag (shows usage screen)" {
|
@test "help: Try to run 'toolbox run' with non-existent flag (shows usage screen)" {
|
||||||
run $TOOLBOX run --foo
|
run "$TOOLBOX" run --foo
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: unknown flag: --foo"
|
assert_line --index 0 "Error: unknown flag: --foo"
|
||||||
|
|
|
@ -31,7 +31,7 @@ teardown() {
|
||||||
@test "create: Smoke test" {
|
@test "create: Smoke test" {
|
||||||
pull_default_image
|
pull_default_image
|
||||||
|
|
||||||
run $TOOLBOX --assumeyes create
|
run "$TOOLBOX" --assumeyes create
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ teardown() {
|
||||||
@test "create: With a custom name (using option --container)" {
|
@test "create: With a custom name (using option --container)" {
|
||||||
pull_default_image
|
pull_default_image
|
||||||
|
|
||||||
run $TOOLBOX --assumeyes create --container "custom-containerName"
|
run "$TOOLBOX" --assumeyes create --container "custom-containerName"
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
}
|
}
|
||||||
|
@ -47,13 +47,13 @@ teardown() {
|
||||||
@test "create: With a custom image and name (using option --container)" {
|
@test "create: With a custom image and name (using option --container)" {
|
||||||
pull_distro_image fedora 34
|
pull_distro_image fedora 34
|
||||||
|
|
||||||
run $TOOLBOX --assumeyes create --container "fedora34" --image fedora-toolbox:34
|
run "$TOOLBOX" --assumeyes create --container "fedora34" --image fedora-toolbox:34
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "create: Try with an invalid custom name (using positional argument)" {
|
@test "create: Try with an invalid custom name (using positional argument)" {
|
||||||
run $TOOLBOX --assumeyes create "ßpeci@l.N@m€"
|
run "$TOOLBOX" --assumeyes create "ßpeci@l.N@m€"
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for 'CONTAINER'"
|
assert_line --index 0 "Error: invalid argument for 'CONTAINER'"
|
||||||
|
@ -62,7 +62,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "create: Try with an invalid custom name (using option --container)" {
|
@test "create: Try with an invalid custom name (using option --container)" {
|
||||||
run $TOOLBOX --assumeyes create --container "ßpeci@l.N@m€"
|
run "$TOOLBOX" --assumeyes create --container "ßpeci@l.N@m€"
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for '--container'"
|
assert_line --index 0 "Error: invalid argument for '--container'"
|
||||||
|
@ -73,7 +73,7 @@ teardown() {
|
||||||
@test "create: Try with an invalid custom image" {
|
@test "create: Try with an invalid custom image" {
|
||||||
local image="ßpeci@l.N@m€"
|
local image="ßpeci@l.N@m€"
|
||||||
|
|
||||||
run $TOOLBOX create --image "$image"
|
run "$TOOLBOX" create --image "$image"
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for '--image'"
|
assert_line --index 0 "Error: invalid argument for '--image'"
|
||||||
|
@ -86,7 +86,7 @@ teardown() {
|
||||||
@test "create: Arch Linux" {
|
@test "create: Arch Linux" {
|
||||||
pull_distro_image arch latest
|
pull_distro_image arch latest
|
||||||
|
|
||||||
run $TOOLBOX --assumeyes create --distro arch
|
run "$TOOLBOX" --assumeyes create --distro arch
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert_output --partial "Created container: arch-toolbox-latest"
|
assert_output --partial "Created container: arch-toolbox-latest"
|
||||||
|
@ -100,7 +100,7 @@ teardown() {
|
||||||
@test "create: Arch Linux ('--release latest')" {
|
@test "create: Arch Linux ('--release latest')" {
|
||||||
pull_distro_image arch latest
|
pull_distro_image arch latest
|
||||||
|
|
||||||
run $TOOLBOX --assumeyes create --distro arch --release latest
|
run "$TOOLBOX" --assumeyes create --distro arch --release latest
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert_output --partial "Created container: arch-toolbox-latest"
|
assert_output --partial "Created container: arch-toolbox-latest"
|
||||||
|
@ -114,7 +114,7 @@ teardown() {
|
||||||
@test "create: Arch Linux ('--release rolling')" {
|
@test "create: Arch Linux ('--release rolling')" {
|
||||||
pull_distro_image arch latest
|
pull_distro_image arch latest
|
||||||
|
|
||||||
run $TOOLBOX --assumeyes create --distro arch --release rolling
|
run "$TOOLBOX" --assumeyes create --distro arch --release rolling
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert_output --partial "Created container: arch-toolbox-latest"
|
assert_output --partial "Created container: arch-toolbox-latest"
|
||||||
|
@ -128,7 +128,7 @@ teardown() {
|
||||||
@test "create: Fedora 34" {
|
@test "create: Fedora 34" {
|
||||||
pull_distro_image fedora 34
|
pull_distro_image fedora 34
|
||||||
|
|
||||||
run $TOOLBOX --assumeyes create --distro fedora --release f34
|
run "$TOOLBOX" --assumeyes create --distro fedora --release f34
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert_output --partial "Created container: fedora-toolbox-34"
|
assert_output --partial "Created container: fedora-toolbox-34"
|
||||||
|
@ -142,7 +142,7 @@ teardown() {
|
||||||
@test "create: RHEL 8.7" {
|
@test "create: RHEL 8.7" {
|
||||||
pull_distro_image rhel 8.7
|
pull_distro_image rhel 8.7
|
||||||
|
|
||||||
run $TOOLBOX --assumeyes create --distro rhel --release 8.7
|
run "$TOOLBOX" --assumeyes create --distro rhel --release 8.7
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert_output --partial "Created container: rhel-toolbox-8.7"
|
assert_output --partial "Created container: rhel-toolbox-8.7"
|
||||||
|
@ -156,7 +156,7 @@ teardown() {
|
||||||
@test "create: Ubuntu 16.04" {
|
@test "create: Ubuntu 16.04" {
|
||||||
pull_distro_image ubuntu 16.04
|
pull_distro_image ubuntu 16.04
|
||||||
|
|
||||||
run $TOOLBOX --assumeyes create --distro ubuntu --release 16.04
|
run "$TOOLBOX" --assumeyes create --distro ubuntu --release 16.04
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert_output --partial "Created container: ubuntu-toolbox-16.04"
|
assert_output --partial "Created container: ubuntu-toolbox-16.04"
|
||||||
|
@ -171,7 +171,7 @@ teardown() {
|
||||||
@test "create: Ubuntu 18.04" {
|
@test "create: Ubuntu 18.04" {
|
||||||
pull_distro_image ubuntu 18.04
|
pull_distro_image ubuntu 18.04
|
||||||
|
|
||||||
run $TOOLBOX --assumeyes create --distro ubuntu --release 18.04
|
run "$TOOLBOX" --assumeyes create --distro ubuntu --release 18.04
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert_output --partial "Created container: ubuntu-toolbox-18.04"
|
assert_output --partial "Created container: ubuntu-toolbox-18.04"
|
||||||
|
@ -186,7 +186,7 @@ teardown() {
|
||||||
@test "create: Ubuntu 20.04" {
|
@test "create: Ubuntu 20.04" {
|
||||||
pull_distro_image ubuntu 20.04
|
pull_distro_image ubuntu 20.04
|
||||||
|
|
||||||
run $TOOLBOX --assumeyes create --distro ubuntu --release 20.04
|
run "$TOOLBOX" --assumeyes create --distro ubuntu --release 20.04
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert_output --partial "Created container: ubuntu-toolbox-20.04"
|
assert_output --partial "Created container: ubuntu-toolbox-20.04"
|
||||||
|
@ -201,7 +201,7 @@ teardown() {
|
||||||
@test "create: Try an unsupported distribution" {
|
@test "create: Try an unsupported distribution" {
|
||||||
local distro="foo"
|
local distro="foo"
|
||||||
|
|
||||||
run $TOOLBOX --assumeyes create --distro "$distro"
|
run "$TOOLBOX" --assumeyes create --distro "$distro"
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for '--distro'"
|
assert_line --index 0 "Error: invalid argument for '--distro'"
|
||||||
|
@ -211,7 +211,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "create: Try a non-existent image" {
|
@test "create: Try a non-existent image" {
|
||||||
run $TOOLBOX --assumeyes create --image foo.org/bar
|
run "$TOOLBOX" --assumeyes create --image foo.org/bar
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: failed to pull image foo.org/bar"
|
assert_line --index 0 "Error: failed to pull image foo.org/bar"
|
||||||
|
@ -220,7 +220,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "create: Try Arch Linux with an invalid release ('--release foo')" {
|
@test "create: Try Arch Linux with an invalid release ('--release foo')" {
|
||||||
run $TOOLBOX --assumeyes create --distro arch --release foo
|
run "$TOOLBOX" --assumeyes create --distro arch --release foo
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for '--release'"
|
assert_line --index 0 "Error: invalid argument for '--release'"
|
||||||
|
@ -230,7 +230,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "create: Try Fedora with an invalid release ('--release -3')" {
|
@test "create: Try Fedora with an invalid release ('--release -3')" {
|
||||||
run $TOOLBOX --assumeyes create --distro fedora --release -3
|
run "$TOOLBOX" --assumeyes create --distro fedora --release -3
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for '--release'"
|
assert_line --index 0 "Error: invalid argument for '--release'"
|
||||||
|
@ -240,7 +240,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "create: Try Fedora with an invalid release ('--release -3.0')" {
|
@test "create: Try Fedora with an invalid release ('--release -3.0')" {
|
||||||
run $TOOLBOX --assumeyes create --distro fedora --release -3.0
|
run "$TOOLBOX" --assumeyes create --distro fedora --release -3.0
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for '--release'"
|
assert_line --index 0 "Error: invalid argument for '--release'"
|
||||||
|
@ -250,7 +250,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "create: Try Fedora with an invalid release ('--release -3.1')" {
|
@test "create: Try Fedora with an invalid release ('--release -3.1')" {
|
||||||
run $TOOLBOX --assumeyes create --distro fedora --release -3.1
|
run "$TOOLBOX" --assumeyes create --distro fedora --release -3.1
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for '--release'"
|
assert_line --index 0 "Error: invalid argument for '--release'"
|
||||||
|
@ -260,7 +260,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "create: Try Fedora with an invalid release ('--release 0')" {
|
@test "create: Try Fedora with an invalid release ('--release 0')" {
|
||||||
run $TOOLBOX --assumeyes create --distro fedora --release 0
|
run "$TOOLBOX" --assumeyes create --distro fedora --release 0
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for '--release'"
|
assert_line --index 0 "Error: invalid argument for '--release'"
|
||||||
|
@ -270,7 +270,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "create: Try Fedora with an invalid release ('--release 0.0')" {
|
@test "create: Try Fedora with an invalid release ('--release 0.0')" {
|
||||||
run $TOOLBOX --assumeyes create --distro fedora --release 0.0
|
run "$TOOLBOX" --assumeyes create --distro fedora --release 0.0
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for '--release'"
|
assert_line --index 0 "Error: invalid argument for '--release'"
|
||||||
|
@ -280,7 +280,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "create: Try Fedora with an invalid release ('--release 0.1')" {
|
@test "create: Try Fedora with an invalid release ('--release 0.1')" {
|
||||||
run $TOOLBOX --assumeyes create --distro fedora --release 0.1
|
run "$TOOLBOX" --assumeyes create --distro fedora --release 0.1
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for '--release'"
|
assert_line --index 0 "Error: invalid argument for '--release'"
|
||||||
|
@ -290,7 +290,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "create: Try Fedora with an invalid release ('--release 3.0')" {
|
@test "create: Try Fedora with an invalid release ('--release 3.0')" {
|
||||||
run $TOOLBOX --assumeyes create --distro fedora --release 3.0
|
run "$TOOLBOX" --assumeyes create --distro fedora --release 3.0
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for '--release'"
|
assert_line --index 0 "Error: invalid argument for '--release'"
|
||||||
|
@ -300,7 +300,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "create: Try Fedora with an invalid release ('--release 3.1')" {
|
@test "create: Try Fedora with an invalid release ('--release 3.1')" {
|
||||||
run $TOOLBOX --assumeyes create --distro fedora --release 3.1
|
run "$TOOLBOX" --assumeyes create --distro fedora --release 3.1
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for '--release'"
|
assert_line --index 0 "Error: invalid argument for '--release'"
|
||||||
|
@ -310,7 +310,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "create: Try Fedora with an invalid release ('--release foo')" {
|
@test "create: Try Fedora with an invalid release ('--release foo')" {
|
||||||
run $TOOLBOX --assumeyes create --distro fedora --release foo
|
run "$TOOLBOX" --assumeyes create --distro fedora --release foo
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for '--release'"
|
assert_line --index 0 "Error: invalid argument for '--release'"
|
||||||
|
@ -320,7 +320,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "create: Try Fedora with an invalid release ('--release 3foo')" {
|
@test "create: Try Fedora with an invalid release ('--release 3foo')" {
|
||||||
run $TOOLBOX --assumeyes create --distro fedora --release 3foo
|
run "$TOOLBOX" --assumeyes create --distro fedora --release 3foo
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for '--release'"
|
assert_line --index 0 "Error: invalid argument for '--release'"
|
||||||
|
@ -330,7 +330,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "create: Try RHEL with an invalid release ('--release 8')" {
|
@test "create: Try RHEL with an invalid release ('--release 8')" {
|
||||||
run $TOOLBOX --assumeyes create --distro rhel --release 8
|
run "$TOOLBOX" --assumeyes create --distro rhel --release 8
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for '--release'"
|
assert_line --index 0 "Error: invalid argument for '--release'"
|
||||||
|
@ -340,7 +340,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "create: Try RHEL with an invalid release ('--release 8.0.0')" {
|
@test "create: Try RHEL with an invalid release ('--release 8.0.0')" {
|
||||||
run $TOOLBOX --assumeyes create --distro rhel --release 8.0.0
|
run "$TOOLBOX" --assumeyes create --distro rhel --release 8.0.0
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for '--release'"
|
assert_line --index 0 "Error: invalid argument for '--release'"
|
||||||
|
@ -350,7 +350,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "create: Try RHEL with an invalid release ('--release 8.0.1')" {
|
@test "create: Try RHEL with an invalid release ('--release 8.0.1')" {
|
||||||
run $TOOLBOX --assumeyes create --distro rhel --release 8.0.1
|
run "$TOOLBOX" --assumeyes create --distro rhel --release 8.0.1
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for '--release'"
|
assert_line --index 0 "Error: invalid argument for '--release'"
|
||||||
|
@ -360,7 +360,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "create: Try RHEL with an invalid release ('--release 8.3.0')" {
|
@test "create: Try RHEL with an invalid release ('--release 8.3.0')" {
|
||||||
run $TOOLBOX --assumeyes create --distro rhel --release 8.3.0
|
run "$TOOLBOX" --assumeyes create --distro rhel --release 8.3.0
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for '--release'"
|
assert_line --index 0 "Error: invalid argument for '--release'"
|
||||||
|
@ -370,7 +370,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "create: Try RHEL with an invalid release ('--release 8.3.1')" {
|
@test "create: Try RHEL with an invalid release ('--release 8.3.1')" {
|
||||||
run $TOOLBOX --assumeyes create --distro rhel --release 8.3.1
|
run "$TOOLBOX" --assumeyes create --distro rhel --release 8.3.1
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for '--release'"
|
assert_line --index 0 "Error: invalid argument for '--release'"
|
||||||
|
@ -380,7 +380,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "create: Try RHEL with an invalid release ('--release foo')" {
|
@test "create: Try RHEL with an invalid release ('--release foo')" {
|
||||||
run $TOOLBOX --assumeyes create --distro rhel --release foo
|
run "$TOOLBOX" --assumeyes create --distro rhel --release foo
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for '--release'"
|
assert_line --index 0 "Error: invalid argument for '--release'"
|
||||||
|
@ -390,7 +390,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "create: Try RHEL with an invalid release ('--release 8.2foo')" {
|
@test "create: Try RHEL with an invalid release ('--release 8.2foo')" {
|
||||||
run $TOOLBOX --assumeyes create --distro rhel --release 8.2foo
|
run "$TOOLBOX" --assumeyes create --distro rhel --release 8.2foo
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for '--release'"
|
assert_line --index 0 "Error: invalid argument for '--release'"
|
||||||
|
@ -400,7 +400,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "create: Try RHEL with an invalid release ('--release -2.1')" {
|
@test "create: Try RHEL with an invalid release ('--release -2.1')" {
|
||||||
run $TOOLBOX --assumeyes create --distro rhel --release -2.1
|
run "$TOOLBOX" --assumeyes create --distro rhel --release -2.1
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for '--release'"
|
assert_line --index 0 "Error: invalid argument for '--release'"
|
||||||
|
@ -410,7 +410,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "create: Try RHEL with an invalid release ('--release -2.-1')" {
|
@test "create: Try RHEL with an invalid release ('--release -2.-1')" {
|
||||||
run $TOOLBOX --assumeyes create --distro rhel --release -2.-1
|
run "$TOOLBOX" --assumeyes create --distro rhel --release -2.-1
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for '--release'"
|
assert_line --index 0 "Error: invalid argument for '--release'"
|
||||||
|
@ -420,7 +420,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "create: Try RHEL with an invalid release ('--release 2.-1')" {
|
@test "create: Try RHEL with an invalid release ('--release 2.-1')" {
|
||||||
run $TOOLBOX --assumeyes create --distro rhel --release 2.-1
|
run "$TOOLBOX" --assumeyes create --distro rhel --release 2.-1
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for '--release'"
|
assert_line --index 0 "Error: invalid argument for '--release'"
|
||||||
|
@ -430,7 +430,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "create: Try Ubuntu with an invalid release ('--release 20')" {
|
@test "create: Try Ubuntu with an invalid release ('--release 20')" {
|
||||||
run $TOOLBOX --assumeyes create --distro ubuntu --release 20
|
run "$TOOLBOX" --assumeyes create --distro ubuntu --release 20
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for '--release'"
|
assert_line --index 0 "Error: invalid argument for '--release'"
|
||||||
|
@ -440,7 +440,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "create: Try Ubuntu with an invalid release ('--release 20.04.0')" {
|
@test "create: Try Ubuntu with an invalid release ('--release 20.04.0')" {
|
||||||
run $TOOLBOX --assumeyes create --distro ubuntu --release 20.04.0
|
run "$TOOLBOX" --assumeyes create --distro ubuntu --release 20.04.0
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for '--release'"
|
assert_line --index 0 "Error: invalid argument for '--release'"
|
||||||
|
@ -450,7 +450,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "create: Try Ubuntu with an invalid release ('--release 20.04.1')" {
|
@test "create: Try Ubuntu with an invalid release ('--release 20.04.1')" {
|
||||||
run $TOOLBOX --assumeyes create --distro ubuntu --release 20.04.1
|
run "$TOOLBOX" --assumeyes create --distro ubuntu --release 20.04.1
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for '--release'"
|
assert_line --index 0 "Error: invalid argument for '--release'"
|
||||||
|
@ -460,7 +460,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "create: Try Ubuntu with an invalid release ('--release foo')" {
|
@test "create: Try Ubuntu with an invalid release ('--release foo')" {
|
||||||
run $TOOLBOX --assumeyes create --distro ubuntu --release foo
|
run "$TOOLBOX" --assumeyes create --distro ubuntu --release foo
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for '--release'"
|
assert_line --index 0 "Error: invalid argument for '--release'"
|
||||||
|
@ -470,7 +470,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "create: Try Ubuntu with an invalid release ('--release 20foo')" {
|
@test "create: Try Ubuntu with an invalid release ('--release 20foo')" {
|
||||||
run $TOOLBOX --assumeyes create --distro ubuntu --release 20foo
|
run "$TOOLBOX" --assumeyes create --distro ubuntu --release 20foo
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for '--release'"
|
assert_line --index 0 "Error: invalid argument for '--release'"
|
||||||
|
@ -480,7 +480,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "create: Try Ubuntu with an invalid release ('--release foo.bar')" {
|
@test "create: Try Ubuntu with an invalid release ('--release foo.bar')" {
|
||||||
run $TOOLBOX --assumeyes create --distro ubuntu --release foo.bar
|
run "$TOOLBOX" --assumeyes create --distro ubuntu --release foo.bar
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for '--release'"
|
assert_line --index 0 "Error: invalid argument for '--release'"
|
||||||
|
@ -490,7 +490,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "create: Try Ubuntu with an invalid release ('--release foo.bar.baz')" {
|
@test "create: Try Ubuntu with an invalid release ('--release foo.bar.baz')" {
|
||||||
run $TOOLBOX --assumeyes create --distro ubuntu --release foo.bar.baz
|
run "$TOOLBOX" --assumeyes create --distro ubuntu --release foo.bar.baz
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for '--release'"
|
assert_line --index 0 "Error: invalid argument for '--release'"
|
||||||
|
@ -500,7 +500,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "create: Try Ubuntu with an invalid release ('--release 3.10')" {
|
@test "create: Try Ubuntu with an invalid release ('--release 3.10')" {
|
||||||
run $TOOLBOX --assumeyes create --distro ubuntu --release 3.10
|
run "$TOOLBOX" --assumeyes create --distro ubuntu --release 3.10
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for '--release'"
|
assert_line --index 0 "Error: invalid argument for '--release'"
|
||||||
|
@ -510,7 +510,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "create: Try Ubuntu with an invalid release ('--release 202.4')" {
|
@test "create: Try Ubuntu with an invalid release ('--release 202.4')" {
|
||||||
run $TOOLBOX --assumeyes create --distro ubuntu --release 202.4
|
run "$TOOLBOX" --assumeyes create --distro ubuntu --release 202.4
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for '--release'"
|
assert_line --index 0 "Error: invalid argument for '--release'"
|
||||||
|
@ -520,7 +520,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "create: Try Ubuntu with an invalid release ('--release 202.04')" {
|
@test "create: Try Ubuntu with an invalid release ('--release 202.04')" {
|
||||||
run $TOOLBOX --assumeyes create --distro ubuntu --release 202.04
|
run "$TOOLBOX" --assumeyes create --distro ubuntu --release 202.04
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for '--release'"
|
assert_line --index 0 "Error: invalid argument for '--release'"
|
||||||
|
@ -530,7 +530,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "create: Try Ubuntu with an invalid release ('--release 2020.4')" {
|
@test "create: Try Ubuntu with an invalid release ('--release 2020.4')" {
|
||||||
run $TOOLBOX --assumeyes create --distro ubuntu --release 2020.4
|
run "$TOOLBOX" --assumeyes create --distro ubuntu --release 2020.4
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for '--release'"
|
assert_line --index 0 "Error: invalid argument for '--release'"
|
||||||
|
@ -540,7 +540,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "create: Try Ubuntu with an invalid release ('--release 2020.04')" {
|
@test "create: Try Ubuntu with an invalid release ('--release 2020.04')" {
|
||||||
run $TOOLBOX --assumeyes create --distro ubuntu --release 2020.04
|
run "$TOOLBOX" --assumeyes create --distro ubuntu --release 2020.04
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for '--release'"
|
assert_line --index 0 "Error: invalid argument for '--release'"
|
||||||
|
@ -550,7 +550,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "create: Try Ubuntu with an invalid release ('--release 04.10')" {
|
@test "create: Try Ubuntu with an invalid release ('--release 04.10')" {
|
||||||
run $TOOLBOX --assumeyes create --distro ubuntu --release 04.10
|
run "$TOOLBOX" --assumeyes create --distro ubuntu --release 04.10
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for '--release'"
|
assert_line --index 0 "Error: invalid argument for '--release'"
|
||||||
|
@ -560,7 +560,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "create: Try Ubuntu with an invalid release ('--release 4.bar')" {
|
@test "create: Try Ubuntu with an invalid release ('--release 4.bar')" {
|
||||||
run $TOOLBOX --assumeyes create --distro ubuntu --release 4.bar
|
run "$TOOLBOX" --assumeyes create --distro ubuntu --release 4.bar
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for '--release'"
|
assert_line --index 0 "Error: invalid argument for '--release'"
|
||||||
|
@ -570,7 +570,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "create: Try Ubuntu with an invalid release ('--release 4.bar.baz')" {
|
@test "create: Try Ubuntu with an invalid release ('--release 4.bar.baz')" {
|
||||||
run $TOOLBOX --assumeyes create --distro ubuntu --release 4.bar.baz
|
run "$TOOLBOX" --assumeyes create --distro ubuntu --release 4.bar.baz
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for '--release'"
|
assert_line --index 0 "Error: invalid argument for '--release'"
|
||||||
|
@ -580,7 +580,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "create: Try Ubuntu with an invalid release ('--release 4.0')" {
|
@test "create: Try Ubuntu with an invalid release ('--release 4.0')" {
|
||||||
run $TOOLBOX --assumeyes create --distro ubuntu --release 4.0
|
run "$TOOLBOX" --assumeyes create --distro ubuntu --release 4.0
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for '--release'"
|
assert_line --index 0 "Error: invalid argument for '--release'"
|
||||||
|
@ -590,7 +590,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "create: Try Ubuntu with an invalid release ('--release 4.00')" {
|
@test "create: Try Ubuntu with an invalid release ('--release 4.00')" {
|
||||||
run $TOOLBOX --assumeyes create --distro ubuntu --release 4.00
|
run "$TOOLBOX" --assumeyes create --distro ubuntu --release 4.00
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for '--release'"
|
assert_line --index 0 "Error: invalid argument for '--release'"
|
||||||
|
@ -600,7 +600,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "create: Try Ubuntu with an invalid release ('--release 4.13')" {
|
@test "create: Try Ubuntu with an invalid release ('--release 4.13')" {
|
||||||
run $TOOLBOX --assumeyes create --distro ubuntu --release 4.13
|
run "$TOOLBOX" --assumeyes create --distro ubuntu --release 4.13
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for '--release'"
|
assert_line --index 0 "Error: invalid argument for '--release'"
|
||||||
|
@ -610,7 +610,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "create: Try Ubuntu with an invalid release ('--release 20.4')" {
|
@test "create: Try Ubuntu with an invalid release ('--release 20.4')" {
|
||||||
run $TOOLBOX --assumeyes create --distro ubuntu --release 20.4
|
run "$TOOLBOX" --assumeyes create --distro ubuntu --release 20.4
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: invalid argument for '--release'"
|
assert_line --index 0 "Error: invalid argument for '--release'"
|
||||||
|
@ -627,7 +627,7 @@ teardown() {
|
||||||
distro="rhel"
|
distro="rhel"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
run $TOOLBOX --assumeyes create --distro "$distro"
|
run "$TOOLBOX" --assumeyes create --distro "$distro"
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: option '--release' is needed"
|
assert_line --index 0 "Error: option '--release' is needed"
|
||||||
|
@ -639,7 +639,7 @@ teardown() {
|
||||||
@test "create: Try using both --distro and --image" {
|
@test "create: Try using both --distro and --image" {
|
||||||
pull_distro_image fedora 34
|
pull_distro_image fedora 34
|
||||||
|
|
||||||
run $TOOLBOX --assumeyes create --distro fedora --image fedora-toolbox:34
|
run "$TOOLBOX" --assumeyes create --distro fedora --image fedora-toolbox:34
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: options --distro and --image cannot be used together"
|
assert_line --index 0 "Error: options --distro and --image cannot be used together"
|
||||||
|
@ -650,7 +650,7 @@ teardown() {
|
||||||
@test "create: Try using both --image and --release" {
|
@test "create: Try using both --image and --release" {
|
||||||
pull_distro_image fedora 34
|
pull_distro_image fedora 34
|
||||||
|
|
||||||
run $TOOLBOX --assumeyes create --image fedora-toolbox:34 --release 34
|
run "$TOOLBOX" --assumeyes create --image fedora-toolbox:34 --release 34
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: options --image and --release cannot be used together"
|
assert_line --index 0 "Error: options --image and --release cannot be used together"
|
||||||
|
@ -661,7 +661,7 @@ teardown() {
|
||||||
@test "create: Try a non-existent authentication file" {
|
@test "create: Try a non-existent authentication file" {
|
||||||
local file="$BATS_RUN_TMPDIR/non-existent-file"
|
local file="$BATS_RUN_TMPDIR/non-existent-file"
|
||||||
|
|
||||||
run $TOOLBOX create --authfile "$file"
|
run "$TOOLBOX" create --authfile "$file"
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: file $file not found"
|
assert_line --index 0 "Error: file $file not found"
|
||||||
|
@ -677,7 +677,7 @@ teardown() {
|
||||||
run $PODMAN login --authfile "$authfile" --username user --password user "$DOCKER_REG_URI"
|
run $PODMAN login --authfile "$authfile" --username user --password user "$DOCKER_REG_URI"
|
||||||
assert_success
|
assert_success
|
||||||
|
|
||||||
run $TOOLBOX --assumeyes create --image "$DOCKER_REG_URI/$image"
|
run "$TOOLBOX" --assumeyes create --image "$DOCKER_REG_URI/$image"
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_line --index 0 "Error: failed to pull image $DOCKER_REG_URI/$image"
|
assert_line --index 0 "Error: failed to pull image $DOCKER_REG_URI/$image"
|
||||||
|
@ -685,7 +685,7 @@ teardown() {
|
||||||
assert_line --index 2 "Use 'toolbox --verbose ...' for further details."
|
assert_line --index 2 "Use 'toolbox --verbose ...' for further details."
|
||||||
assert [ ${#lines[@]} -eq 3 ]
|
assert [ ${#lines[@]} -eq 3 ]
|
||||||
|
|
||||||
run $TOOLBOX --assumeyes create --authfile "$authfile" --image "$DOCKER_REG_URI/$image"
|
run "$TOOLBOX" --assumeyes create --authfile "$authfile" --image "$DOCKER_REG_URI/$image"
|
||||||
|
|
||||||
rm "$authfile"
|
rm "$authfile"
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "list: Smoke test" {
|
@test "list: Smoke test" {
|
||||||
run --keep-empty-lines --separate-stderr $TOOLBOX list
|
run --keep-empty-lines --separate-stderr "$TOOLBOX" list
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -38,7 +38,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "list: Smoke test (using --containers)" {
|
@test "list: Smoke test (using --containers)" {
|
||||||
run --keep-empty-lines --separate-stderr $TOOLBOX list --containers
|
run --keep-empty-lines --separate-stderr "$TOOLBOX" list --containers
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -46,7 +46,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "list: Smoke test (using --images)" {
|
@test "list: Smoke test (using --images)" {
|
||||||
run --keep-empty-lines --separate-stderr $TOOLBOX list --images
|
run --keep-empty-lines --separate-stderr "$TOOLBOX" list --images
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -60,7 +60,7 @@ teardown() {
|
||||||
num_of_images="$(list_images)"
|
num_of_images="$(list_images)"
|
||||||
assert_equal "$num_of_images" 1
|
assert_equal "$num_of_images" 1
|
||||||
|
|
||||||
run --keep-empty-lines --separate-stderr $TOOLBOX list
|
run --keep-empty-lines --separate-stderr "$TOOLBOX" list
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -74,7 +74,7 @@ teardown() {
|
||||||
num_of_images="$(list_images)"
|
num_of_images="$(list_images)"
|
||||||
assert_equal "$num_of_images" 1
|
assert_equal "$num_of_images" 1
|
||||||
|
|
||||||
run --keep-empty-lines --separate-stderr $TOOLBOX list --images
|
run --keep-empty-lines --separate-stderr "$TOOLBOX" list --images
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -376,7 +376,7 @@ teardown() {
|
||||||
num_of_images="$(list_images)"
|
num_of_images="$(list_images)"
|
||||||
assert_equal "$num_of_images" 1
|
assert_equal "$num_of_images" 1
|
||||||
|
|
||||||
run --keep-empty-lines --separate-stderr $TOOLBOX list
|
run --keep-empty-lines --separate-stderr "$TOOLBOX" list
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert_line --index 1 --partial "<none>"
|
assert_line --index 1 --partial "<none>"
|
||||||
|
@ -397,7 +397,7 @@ teardown() {
|
||||||
num_of_images="$(list_images)"
|
num_of_images="$(list_images)"
|
||||||
assert_equal "$num_of_images" 1
|
assert_equal "$num_of_images" 1
|
||||||
|
|
||||||
run --keep-empty-lines --separate-stderr $TOOLBOX list --images
|
run --keep-empty-lines --separate-stderr "$TOOLBOX" list --images
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert_line --index 1 --partial "<none>"
|
assert_line --index 1 --partial "<none>"
|
||||||
|
@ -470,7 +470,7 @@ teardown() {
|
||||||
create_container non-default-two
|
create_container non-default-two
|
||||||
|
|
||||||
# Check images
|
# Check images
|
||||||
run --keep-empty-lines --separate-stderr $TOOLBOX list --images
|
run --keep-empty-lines --separate-stderr "$TOOLBOX" list --images
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert_line --index 1 --partial "registry.fedoraproject.org/fedora-toolbox:34"
|
assert_line --index 1 --partial "registry.fedoraproject.org/fedora-toolbox:34"
|
||||||
|
@ -479,7 +479,7 @@ teardown() {
|
||||||
assert [ ${#stderr_lines[@]} -eq 0 ]
|
assert [ ${#stderr_lines[@]} -eq 0 ]
|
||||||
|
|
||||||
# Check containers
|
# Check containers
|
||||||
run --keep-empty-lines --separate-stderr $TOOLBOX list --containers
|
run --keep-empty-lines --separate-stderr "$TOOLBOX" list --containers
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert_line --index 1 --partial "$default_container"
|
assert_line --index 1 --partial "$default_container"
|
||||||
|
@ -489,7 +489,7 @@ teardown() {
|
||||||
assert [ ${#stderr_lines[@]} -eq 0 ]
|
assert [ ${#stderr_lines[@]} -eq 0 ]
|
||||||
|
|
||||||
# Check all together
|
# Check all together
|
||||||
run --keep-empty-lines --separate-stderr $TOOLBOX list
|
run --keep-empty-lines --separate-stderr "$TOOLBOX" list
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert_line --index 1 --partial "registry.fedoraproject.org/fedora-toolbox:34"
|
assert_line --index 1 --partial "registry.fedoraproject.org/fedora-toolbox:34"
|
||||||
|
@ -557,7 +557,7 @@ teardown() {
|
||||||
num_of_containers="$(list_containers)"
|
num_of_containers="$(list_containers)"
|
||||||
assert_equal "$num_of_containers" 1
|
assert_equal "$num_of_containers" 1
|
||||||
|
|
||||||
run --keep-empty-lines --separate-stderr $TOOLBOX list
|
run --keep-empty-lines --separate-stderr "$TOOLBOX" list
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -580,7 +580,7 @@ teardown() {
|
||||||
num_of_containers="$(list_containers)"
|
num_of_containers="$(list_containers)"
|
||||||
assert_equal "$num_of_containers" 1
|
assert_equal "$num_of_containers" 1
|
||||||
|
|
||||||
run --keep-empty-lines --separate-stderr $TOOLBOX list --containers
|
run --keep-empty-lines --separate-stderr "$TOOLBOX" list --containers
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -603,7 +603,7 @@ teardown() {
|
||||||
num_of_containers="$(list_containers)"
|
num_of_containers="$(list_containers)"
|
||||||
assert_equal "$num_of_containers" 1
|
assert_equal "$num_of_containers" 1
|
||||||
|
|
||||||
run --keep-empty-lines --separate-stderr $TOOLBOX list --images
|
run --keep-empty-lines --separate-stderr "$TOOLBOX" list --images
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
|
|
@ -34,7 +34,7 @@ teardown() {
|
||||||
|
|
||||||
create_default_container
|
create_default_container
|
||||||
|
|
||||||
run container_started $CONTAINER_NAME
|
run container_started "$CONTAINER_NAME"
|
||||||
assert_success
|
assert_success
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ teardown() {
|
||||||
@test "run: Smoke test with true(1)" {
|
@test "run: Smoke test with true(1)" {
|
||||||
create_default_container
|
create_default_container
|
||||||
|
|
||||||
run $TOOLBOX run true
|
run "$TOOLBOX" run true
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert_output ""
|
assert_output ""
|
||||||
|
@ -41,7 +41,7 @@ teardown() {
|
||||||
@test "run: Smoke test with false(1)" {
|
@test "run: Smoke test with false(1)" {
|
||||||
create_default_container
|
create_default_container
|
||||||
|
|
||||||
run -1 $TOOLBOX run false
|
run -1 "$TOOLBOX" run false
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_output ""
|
assert_output ""
|
||||||
|
@ -50,7 +50,7 @@ teardown() {
|
||||||
@test "run: Smoke test with Arch Linux" {
|
@test "run: Smoke test with Arch Linux" {
|
||||||
create_distro_container arch latest arch-toolbox-latest
|
create_distro_container arch latest arch-toolbox-latest
|
||||||
|
|
||||||
run --separate-stderr $TOOLBOX run --distro arch true
|
run --separate-stderr "$TOOLBOX" run --distro arch true
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -60,7 +60,7 @@ teardown() {
|
||||||
@test "run: Smoke test with Arch Linux ('--release latest')" {
|
@test "run: Smoke test with Arch Linux ('--release latest')" {
|
||||||
create_distro_container arch latest arch-toolbox-latest
|
create_distro_container arch latest arch-toolbox-latest
|
||||||
|
|
||||||
run --separate-stderr $TOOLBOX run --distro arch --release latest true
|
run --separate-stderr "$TOOLBOX" run --distro arch --release latest true
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -70,7 +70,7 @@ teardown() {
|
||||||
@test "run: Smoke test with Arch Linux ('--release rolling')" {
|
@test "run: Smoke test with Arch Linux ('--release rolling')" {
|
||||||
create_distro_container arch latest arch-toolbox-latest
|
create_distro_container arch latest arch-toolbox-latest
|
||||||
|
|
||||||
run --separate-stderr $TOOLBOX run --distro arch --release rolling true
|
run --separate-stderr "$TOOLBOX" run --distro arch --release rolling true
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -80,7 +80,7 @@ teardown() {
|
||||||
@test "run: Smoke test with Fedora 34" {
|
@test "run: Smoke test with Fedora 34" {
|
||||||
create_distro_container fedora 34 fedora-toolbox-34
|
create_distro_container fedora 34 fedora-toolbox-34
|
||||||
|
|
||||||
run --separate-stderr $TOOLBOX run --distro fedora --release 34 true
|
run --separate-stderr "$TOOLBOX" run --distro fedora --release 34 true
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -90,7 +90,7 @@ teardown() {
|
||||||
@test "run: Smoke test with RHEL 8.7" {
|
@test "run: Smoke test with RHEL 8.7" {
|
||||||
create_distro_container rhel 8.7 rhel-toolbox-8.7
|
create_distro_container rhel 8.7 rhel-toolbox-8.7
|
||||||
|
|
||||||
run --separate-stderr $TOOLBOX run --distro rhel --release 8.7 true
|
run --separate-stderr "$TOOLBOX" run --distro rhel --release 8.7 true
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -100,7 +100,7 @@ teardown() {
|
||||||
@test "run: Smoke test with Ubuntu 16.04" {
|
@test "run: Smoke test with Ubuntu 16.04" {
|
||||||
create_distro_container ubuntu 16.04 ubuntu-toolbox-16.04
|
create_distro_container ubuntu 16.04 ubuntu-toolbox-16.04
|
||||||
|
|
||||||
run --separate-stderr $TOOLBOX run --distro ubuntu --release 16.04 true
|
run --separate-stderr "$TOOLBOX" run --distro ubuntu --release 16.04 true
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -110,7 +110,7 @@ teardown() {
|
||||||
@test "run: Smoke test with Ubuntu 18.04" {
|
@test "run: Smoke test with Ubuntu 18.04" {
|
||||||
create_distro_container ubuntu 18.04 ubuntu-toolbox-18.04
|
create_distro_container ubuntu 18.04 ubuntu-toolbox-18.04
|
||||||
|
|
||||||
run --separate-stderr $TOOLBOX run --distro ubuntu --release 18.04 true
|
run --separate-stderr "$TOOLBOX" run --distro ubuntu --release 18.04 true
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -120,7 +120,7 @@ teardown() {
|
||||||
@test "run: Smoke test with Ubuntu 20.04" {
|
@test "run: Smoke test with Ubuntu 20.04" {
|
||||||
create_distro_container ubuntu 20.04 ubuntu-toolbox-20.04
|
create_distro_container ubuntu 20.04 ubuntu-toolbox-20.04
|
||||||
|
|
||||||
run --separate-stderr $TOOLBOX run --distro ubuntu --release 20.04 true
|
run --separate-stderr "$TOOLBOX" run --distro ubuntu --release 20.04 true
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -133,7 +133,7 @@ teardown() {
|
||||||
cp "$HOME"/.bash_profile "$HOME"/.bash_profile.orig
|
cp "$HOME"/.bash_profile "$HOME"/.bash_profile.orig
|
||||||
echo "echo \"~/.bash_profile read\"" >>"$HOME"/.bash_profile
|
echo "echo \"~/.bash_profile read\"" >>"$HOME"/.bash_profile
|
||||||
|
|
||||||
run $TOOLBOX run true
|
run "$TOOLBOX" run true
|
||||||
|
|
||||||
mv "$HOME"/.bash_profile.orig "$HOME"/.bash_profile
|
mv "$HOME"/.bash_profile.orig "$HOME"/.bash_profile
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ teardown() {
|
||||||
@test "run: 'echo \"Hello World\"' inside the default container" {
|
@test "run: 'echo \"Hello World\"' inside the default container" {
|
||||||
create_default_container
|
create_default_container
|
||||||
|
|
||||||
run $TOOLBOX --verbose run echo "Hello World"
|
run "$TOOLBOX" --verbose run echo "Hello World"
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert_line --index $((${#lines[@]}-1)) "Hello World"
|
assert_line --index $((${#lines[@]}-1)) "Hello World"
|
||||||
|
@ -157,7 +157,7 @@ teardown() {
|
||||||
start_container running
|
start_container running
|
||||||
stop_container running
|
stop_container running
|
||||||
|
|
||||||
run $TOOLBOX --verbose run --container running echo "Hello World"
|
run "$TOOLBOX" --verbose run --container running echo "Hello World"
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert_line --index $((${#lines[@]}-1)) "Hello World"
|
assert_line --index $((${#lines[@]}-1)) "Hello World"
|
||||||
|
@ -166,13 +166,13 @@ teardown() {
|
||||||
@test "run: 'sudo id' inside the default container" {
|
@test "run: 'sudo id' inside the default container" {
|
||||||
create_default_container
|
create_default_container
|
||||||
|
|
||||||
output="$($TOOLBOX --verbose run sudo id 2>$BATS_TEST_TMPDIR/stderr)"
|
output="$("$TOOLBOX" --verbose run sudo id 2>"$BATS_TEST_TMPDIR/stderr")"
|
||||||
status="$?"
|
status="$?"
|
||||||
|
|
||||||
echo "# stderr"
|
echo "# stderr"
|
||||||
cat $BATS_TEST_TMPDIR/stderr
|
cat "$BATS_TEST_TMPDIR/stderr"
|
||||||
echo "# stdout"
|
echo "# stdout"
|
||||||
echo $output
|
echo "$output"
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert_output --partial "uid=0(root)"
|
assert_output --partial "uid=0(root)"
|
||||||
|
@ -181,7 +181,7 @@ teardown() {
|
||||||
@test "run: Ensure that /run/.containerenv exists" {
|
@test "run: Ensure that /run/.containerenv exists" {
|
||||||
create_default_container
|
create_default_container
|
||||||
|
|
||||||
run --separate-stderr $TOOLBOX run cat /run/.containerenv
|
run --separate-stderr "$TOOLBOX" run cat /run/.containerenv
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert [ ${#lines[@]} -gt 0 ]
|
assert [ ${#lines[@]} -gt 0 ]
|
||||||
|
@ -191,7 +191,7 @@ teardown() {
|
||||||
@test "run: Ensure that /run/.toolboxenv exists" {
|
@test "run: Ensure that /run/.toolboxenv exists" {
|
||||||
create_default_container
|
create_default_container
|
||||||
|
|
||||||
run --separate-stderr $TOOLBOX run test -f /run/.toolboxenv
|
run --separate-stderr "$TOOLBOX" run test -f /run/.toolboxenv
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -205,7 +205,7 @@ teardown() {
|
||||||
create_default_container
|
create_default_container
|
||||||
create_container other-container
|
create_container other-container
|
||||||
|
|
||||||
run --separate-stderr $TOOLBOX run cat /run/.containerenv
|
run --separate-stderr "$TOOLBOX" run cat /run/.containerenv
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert [ ${#lines[@]} -gt 0 ]
|
assert [ ${#lines[@]} -gt 0 ]
|
||||||
|
@ -229,7 +229,7 @@ teardown() {
|
||||||
create_default_container
|
create_default_container
|
||||||
create_container other-container
|
create_container other-container
|
||||||
|
|
||||||
run --separate-stderr $TOOLBOX run --container other-container cat /run/.containerenv
|
run --separate-stderr "$TOOLBOX" run --container other-container cat /run/.containerenv
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert [ ${#lines[@]} -gt 0 ]
|
assert [ ${#lines[@]} -gt 0 ]
|
||||||
|
@ -248,7 +248,7 @@ teardown() {
|
||||||
create_default_container
|
create_default_container
|
||||||
|
|
||||||
pushd /etc/kernel
|
pushd /etc/kernel
|
||||||
run --separate-stderr $TOOLBOX run pwd
|
run --separate-stderr "$TOOLBOX" run pwd
|
||||||
popd
|
popd
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
|
@ -264,7 +264,7 @@ teardown() {
|
||||||
create_default_container
|
create_default_container
|
||||||
|
|
||||||
# File descriptors 3 and 4 are reserved by Bats.
|
# File descriptors 3 and 4 are reserved by Bats.
|
||||||
run --separate-stderr $TOOLBOX run --preserve-fds 3 readlink /proc/self/fd/5 5>/dev/null
|
run --separate-stderr "$TOOLBOX" run --preserve-fds 3 readlink /proc/self/fd/5 5>/dev/null
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert_line --index 0 "/dev/null"
|
assert_line --index 0 "/dev/null"
|
||||||
|
@ -275,7 +275,7 @@ teardown() {
|
||||||
@test "run: Try the non-existent default container with none other present" {
|
@test "run: Try the non-existent default container with none other present" {
|
||||||
local default_container_name="$(get_system_id)-toolbox-$(get_system_version)"
|
local default_container_name="$(get_system_id)-toolbox-$(get_system_version)"
|
||||||
|
|
||||||
run --separate-stderr $TOOLBOX run true
|
run --separate-stderr "$TOOLBOX" run true
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -291,7 +291,7 @@ teardown() {
|
||||||
|
|
||||||
create_container other-container
|
create_container other-container
|
||||||
|
|
||||||
run --separate-stderr $TOOLBOX run true
|
run --separate-stderr "$TOOLBOX" run true
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -305,7 +305,7 @@ teardown() {
|
||||||
@test "run: Try a specific non-existent container with another present" {
|
@test "run: Try a specific non-existent container with another present" {
|
||||||
create_container other-container
|
create_container other-container
|
||||||
|
|
||||||
run --separate-stderr $TOOLBOX run --container wrong-container true
|
run --separate-stderr "$TOOLBOX" run --container wrong-container true
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -319,7 +319,7 @@ teardown() {
|
||||||
@test "run: Try an unsupported distribution" {
|
@test "run: Try an unsupported distribution" {
|
||||||
local distro="foo"
|
local distro="foo"
|
||||||
|
|
||||||
run --separate-stderr $TOOLBOX --assumeyes run --distro "$distro" ls
|
run --separate-stderr "$TOOLBOX" --assumeyes run --distro "$distro" ls
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -331,7 +331,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "run: Try Fedora with an invalid release ('--release -3')" {
|
@test "run: Try Fedora with an invalid release ('--release -3')" {
|
||||||
run --separate-stderr $TOOLBOX run --distro fedora --release -3 ls
|
run --separate-stderr "$TOOLBOX" run --distro fedora --release -3 ls
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -343,7 +343,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "run: Try Fedora with an invalid release ('--release -3.0')" {
|
@test "run: Try Fedora with an invalid release ('--release -3.0')" {
|
||||||
run --separate-stderr $TOOLBOX run --distro fedora --release -3.0 ls
|
run --separate-stderr "$TOOLBOX" run --distro fedora --release -3.0 ls
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -355,7 +355,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "run: Try Fedora with an invalid release ('--release -3.1')" {
|
@test "run: Try Fedora with an invalid release ('--release -3.1')" {
|
||||||
run --separate-stderr $TOOLBOX run --distro fedora --release -3.1 ls
|
run --separate-stderr "$TOOLBOX" run --distro fedora --release -3.1 ls
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -367,7 +367,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "run: Try Fedora with an invalid release ('--release 0')" {
|
@test "run: Try Fedora with an invalid release ('--release 0')" {
|
||||||
run --separate-stderr $TOOLBOX run --distro fedora --release 0 ls
|
run --separate-stderr "$TOOLBOX" run --distro fedora --release 0 ls
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -379,7 +379,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "run: Try Fedora with an invalid release ('--release 0.0')" {
|
@test "run: Try Fedora with an invalid release ('--release 0.0')" {
|
||||||
run --separate-stderr $TOOLBOX run --distro fedora --release 0.0 ls
|
run --separate-stderr "$TOOLBOX" run --distro fedora --release 0.0 ls
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -391,7 +391,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "run: Try Fedora with an invalid release ('--release 0.1')" {
|
@test "run: Try Fedora with an invalid release ('--release 0.1')" {
|
||||||
run --separate-stderr $TOOLBOX run --distro fedora --release 0.1 ls
|
run --separate-stderr "$TOOLBOX" run --distro fedora --release 0.1 ls
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -403,7 +403,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "run: Try Fedora with an invalid release ('--release 3.0')" {
|
@test "run: Try Fedora with an invalid release ('--release 3.0')" {
|
||||||
run --separate-stderr $TOOLBOX run --distro fedora --release 3.0 ls
|
run --separate-stderr "$TOOLBOX" run --distro fedora --release 3.0 ls
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -415,7 +415,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "run: Try Fedora with an invalid release ('--release 3.1')" {
|
@test "run: Try Fedora with an invalid release ('--release 3.1')" {
|
||||||
run --separate-stderr $TOOLBOX run --distro fedora --release 3.1 ls
|
run --separate-stderr "$TOOLBOX" run --distro fedora --release 3.1 ls
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -427,7 +427,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "run: Try Fedora with an invalid release ('--release foo')" {
|
@test "run: Try Fedora with an invalid release ('--release foo')" {
|
||||||
run --separate-stderr $TOOLBOX run --distro fedora --release foo ls
|
run --separate-stderr "$TOOLBOX" run --distro fedora --release foo ls
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -439,7 +439,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "run: Try Fedora with an invalid release ('--release 3foo')" {
|
@test "run: Try Fedora with an invalid release ('--release 3foo')" {
|
||||||
run --separate-stderr $TOOLBOX run --distro fedora --release 3foo ls
|
run --separate-stderr "$TOOLBOX" run --distro fedora --release 3foo ls
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -451,7 +451,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "run: Try RHEL with an invalid release ('--release 8')" {
|
@test "run: Try RHEL with an invalid release ('--release 8')" {
|
||||||
run --separate-stderr $TOOLBOX run --distro rhel --release 8 ls
|
run --separate-stderr "$TOOLBOX" run --distro rhel --release 8 ls
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -463,7 +463,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "run: Try RHEL with an invalid release ('--release 8.0.0')" {
|
@test "run: Try RHEL with an invalid release ('--release 8.0.0')" {
|
||||||
run --separate-stderr $TOOLBOX run --distro rhel --release 8.0.0 ls
|
run --separate-stderr "$TOOLBOX" run --distro rhel --release 8.0.0 ls
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -475,7 +475,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "run: Try RHEL with an invalid release ('--release 8.0.1')" {
|
@test "run: Try RHEL with an invalid release ('--release 8.0.1')" {
|
||||||
run --separate-stderr $TOOLBOX run --distro rhel --release 8.0.1 ls
|
run --separate-stderr "$TOOLBOX" run --distro rhel --release 8.0.1 ls
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -487,7 +487,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "run: Try RHEL with an invalid release ('--release 8.3.0')" {
|
@test "run: Try RHEL with an invalid release ('--release 8.3.0')" {
|
||||||
run --separate-stderr $TOOLBOX run --distro rhel --release 8.3.0 ls
|
run --separate-stderr "$TOOLBOX" run --distro rhel --release 8.3.0 ls
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -499,7 +499,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "run: Try RHEL with an invalid release ('--release 8.3.1')" {
|
@test "run: Try RHEL with an invalid release ('--release 8.3.1')" {
|
||||||
run --separate-stderr $TOOLBOX run --distro rhel --release 8.3.1 ls
|
run --separate-stderr "$TOOLBOX" run --distro rhel --release 8.3.1 ls
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -511,7 +511,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "run: Try RHEL with an invalid release ('--release foo')" {
|
@test "run: Try RHEL with an invalid release ('--release foo')" {
|
||||||
run --separate-stderr $TOOLBOX run --distro rhel --release foo ls
|
run --separate-stderr "$TOOLBOX" run --distro rhel --release foo ls
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -523,7 +523,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "run: Try RHEL with an invalid release ('--release 8.2foo')" {
|
@test "run: Try RHEL with an invalid release ('--release 8.2foo')" {
|
||||||
run --separate-stderr $TOOLBOX run --distro rhel --release 8.2foo ls
|
run --separate-stderr "$TOOLBOX" run --distro rhel --release 8.2foo ls
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -535,7 +535,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "run: Try RHEL with an invalid release ('--release -2.1')" {
|
@test "run: Try RHEL with an invalid release ('--release -2.1')" {
|
||||||
run --separate-stderr $TOOLBOX run --distro rhel --release -2.1 ls
|
run --separate-stderr "$TOOLBOX" run --distro rhel --release -2.1 ls
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -547,7 +547,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "run: Try RHEL with an invalid release ('--release -2.-1')" {
|
@test "run: Try RHEL with an invalid release ('--release -2.-1')" {
|
||||||
run --separate-stderr $TOOLBOX run --distro rhel --release -2.-1 ls
|
run --separate-stderr "$TOOLBOX" run --distro rhel --release -2.-1 ls
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -559,7 +559,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "run: Try RHEL with an invalid release ('--release 2.-1')" {
|
@test "run: Try RHEL with an invalid release ('--release 2.-1')" {
|
||||||
run --separate-stderr $TOOLBOX run --distro rhel --release 2.-1 ls
|
run --separate-stderr "$TOOLBOX" run --distro rhel --release 2.-1 ls
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -578,7 +578,7 @@ teardown() {
|
||||||
distro="rhel"
|
distro="rhel"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
run --separate-stderr $TOOLBOX run --distro "$distro" ls
|
run --separate-stderr "$TOOLBOX" run --distro "$distro" ls
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -592,7 +592,7 @@ teardown() {
|
||||||
@test "run: Smoke test with 'exit 2'" {
|
@test "run: Smoke test with 'exit 2'" {
|
||||||
create_default_container
|
create_default_container
|
||||||
|
|
||||||
run -2 $TOOLBOX run /bin/sh -c 'exit 2'
|
run -2 "$TOOLBOX" run /bin/sh -c 'exit 2'
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_output ""
|
assert_output ""
|
||||||
}
|
}
|
||||||
|
@ -602,7 +602,7 @@ teardown() {
|
||||||
create_default_container
|
create_default_container
|
||||||
|
|
||||||
# File descriptors 3 and 4 are reserved by Bats.
|
# File descriptors 3 and 4 are reserved by Bats.
|
||||||
run -125 --separate-stderr $TOOLBOX run --preserve-fds 3 readlink /proc/self/fd/5
|
run -125 --separate-stderr "$TOOLBOX" run --preserve-fds 3 readlink /proc/self/fd/5
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -615,7 +615,7 @@ teardown() {
|
||||||
@test "run: Try /etc as a command" {
|
@test "run: Try /etc as a command" {
|
||||||
create_default_container
|
create_default_container
|
||||||
|
|
||||||
run -126 --separate-stderr $TOOLBOX run /etc
|
run -126 --separate-stderr "$TOOLBOX" run /etc
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -631,7 +631,7 @@ teardown() {
|
||||||
|
|
||||||
create_default_container
|
create_default_container
|
||||||
|
|
||||||
run -127 --separate-stderr $TOOLBOX run $cmd
|
run -127 --separate-stderr "$TOOLBOX" run "$cmd"
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
|
|
@ -31,7 +31,7 @@ teardown() {
|
||||||
|
|
||||||
@test "rm: Try to remove a non-existent container" {
|
@test "rm: Try to remove a non-existent container" {
|
||||||
container_name="nonexistentcontainer"
|
container_name="nonexistentcontainer"
|
||||||
run $TOOLBOX rm "$container_name"
|
run "$TOOLBOX" rm "$container_name"
|
||||||
|
|
||||||
#assert_failure #BUG: it should return 1
|
#assert_failure #BUG: it should return 1
|
||||||
assert_output "Error: failed to inspect container $container_name"
|
assert_output "Error: failed to inspect container $container_name"
|
||||||
|
@ -42,7 +42,7 @@ teardown() {
|
||||||
create_container running
|
create_container running
|
||||||
start_container running
|
start_container running
|
||||||
|
|
||||||
run $TOOLBOX rm running
|
run "$TOOLBOX" rm running
|
||||||
|
|
||||||
#assert_failure #BUG: it should return 1
|
#assert_failure #BUG: it should return 1
|
||||||
assert_output "Error: container running is running"
|
assert_output "Error: container running is running"
|
||||||
|
@ -51,7 +51,7 @@ teardown() {
|
||||||
@test "rm: Remove a not running container" {
|
@test "rm: Remove a not running container" {
|
||||||
create_container not-running
|
create_container not-running
|
||||||
|
|
||||||
run $TOOLBOX rm not-running
|
run "$TOOLBOX" rm not-running
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert_output ""
|
assert_output ""
|
||||||
|
@ -61,26 +61,26 @@ teardown() {
|
||||||
create_container running
|
create_container running
|
||||||
start_container running
|
start_container running
|
||||||
|
|
||||||
run $TOOLBOX rm --force running
|
run "$TOOLBOX" rm --force running
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert_output ""
|
assert_output ""
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "rm: Force remove all containers (with 2 containers created and 1 running)" {
|
@test "rm: Force remove all containers (with 2 containers created and 1 running)" {
|
||||||
num_of_containers=$(list_containers)
|
num_of_containers="$(list_containers)"
|
||||||
assert_equal "$num_of_containers" 0
|
assert_equal "$num_of_containers" 0
|
||||||
|
|
||||||
create_container running
|
create_container running
|
||||||
create_container not-running
|
create_container not-running
|
||||||
start_container running
|
start_container running
|
||||||
|
|
||||||
run $TOOLBOX rm --force --all
|
run "$TOOLBOX" rm --force --all
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert_output ""
|
assert_output ""
|
||||||
|
|
||||||
new_num_of_containers=$(list_containers)
|
new_num_of_containers="$(list_containers)"
|
||||||
|
|
||||||
assert_equal "$new_num_of_containers" "$num_of_containers"
|
assert_equal "$new_num_of_containers" "$num_of_containers"
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,17 +46,17 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "rmi: --all with the default image" {
|
@test "rmi: --all with the default image" {
|
||||||
num_of_images=$(list_images)
|
num_of_images="$(list_images)"
|
||||||
assert_equal "$num_of_images" 0
|
assert_equal "$num_of_images" 0
|
||||||
|
|
||||||
pull_default_image
|
pull_default_image
|
||||||
|
|
||||||
run --keep-empty-lines $TOOLBOX rmi --all
|
run --keep-empty-lines "$TOOLBOX" rmi --all
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert_output ""
|
assert_output ""
|
||||||
|
|
||||||
new_num_of_images=$(list_images)
|
new_num_of_images="$(list_images)"
|
||||||
|
|
||||||
assert_equal "$new_num_of_images" "$num_of_images"
|
assert_equal "$new_num_of_images" "$num_of_images"
|
||||||
}
|
}
|
||||||
|
@ -230,36 +230,36 @@ teardown() {
|
||||||
|
|
||||||
@test "rmi: Try --all with a running container" {
|
@test "rmi: Try --all with a running container" {
|
||||||
skip "Bug: Fail in 'toolbox rmi' does not return non-zero value"
|
skip "Bug: Fail in 'toolbox rmi' does not return non-zero value"
|
||||||
num_of_images=$(list_images)
|
num_of_images="$(list_images)"
|
||||||
assert_equal "$num_of_images" 0
|
assert_equal "$num_of_images" 0
|
||||||
|
|
||||||
create_container foo
|
create_container foo
|
||||||
start_container foo
|
start_container foo
|
||||||
|
|
||||||
run --keep-empty-lines --separate-stderr $TOOLBOX rmi --all
|
run --keep-empty-lines --separate-stderr "$TOOLBOX" rmi --all
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
lines=("${stderr_lines[@]}")
|
lines=("${stderr_lines[@]}")
|
||||||
assert_line --index 0 --regexp "Error: image .* has dependent children"
|
assert_line --index 0 --regexp "Error: image .* has dependent children"
|
||||||
|
|
||||||
new_num_of_images=$(list_images)
|
new_num_of_images="$(list_images)"
|
||||||
|
|
||||||
assert_equal "$new_num_of_images" "$num_of_images"
|
assert_equal "$new_num_of_images" "$num_of_images"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "rmi: '--all --force' with a running container" {
|
@test "rmi: '--all --force' with a running container" {
|
||||||
num_of_images=$(list_images)
|
num_of_images="$(list_images)"
|
||||||
assert_equal "$num_of_images" 0
|
assert_equal "$num_of_images" 0
|
||||||
|
|
||||||
create_container foo
|
create_container foo
|
||||||
start_container foo
|
start_container foo
|
||||||
|
|
||||||
run --keep-empty-lines $TOOLBOX rmi --all --force
|
run --keep-empty-lines "$TOOLBOX" rmi --all --force
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert_output ""
|
assert_output ""
|
||||||
|
|
||||||
new_num_of_images=$(list_images)
|
new_num_of_images="$(list_images)"
|
||||||
|
|
||||||
assert_equal "$new_num_of_images" "$num_of_images"
|
assert_equal "$new_num_of_images" "$num_of_images"
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "completion: Smoke test with 'bash'" {
|
@test "completion: Smoke test with 'bash'" {
|
||||||
run $TOOLBOX completion bash
|
run "$TOOLBOX" completion bash
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert [ ${#lines[@]} -gt 0 ]
|
assert [ ${#lines[@]} -gt 0 ]
|
||||||
|
@ -33,7 +33,7 @@ setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "completion: Smoke test with 'fish'" {
|
@test "completion: Smoke test with 'fish'" {
|
||||||
run $TOOLBOX completion fish
|
run "$TOOLBOX" completion fish
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert [ ${#lines[@]} -gt 0 ]
|
assert [ ${#lines[@]} -gt 0 ]
|
||||||
|
@ -41,7 +41,7 @@ setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "completion: Smoke test with 'zsh'" {
|
@test "completion: Smoke test with 'zsh'" {
|
||||||
run $TOOLBOX completion zsh
|
run "$TOOLBOX" completion zsh
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert [ ${#lines[@]} -gt 0 ]
|
assert [ ${#lines[@]} -gt 0 ]
|
||||||
|
@ -49,7 +49,7 @@ setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "completion: Try without any arguments" {
|
@test "completion: Try without any arguments" {
|
||||||
run --separate-stderr $TOOLBOX completion
|
run --separate-stderr "$TOOLBOX" completion
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -60,7 +60,7 @@ setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "completion: Try with invalid arguments" {
|
@test "completion: Try with invalid arguments" {
|
||||||
run --separate-stderr $TOOLBOX completion foo
|
run --separate-stderr "$TOOLBOX" completion foo
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -71,7 +71,7 @@ setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "completion: Try with unknown flag" {
|
@test "completion: Try with unknown flag" {
|
||||||
run --separate-stderr $TOOLBOX completion --foo
|
run --separate-stderr "$TOOLBOX" completion --foo
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
@ -82,7 +82,7 @@ setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "completion: Try with unsupported shell" {
|
@test "completion: Try with unsupported shell" {
|
||||||
run --separate-stderr $TOOLBOX completion powershell
|
run --separate-stderr "$TOOLBOX" completion powershell
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert [ ${#lines[@]} -eq 0 ]
|
assert [ ${#lines[@]} -eq 0 ]
|
||||||
|
|
|
@ -18,9 +18,9 @@ readonly DOCKER_REG_URI="localhost:50000"
|
||||||
readonly DOCKER_REG_NAME="docker-registry"
|
readonly DOCKER_REG_NAME="docker-registry"
|
||||||
|
|
||||||
# Podman and Toolbox commands to run
|
# Podman and Toolbox commands to run
|
||||||
readonly PODMAN=${PODMAN:-$(command -v podman)}
|
readonly PODMAN="${PODMAN:-$(command -v podman)}"
|
||||||
readonly TOOLBOX=${TOOLBOX:-$(command -v toolbox)}
|
readonly TOOLBOX="${TOOLBOX:-$(command -v toolbox)}"
|
||||||
readonly SKOPEO=${SKOPEO:-$(command -v skopeo)}
|
readonly SKOPEO="${SKOPEO:-$(command -v skopeo)}"
|
||||||
|
|
||||||
# Images
|
# Images
|
||||||
declare -Ag IMAGES=([arch]="quay.io/toolbx/arch-toolbox" \
|
declare -Ag IMAGES=([arch]="quay.io/toolbx/arch-toolbox" \
|
||||||
|
@ -32,13 +32,13 @@ declare -Ag IMAGES=([arch]="quay.io/toolbx/arch-toolbox" \
|
||||||
|
|
||||||
|
|
||||||
function cleanup_all() {
|
function cleanup_all() {
|
||||||
$PODMAN rm --all --force >/dev/null
|
"$PODMAN" rm --all --force >/dev/null
|
||||||
$PODMAN rmi --all --force >/dev/null
|
"$PODMAN" rmi --all --force >/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function cleanup_containers() {
|
function cleanup_containers() {
|
||||||
$PODMAN rm --all --force >/dev/null
|
"$PODMAN" rm --all --force >/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,20 +48,20 @@ function _setup_environment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function _setup_containers_storage() {
|
function _setup_containers_storage() {
|
||||||
mkdir -p ${TEMP_STORAGE_DIR}
|
mkdir -p "${TEMP_STORAGE_DIR}"
|
||||||
# Set up a storage config file for PODMAN
|
# Set up a storage config file for PODMAN
|
||||||
echo -e "[storage]\n driver = \"overlay\"\n rootless_storage_path = \"${ROOTLESS_PODMAN_STORE_DIR}\"\n runroot = \"${ROOTLESS_PODMAN_RUNROOT_DIR}\"\n" > ${PODMAN_STORE_CONFIG_FILE}
|
echo -e "[storage]\n driver = \"overlay\"\n rootless_storage_path = \"${ROOTLESS_PODMAN_STORE_DIR}\"\n runroot = \"${ROOTLESS_PODMAN_RUNROOT_DIR}\"\n" > "${PODMAN_STORE_CONFIG_FILE}"
|
||||||
export CONTAINERS_STORAGE_CONF=${PODMAN_STORE_CONFIG_FILE}
|
export CONTAINERS_STORAGE_CONF="${PODMAN_STORE_CONFIG_FILE}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function _clean_temporary_storage() {
|
function _clean_temporary_storage() {
|
||||||
$PODMAN system reset -f
|
"$PODMAN" system reset -f
|
||||||
|
|
||||||
rm --force --recursive ${ROOTLESS_PODMAN_STORE_DIR}
|
rm --force --recursive "${ROOTLESS_PODMAN_STORE_DIR}"
|
||||||
rm --force --recursive ${ROOTLESS_PODMAN_RUNROOT_DIR}
|
rm --force --recursive "${ROOTLESS_PODMAN_RUNROOT_DIR}"
|
||||||
rm --force --recursive ${PODMAN_STORE_CONFIG_FILE}
|
rm --force --recursive "${PODMAN_STORE_CONFIG_FILE}"
|
||||||
rm --force --recursive ${TEMP_STORAGE_DIR}
|
rm --force --recursive "${TEMP_STORAGE_DIR}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -98,24 +98,24 @@ function _pull_and_cache_distro_image() {
|
||||||
image_archive="${image_archive}-${version}"
|
image_archive="${image_archive}-${version}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -d ${IMAGE_CACHE_DIR}/${image_archive} ]] ; then
|
if [[ -d "${IMAGE_CACHE_DIR}/${image_archive}" ]] ; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d ${IMAGE_CACHE_DIR} ]; then
|
if [ ! -d "${IMAGE_CACHE_DIR}" ]; then
|
||||||
run mkdir -p ${IMAGE_CACHE_DIR}
|
run mkdir -p "${IMAGE_CACHE_DIR}"
|
||||||
assert_success
|
assert_success
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for ((i = num_of_retries; i > 0; i--)); do
|
for ((i = num_of_retries; i > 0; i--)); do
|
||||||
run $SKOPEO copy --dest-compress docker://${image} dir:${IMAGE_CACHE_DIR}/${image_archive}
|
run "$SKOPEO" copy --dest-compress "docker://${image}" "dir:${IMAGE_CACHE_DIR}/${image_archive}"
|
||||||
|
|
||||||
if [ "$status" -eq 0 ]; then
|
if [ "$status" -eq 0 ]; then
|
||||||
cached=true
|
cached=true
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sleep $timeout
|
sleep "$timeout"
|
||||||
done
|
done
|
||||||
|
|
||||||
if ! $cached; then
|
if ! $cached; then
|
||||||
|
@ -129,7 +129,7 @@ function _pull_and_cache_distro_image() {
|
||||||
|
|
||||||
# Removes the folder with cached images
|
# Removes the folder with cached images
|
||||||
function _clean_cached_images() {
|
function _clean_cached_images() {
|
||||||
rm --force --recursive ${IMAGE_CACHE_DIR}
|
rm --force --recursive "${IMAGE_CACHE_DIR}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -174,11 +174,11 @@ function _setup_docker_registry() {
|
||||||
assert_success
|
assert_success
|
||||||
|
|
||||||
# Pull Docker registry image
|
# Pull Docker registry image
|
||||||
run $PODMAN --root "${DOCKER_REG_ROOT}" pull "${IMAGES[docker-reg]}"
|
run "$PODMAN" --root "${DOCKER_REG_ROOT}" pull "${IMAGES[docker-reg]}"
|
||||||
assert_success
|
assert_success
|
||||||
|
|
||||||
# Create a Docker registry
|
# Create a Docker registry
|
||||||
run $PODMAN --root "${DOCKER_REG_ROOT}" run -d \
|
run "$PODMAN" --root "${DOCKER_REG_ROOT}" run -d \
|
||||||
--rm \
|
--rm \
|
||||||
--name "${DOCKER_REG_NAME}" \
|
--name "${DOCKER_REG_NAME}" \
|
||||||
--privileged \
|
--privileged \
|
||||||
|
@ -194,20 +194,20 @@ function _setup_docker_registry() {
|
||||||
"${IMAGES[docker-reg]}"
|
"${IMAGES[docker-reg]}"
|
||||||
assert_success
|
assert_success
|
||||||
|
|
||||||
run $PODMAN login \
|
run "$PODMAN" login \
|
||||||
--authfile ${TEMP_BASE_DIR}/authfile.json \
|
--authfile "${TEMP_BASE_DIR}/authfile.json" \
|
||||||
--username user \
|
--username user \
|
||||||
--password user \
|
--password user \
|
||||||
"${DOCKER_REG_URI}"
|
"${DOCKER_REG_URI}"
|
||||||
assert_success
|
assert_success
|
||||||
|
|
||||||
# Add fedora-toolbox:34 image to the registry
|
# Add fedora-toolbox:34 image to the registry
|
||||||
run $SKOPEO copy --dest-authfile ${TEMP_BASE_DIR}/authfile.json \
|
run "$SKOPEO" copy --dest-authfile "${TEMP_BASE_DIR}/authfile.json" \
|
||||||
dir:"${IMAGE_CACHE_DIR}"/fedora-toolbox-34 \
|
dir:"${IMAGE_CACHE_DIR}"/fedora-toolbox-34 \
|
||||||
docker://"${DOCKER_REG_URI}"/fedora-toolbox:34
|
docker://"${DOCKER_REG_URI}"/fedora-toolbox:34
|
||||||
assert_success
|
assert_success
|
||||||
|
|
||||||
run rm ${TEMP_BASE_DIR}/authfile.json
|
run rm "${TEMP_BASE_DIR}/authfile.json"
|
||||||
assert_success
|
assert_success
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,10 +215,10 @@ function _setup_docker_registry() {
|
||||||
# Stop, removes and cleans after a locally hosted Docker registry
|
# Stop, removes and cleans after a locally hosted Docker registry
|
||||||
function _clean_docker_registry() {
|
function _clean_docker_registry() {
|
||||||
# Stop Docker registry container
|
# Stop Docker registry container
|
||||||
$PODMAN --root "${DOCKER_REG_ROOT}" stop --time 0 "${DOCKER_REG_NAME}"
|
"$PODMAN" --root "${DOCKER_REG_ROOT}" stop --time 0 "${DOCKER_REG_NAME}"
|
||||||
# Clean up Podman's registry root state
|
# Clean up Podman's registry root state
|
||||||
$PODMAN --root "${DOCKER_REG_ROOT}" rm --all --force
|
"$PODMAN" --root "${DOCKER_REG_ROOT}" rm --all --force
|
||||||
$PODMAN --root "${DOCKER_REG_ROOT}" rmi --all --force
|
"$PODMAN" --root "${DOCKER_REG_ROOT}" rmi --all --force
|
||||||
# Remove Docker registry dir
|
# Remove Docker registry dir
|
||||||
rm --force --recursive "${DOCKER_REG_ROOT}"
|
rm --force --recursive "${DOCKER_REG_ROOT}"
|
||||||
# Remove dir with created registry certificates
|
# Remove dir with created registry certificates
|
||||||
|
@ -229,7 +229,7 @@ function _clean_docker_registry() {
|
||||||
function build_image_without_name() {
|
function build_image_without_name() {
|
||||||
echo -e "FROM scratch\n\nLABEL com.github.containers.toolbox=\"true\"" > "$BATS_TEST_TMPDIR"/Containerfile
|
echo -e "FROM scratch\n\nLABEL com.github.containers.toolbox=\"true\"" > "$BATS_TEST_TMPDIR"/Containerfile
|
||||||
|
|
||||||
run $PODMAN build "$BATS_TEST_TMPDIR"
|
run "$PODMAN" build "$BATS_TEST_TMPDIR"
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert_line --index 0 --partial "FROM scratch"
|
assert_line --index 0 --partial "FROM scratch"
|
||||||
|
@ -315,13 +315,13 @@ function pull_distro_image() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# No need to copy if the image is already available in Podman
|
# No need to copy if the image is already available in Podman
|
||||||
run $PODMAN image exists ${image}
|
run "$PODMAN" image exists "${image}"
|
||||||
if [[ "$status" -eq 0 ]]; then
|
if [[ "$status" -eq 0 ]]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# https://github.com/containers/skopeo/issues/547 for the options for containers-storage
|
# https://github.com/containers/skopeo/issues/547 for the options for containers-storage
|
||||||
run $SKOPEO copy "dir:${IMAGE_CACHE_DIR}/${image_archive}" "containers-storage:[overlay@$ROOTLESS_PODMAN_STORE_DIR+$ROOTLESS_PODMAN_STORE_DIR]${image}"
|
run "$SKOPEO" copy "dir:${IMAGE_CACHE_DIR}/${image_archive}" "containers-storage:[overlay@$ROOTLESS_PODMAN_STORE_DIR+$ROOTLESS_PODMAN_STORE_DIR]${image}"
|
||||||
if [ "$status" -ne 0 ]; then
|
if [ "$status" -ne 0 ]; then
|
||||||
echo "Failed to load image ${image} from cache ${IMAGE_CACHE_DIR}/${image_archive}"
|
echo "Failed to load image ${image} from cache ${IMAGE_CACHE_DIR}/${image_archive}"
|
||||||
assert_success
|
assert_success
|
||||||
|
@ -378,9 +378,9 @@ function create_distro_container() {
|
||||||
version="$2"
|
version="$2"
|
||||||
container_name="$3"
|
container_name="$3"
|
||||||
|
|
||||||
pull_distro_image ${distro} ${version}
|
pull_distro_image "${distro}" "${version}"
|
||||||
|
|
||||||
$TOOLBOX --assumeyes create --container "${container_name}" --distro "${distro}" --release "${version}" >/dev/null \
|
"$TOOLBOX" --assumeyes create --container "${container_name}" --distro "${distro}" --release "${version}" >/dev/null \
|
||||||
|| fail "Toolbox couldn't create container '$container_name'"
|
|| fail "Toolbox couldn't create container '$container_name'"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,7 +395,7 @@ function create_container() {
|
||||||
|
|
||||||
container_name="$1"
|
container_name="$1"
|
||||||
|
|
||||||
create_distro_container $(get_system_id) $(get_system_version) $container_name
|
create_distro_container "$(get_system_id)" "$(get_system_version)" "$container_name"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -403,7 +403,7 @@ function create_container() {
|
||||||
function create_default_container() {
|
function create_default_container() {
|
||||||
pull_default_image
|
pull_default_image
|
||||||
|
|
||||||
$TOOLBOX --assumeyes create >/dev/null \
|
"$TOOLBOX" --assumeyes create >/dev/null \
|
||||||
|| fail "Toolbox couldn't create default container"
|
|| fail "Toolbox couldn't create default container"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -412,7 +412,7 @@ function start_container() {
|
||||||
local container_name
|
local container_name
|
||||||
container_name="$1"
|
container_name="$1"
|
||||||
|
|
||||||
$PODMAN start "$container_name" >/dev/null \
|
"$PODMAN" start "$container_name" >/dev/null \
|
||||||
|| fail "Podman couldn't start the container '$container_name'"
|
|| fail "Podman couldn't start the container '$container_name'"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -431,17 +431,17 @@ function container_started() {
|
||||||
local container_name
|
local container_name
|
||||||
container_name="$1"
|
container_name="$1"
|
||||||
|
|
||||||
run $PODMAN start $container_name
|
run "$PODMAN" start "$container_name"
|
||||||
|
|
||||||
# Used as a return value
|
# Used as a return value
|
||||||
container_initialized=1
|
container_initialized=1
|
||||||
|
|
||||||
for TRIES in 1 2 3 4 5
|
for TRIES in 1 2 3 4 5
|
||||||
do
|
do
|
||||||
run $PODMAN logs $container_name
|
run "$PODMAN" logs "$container_name"
|
||||||
container_output=$output
|
container_output="$output"
|
||||||
# Look for last line of the container startup log
|
# Look for last line of the container startup log
|
||||||
run grep 'Listening to file system and ticker events' <<< $container_output
|
run grep 'Listening to file system and ticker events' <<< "$container_output"
|
||||||
if [[ "$status" -eq 0 ]]; then
|
if [[ "$status" -eq 0 ]]; then
|
||||||
container_initialized=0
|
container_initialized=0
|
||||||
break
|
break
|
||||||
|
@ -449,7 +449,7 @@ function container_started() {
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
return $container_initialized
|
return "$container_initialized"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -458,26 +458,26 @@ function stop_container() {
|
||||||
container_name="$1"
|
container_name="$1"
|
||||||
|
|
||||||
# Make sure the container is running before trying to stop it
|
# Make sure the container is running before trying to stop it
|
||||||
$PODMAN start "$container_name" >/dev/null \
|
"$PODMAN" start "$container_name" >/dev/null \
|
||||||
|| fail "Podman couldn't start the container '$container_name'"
|
|| fail "Podman couldn't start the container '$container_name'"
|
||||||
$PODMAN stop "$container_name" >/dev/null \
|
"$PODMAN" stop "$container_name" >/dev/null \
|
||||||
|| fail "Podman couldn't stop the container '$container_name'"
|
|| fail "Podman couldn't stop the container '$container_name'"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Returns the name of the latest created container
|
# Returns the name of the latest created container
|
||||||
function get_latest_container_name() {
|
function get_latest_container_name() {
|
||||||
$PODMAN ps --latest --format "{{ .Names }}"
|
"$PODMAN" ps --latest --format "{{ .Names }}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function list_images() {
|
function list_images() {
|
||||||
$PODMAN images --all --format "{{.ID}}" | wc --lines
|
"$PODMAN" images --all --format "{{.ID}}" | wc --lines
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function list_containers() {
|
function list_containers() {
|
||||||
$PODMAN ps --all --quiet | wc --lines
|
"$PODMAN" ps --all --quiet | wc --lines
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue