Skip to content

Commit

Permalink
playbooks, test/system: Drop the PODMAN and SKOPEO environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
debarshiray committed Nov 12, 2024
1 parent 05202bb commit 95be6f7
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 68 deletions.
1 change: 0 additions & 1 deletion playbooks/system-test-commands-options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
- name: Run the commands-options system tests
command: bats --filter-tags commands-options ./test/system
environment:
PODMAN: '/usr/bin/podman'
TMPDIR: '/var/tmp'
TOOLBX: '/usr/local/bin/toolbox'
TOOLBX_TEST_SYSTEM_TAGS: 'arch-fedora,commands-options,custom-image,ubuntu'
Expand Down
1 change: 0 additions & 1 deletion playbooks/system-test-runtime-environment-arch-fedora.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
- name: Run the (arch-fedora,runtime-environment) system tests
command: bats --filter-tags arch-fedora,runtime-environment ./test/system
environment:
PODMAN: '/usr/bin/podman'
TMPDIR: '/var/tmp'
TOOLBX: '/usr/local/bin/toolbox'
TOOLBX_TEST_SYSTEM_TAGS: 'arch-fedora,runtime-environment'
Expand Down
1 change: 0 additions & 1 deletion playbooks/system-test-runtime-environment-ubuntu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
- name: Run the (runtime-environment,ubuntu) system tests
command: bats --filter-tags runtime-environment,ubuntu ./test/system
environment:
PODMAN: '/usr/bin/podman'
TMPDIR: '/var/tmp'
TOOLBX: '/usr/local/bin/toolbox'
TOOLBX_TEST_SYSTEM_TAGS: 'runtime-environment,ubuntu'
Expand Down
14 changes: 7 additions & 7 deletions test/system/101-create.bats
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ teardown() {
assert_output --partial "Created container: ubuntu-toolbox-16.04"
assert_output --partial "Enter with: toolbox enter ubuntu-toolbox-16.04"

run $PODMAN ps --all
run podman ps --all

assert_success
assert_output --regexp "Created[[:blank:]]+ubuntu-toolbox-16.04"
Expand All @@ -219,7 +219,7 @@ teardown() {
assert_output --partial "Created container: ubuntu-toolbox-18.04"
assert_output --partial "Enter with: toolbox enter ubuntu-toolbox-18.04"

run $PODMAN ps --all
run podman ps --all

assert_success
assert_output --regexp "Created[[:blank:]]+ubuntu-toolbox-18.04"
Expand All @@ -234,7 +234,7 @@ teardown() {
assert_output --partial "Created container: ubuntu-toolbox-20.04"
assert_output --partial "Enter with: toolbox enter ubuntu-toolbox-20.04"

run $PODMAN ps --all
run podman ps --all

assert_success
assert_output --regexp "Created[[:blank:]]+ubuntu-toolbox-20.04"
Expand All @@ -251,7 +251,7 @@ teardown() {
assert [ ${#lines[@]} -eq 2 ]
assert [ ${#stderr_lines[@]} -eq 0 ]

run $PODMAN ps --all
run podman ps --all

assert_success
assert_output --regexp "Created[[:blank:]]+$image"
Expand All @@ -268,7 +268,7 @@ teardown() {
assert [ ${#lines[@]} -eq 2 ]
assert [ ${#stderr_lines[@]} -eq 0 ]

run $PODMAN ps --all
run podman ps --all

assert_success
assert_output --regexp "Created[[:blank:]]+non-default"
Expand All @@ -285,7 +285,7 @@ teardown() {
assert [ ${#lines[@]} -eq 2 ]
assert [ ${#stderr_lines[@]} -eq 0 ]

run $PODMAN ps --all
run podman ps --all

assert_success
assert_output --regexp "Created[[:blank:]]+non-default"
Expand Down Expand Up @@ -842,7 +842,7 @@ teardown() {
local authfile="$BATS_TEST_TMPDIR/authfile"
local image="fedora-toolbox:34"

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

run "$TOOLBX" --assumeyes create --image "$DOCKER_REG_URI/$image"
Expand Down
6 changes: 3 additions & 3 deletions test/system/102-list.bats
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ teardown() {
num_of_images="$(list_images)"
assert_equal "$num_of_images" 1

$PODMAN create --name busybox-container "$busybox_image"
podman create --name busybox-container "$busybox_image"

local num_of_containers
num_of_containers="$(list_containers)"
Expand All @@ -558,7 +558,7 @@ teardown() {
num_of_images="$(list_images)"
assert_equal "$num_of_images" 1

$PODMAN create --name busybox-container "$busybox_image"
podman create --name busybox-container "$busybox_image"

local num_of_containers
num_of_containers="$(list_containers)"
Expand All @@ -581,7 +581,7 @@ teardown() {
num_of_images="$(list_images)"
assert_equal "$num_of_images" 1

$PODMAN create --name busybox-container "$busybox_image"
podman create --name busybox-container "$busybox_image"

local num_of_containers
num_of_containers="$(list_containers)"
Expand Down
4 changes: 2 additions & 2 deletions test/system/104-run.bats
Original file line number Diff line number Diff line change
Expand Up @@ -842,11 +842,11 @@ teardown() {

local container="ancient"

run "$PODMAN" create --name "$container" "$default_image" true
run podman create --name "$container" "$default_image" true

assert_success

run $PODMAN ps --all
run podman ps --all

assert_success
assert_output --regexp "Created[[:blank:]]+$container"
Expand Down
84 changes: 42 additions & 42 deletions test/system/206-user.bats
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ teardown() {
default_container="$(get_system_id)-toolbox-$(get_system_version)"

create_default_container
container_root_file_system="$("$PODMAN" unshare "$PODMAN" mount "$default_container")"
container_root_file_system="$(podman unshare podman mount "$default_container")"

"$TOOLBX" run true

run --keep-empty-lines --separate-stderr "$PODMAN" unshare cat "$container_root_file_system/etc/shadow"
"$PODMAN" unshare "$PODMAN" unmount "$default_container"
run --keep-empty-lines --separate-stderr podman unshare cat "$container_root_file_system/etc/shadow"
podman unshare podman unmount "$default_container"

assert_success
assert_line --regexp '^root::.+$'
Expand All @@ -75,12 +75,12 @@ teardown() {
# bats test_tags=arch-fedora
@test "user: root in shadow(5) inside Arch Linux" {
create_distro_container arch latest arch-toolbox-latest
container_root_file_system="$("$PODMAN" unshare "$PODMAN" mount arch-toolbox-latest)"
container_root_file_system="$(podman unshare podman mount arch-toolbox-latest)"

"$TOOLBX" run --distro arch true

run --keep-empty-lines --separate-stderr "$PODMAN" unshare cat "$container_root_file_system/etc/shadow"
"$PODMAN" unshare "$PODMAN" unmount arch-toolbox-latest
run --keep-empty-lines --separate-stderr podman unshare cat "$container_root_file_system/etc/shadow"
podman unshare podman unmount arch-toolbox-latest

assert_success
assert_line --regexp '^root::.+$'
Expand All @@ -93,12 +93,12 @@ teardown() {
# bats test_tags=arch-fedora
@test "user: root in shadow(5) inside Fedora 34" {
create_distro_container fedora 34 fedora-toolbox-34
container_root_file_system="$("$PODMAN" unshare "$PODMAN" mount fedora-toolbox-34)"
container_root_file_system="$(podman unshare podman mount fedora-toolbox-34)"

"$TOOLBX" run --distro fedora --release 34 true

run --keep-empty-lines --separate-stderr "$PODMAN" unshare cat "$container_root_file_system/etc/shadow"
"$PODMAN" unshare "$PODMAN" unmount fedora-toolbox-34
run --keep-empty-lines --separate-stderr podman unshare cat "$container_root_file_system/etc/shadow"
podman unshare podman unmount fedora-toolbox-34

assert_success
assert_line --regexp '^root::.+$'
Expand All @@ -111,12 +111,12 @@ teardown() {
# bats test_tags=arch-fedora
@test "user: root in shadow(5) inside RHEL 8.10" {
create_distro_container rhel 8.10 rhel-toolbox-8.10
container_root_file_system="$("$PODMAN" unshare "$PODMAN" mount rhel-toolbox-8.10)"
container_root_file_system="$(podman unshare podman mount rhel-toolbox-8.10)"

"$TOOLBX" run --distro rhel --release 8.10 true

run --keep-empty-lines --separate-stderr "$PODMAN" unshare cat "$container_root_file_system/etc/shadow"
"$PODMAN" unshare "$PODMAN" unmount rhel-toolbox-8.10
run --keep-empty-lines --separate-stderr podman unshare cat "$container_root_file_system/etc/shadow"
podman unshare podman unmount rhel-toolbox-8.10

assert_success
assert_line --regexp '^root::.+$'
Expand All @@ -129,12 +129,12 @@ teardown() {
# bats test_tags=ubuntu
@test "user: root in shadow(5) inside Ubuntu 16.04" {
create_distro_container ubuntu 16.04 ubuntu-toolbox-16.04
container_root_file_system="$("$PODMAN" unshare "$PODMAN" mount ubuntu-toolbox-16.04)"
container_root_file_system="$(podman unshare podman mount ubuntu-toolbox-16.04)"

"$TOOLBX" run --distro ubuntu --release 16.04 true

run --keep-empty-lines --separate-stderr "$PODMAN" unshare cat "$container_root_file_system/etc/shadow"
"$PODMAN" unshare "$PODMAN" unmount ubuntu-toolbox-16.04
run --keep-empty-lines --separate-stderr podman unshare cat "$container_root_file_system/etc/shadow"
podman unshare podman unmount ubuntu-toolbox-16.04

assert_success
assert_line --regexp '^root::.+$'
Expand All @@ -147,12 +147,12 @@ teardown() {
# bats test_tags=ubuntu
@test "user: root in shadow(5) inside Ubuntu 18.04" {
create_distro_container ubuntu 18.04 ubuntu-toolbox-18.04
container_root_file_system="$("$PODMAN" unshare "$PODMAN" mount ubuntu-toolbox-18.04)"
container_root_file_system="$(podman unshare podman mount ubuntu-toolbox-18.04)"

"$TOOLBX" run --distro ubuntu --release 18.04 true

run --keep-empty-lines --separate-stderr "$PODMAN" unshare cat "$container_root_file_system/etc/shadow"
"$PODMAN" unshare "$PODMAN" unmount ubuntu-toolbox-18.04
run --keep-empty-lines --separate-stderr podman unshare cat "$container_root_file_system/etc/shadow"
podman unshare podman unmount ubuntu-toolbox-18.04

assert_success
assert_line --regexp '^root::.+$'
Expand All @@ -165,12 +165,12 @@ teardown() {
# bats test_tags=ubuntu
@test "user: root in shadow(5) inside Ubuntu 20.04" {
create_distro_container ubuntu 20.04 ubuntu-toolbox-20.04
container_root_file_system="$("$PODMAN" unshare "$PODMAN" mount ubuntu-toolbox-20.04)"
container_root_file_system="$(podman unshare podman mount ubuntu-toolbox-20.04)"

"$TOOLBX" run --distro ubuntu --release 20.04 true

run --keep-empty-lines --separate-stderr "$PODMAN" unshare cat "$container_root_file_system/etc/shadow"
"$PODMAN" unshare "$PODMAN" unmount ubuntu-toolbox-20.04
run --keep-empty-lines --separate-stderr podman unshare cat "$container_root_file_system/etc/shadow"
podman unshare podman unmount ubuntu-toolbox-20.04

assert_success
assert_line --regexp '^root::.+$'
Expand Down Expand Up @@ -326,12 +326,12 @@ teardown() {
default_container="$(get_system_id)-toolbox-$(get_system_version)"

create_default_container
container_root_file_system="$("$PODMAN" unshare "$PODMAN" mount "$default_container")"
container_root_file_system="$(podman unshare podman mount "$default_container")"

"$TOOLBX" run true

run --keep-empty-lines --separate-stderr "$PODMAN" unshare cat "$container_root_file_system/etc/shadow"
"$PODMAN" unshare "$PODMAN" unmount "$default_container"
run --keep-empty-lines --separate-stderr podman unshare cat "$container_root_file_system/etc/shadow"
podman unshare podman unmount "$default_container"

assert_success
refute_line --regexp "^$USER:.*$"
Expand All @@ -344,12 +344,12 @@ teardown() {
# bats test_tags=arch-fedora
@test "user: $USER in shadow(5) inside Arch Linux" {
create_distro_container arch latest arch-toolbox-latest
container_root_file_system="$("$PODMAN" unshare "$PODMAN" mount arch-toolbox-latest)"
container_root_file_system="$(podman unshare podman mount arch-toolbox-latest)"

"$TOOLBX" run --distro arch true

run --keep-empty-lines --separate-stderr "$PODMAN" unshare cat "$container_root_file_system/etc/shadow"
"$PODMAN" unshare "$PODMAN" unmount arch-toolbox-latest
run --keep-empty-lines --separate-stderr podman unshare cat "$container_root_file_system/etc/shadow"
podman unshare podman unmount arch-toolbox-latest

assert_success
refute_line --regexp "^$USER:.*$"
Expand All @@ -362,12 +362,12 @@ teardown() {
# bats test_tags=arch-fedora
@test "user: $USER in shadow(5) inside Fedora 34" {
create_distro_container fedora 34 fedora-toolbox-34
container_root_file_system="$("$PODMAN" unshare "$PODMAN" mount fedora-toolbox-34)"
container_root_file_system="$(podman unshare podman mount fedora-toolbox-34)"

"$TOOLBX" run --distro fedora --release 34 true

run --keep-empty-lines --separate-stderr "$PODMAN" unshare cat "$container_root_file_system/etc/shadow"
"$PODMAN" unshare "$PODMAN" unmount fedora-toolbox-34
run --keep-empty-lines --separate-stderr podman unshare cat "$container_root_file_system/etc/shadow"
podman unshare podman unmount fedora-toolbox-34

assert_success
refute_line --regexp "^$USER:.*$"
Expand All @@ -380,12 +380,12 @@ teardown() {
# bats test_tags=arch-fedora
@test "user: $USER in shadow(5) inside RHEL 8.10" {
create_distro_container rhel 8.10 rhel-toolbox-8.10
container_root_file_system="$("$PODMAN" unshare "$PODMAN" mount rhel-toolbox-8.10)"
container_root_file_system="$(podman unshare podman mount rhel-toolbox-8.10)"

"$TOOLBX" run --distro rhel --release 8.10 true

run --keep-empty-lines --separate-stderr "$PODMAN" unshare cat "$container_root_file_system/etc/shadow"
"$PODMAN" unshare "$PODMAN" unmount rhel-toolbox-8.10
run --keep-empty-lines --separate-stderr podman unshare cat "$container_root_file_system/etc/shadow"
podman unshare podman unmount rhel-toolbox-8.10

assert_success
refute_line --regexp "^$USER:.*$"
Expand All @@ -398,12 +398,12 @@ teardown() {
# bats test_tags=ubuntu
@test "user: $USER in shadow(5) inside Ubuntu 16.04" {
create_distro_container ubuntu 16.04 ubuntu-toolbox-16.04
container_root_file_system="$("$PODMAN" unshare "$PODMAN" mount ubuntu-toolbox-16.04)"
container_root_file_system="$(podman unshare podman mount ubuntu-toolbox-16.04)"

"$TOOLBX" run --distro ubuntu --release 16.04 true

run --keep-empty-lines --separate-stderr "$PODMAN" unshare cat "$container_root_file_system/etc/shadow"
"$PODMAN" unshare "$PODMAN" unmount ubuntu-toolbox-16.04
run --keep-empty-lines --separate-stderr podman unshare cat "$container_root_file_system/etc/shadow"
podman unshare podman unmount ubuntu-toolbox-16.04

assert_success
refute_line --regexp "^$USER:.*$"
Expand All @@ -416,12 +416,12 @@ teardown() {
# bats test_tags=ubuntu
@test "user: $USER in shadow(5) inside Ubuntu 18.04" {
create_distro_container ubuntu 18.04 ubuntu-toolbox-18.04
container_root_file_system="$("$PODMAN" unshare "$PODMAN" mount ubuntu-toolbox-18.04)"
container_root_file_system="$(podman unshare podman mount ubuntu-toolbox-18.04)"

"$TOOLBX" run --distro ubuntu --release 18.04 true

run --keep-empty-lines --separate-stderr "$PODMAN" unshare cat "$container_root_file_system/etc/shadow"
"$PODMAN" unshare "$PODMAN" unmount ubuntu-toolbox-18.04
run --keep-empty-lines --separate-stderr podman unshare cat "$container_root_file_system/etc/shadow"
podman unshare podman unmount ubuntu-toolbox-18.04

assert_success
refute_line --regexp "^$USER:.*$"
Expand All @@ -434,12 +434,12 @@ teardown() {
# bats test_tags=ubuntu
@test "user: $USER in shadow(5) inside Ubuntu 20.04" {
create_distro_container ubuntu 20.04 ubuntu-toolbox-20.04
container_root_file_system="$("$PODMAN" unshare "$PODMAN" mount ubuntu-toolbox-20.04)"
container_root_file_system="$(podman unshare podman mount ubuntu-toolbox-20.04)"

"$TOOLBX" run --distro ubuntu --release 20.04 true

run --keep-empty-lines --separate-stderr "$PODMAN" unshare cat "$container_root_file_system/etc/shadow"
"$PODMAN" unshare "$PODMAN" unmount ubuntu-toolbox-20.04
run --keep-empty-lines --separate-stderr podman unshare cat "$container_root_file_system/etc/shadow"
podman unshare podman unmount ubuntu-toolbox-20.04

assert_success
refute_line --regexp "^$USER:.*$"
Expand Down
12 changes: 6 additions & 6 deletions test/system/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ and to speed up the cases.
By default the test suite uses the system versions of `podman`, `skopeo` and
`toolbox`.

If you have a `podman`, `skopeo` or `toolbox` installed in a nonstandard
location then you can use the `PODMAN`, `SKOPEO` and `TOOLBX` environmental
variables to set the path to the binaries. So the command to invoke the test
suite could look something like this: `PODMAN=/usr/libexec/podman TOOLBX=./toolbox bats ./test/system/`.
If you have `toolbox` installed in a nonstandard location then you can use the
`TOOLBX` environmental variable to set the path to the binary. So the command
to invoke the test suite could look something like this:
`TOOLBX=./toolbox bats ./test/system/`.

It's recommended to set the [TMPDIR](https://systemd.io/TEMPORARY_DIRECTORIES/)
environment variable to `/var/tmp` when running the tests. Otherwise, the
Expand Down Expand Up @@ -90,6 +90,6 @@ Examples:
Example pull of the `fedora-toolbox:34` image:

```bash
$PODMAN login --username user --password user "$DOCKER_REG_URI"
$PODMAN pull "$DOCKER_REG_URI/fedora-toolbox:34"
podman login --username user --password user "$DOCKER_REG_URI"
podman pull "$DOCKER_REG_URI/fedora-toolbox:34"
```
Loading

0 comments on commit 95be6f7

Please sign in to comment.