This commit is contained in:
Debarshi Ray 2025-08-16 16:29:09 +00:00 committed by GitHub
commit 97c393b1f1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 112 additions and 9 deletions

View File

@ -41,6 +41,7 @@ jobs:
apache2-utils \ apache2-utils \
bash-completion \ bash-completion \
codespell \ codespell \
dbus \
fish \ fish \
flatpak \ flatpak \
gcc \ gcc \

View File

@ -21,6 +21,7 @@ go_md2man = find_program('go-md2man')
bats = find_program('bats', required: false) bats = find_program('bats', required: false)
codespell = find_program('codespell', required: false) codespell = find_program('codespell', required: false)
dbus_daemon = find_program('dbus-daemon', required: false)
htpasswd = find_program('htpasswd', required: false) htpasswd = find_program('htpasswd', required: false)
openssl = find_program('openssl', required: false) openssl = find_program('openssl', required: false)

View File

@ -2,6 +2,7 @@
become: yes become: yes
package: package:
name: name:
- dbus-daemon
- flatpak-session-helper - flatpak-session-helper
- gcc - gcc
- golang - golang
@ -61,7 +62,7 @@
chdir: '{{ zuul.project.src_dir }}' chdir: '{{ zuul.project.src_dir }}'
- name: Check versions of crucial packages - name: Check versions of crucial packages
command: rpm -qa ShellCheck bash bash-completion bats codespell *kernel* gcc *glibc* golang golang-github-cpuguy83-md2man shadow-utils-subid-devel podman conmon containernetworking-plugins containers-common container-selinux crun fuse-overlayfs flatpak-session-helper skopeo command: rpm -qa ShellCheck bash bash-completion bats codespell dbus-daemon *kernel* gcc *glibc* golang golang-github-cpuguy83-md2man shadow-utils-subid-devel podman conmon containernetworking-plugins containers-common container-selinux crun fuse-overlayfs flatpak-session-helper skopeo
- name: Show podman versions - name: Show podman versions
command: podman version command: podman version

View File

@ -47,6 +47,15 @@
update_cache: "{{ true if zuul.attempts > 1 else false }}" update_cache: "{{ true if zuul.attempts > 1 else false }}"
use: "{{ 'dnf' if zuul.attempts > 1 else 'auto' }}" use: "{{ 'dnf' if zuul.attempts > 1 else 'auto' }}"
- name: Ensure that dbus-daemon(1) is absent
become: yes
package:
name:
- dbus-daemon
state: absent
update_cache: "{{ true if zuul.attempts > 1 else false }}"
use: "{{ 'dnf' if zuul.attempts > 1 else 'auto' }}"
- name: Ensure that 'p11-kit server' is absent - name: Ensure that 'p11-kit server' is absent
become: yes become: yes
package: package:

View File

@ -22,6 +22,7 @@
- ShellCheck - ShellCheck
- bats - bats
- codespell - codespell
- dbus-daemon
- fish - fish
- flatpak-session-helper - flatpak-session-helper
- gcc - gcc
@ -80,7 +81,7 @@
chdir: '{{ zuul.project.src_dir }}' chdir: '{{ zuul.project.src_dir }}'
- name: Check versions of crucial packages - name: Check versions of crucial packages
command: rpm -qa ShellCheck bash bash-completion bats codespell *kernel* gcc *glibc* shadow-utils-subid-devel golang golang-github-cpuguy83-md2man podman conmon containernetworking-plugins containers-common container-selinux crun fuse-overlayfs flatpak-session-helper skopeo command: rpm -qa ShellCheck bash bash-completion bats codespell dbus-daemon *kernel* gcc *glibc* shadow-utils-subid-devel golang golang-github-cpuguy83-md2man podman conmon containernetworking-plugins containers-common container-selinux crun fuse-overlayfs flatpak-session-helper skopeo
- name: Show podman versions - name: Show podman versions
command: podman version command: podman version

View File

@ -35,7 +35,7 @@ readonly RESOLVER_SH='resolvectl --legend false --no-pager --type "$0" query "$1
setup_file() { setup_file() {
bats_require_minimum_version 1.10.0 bats_require_minimum_version 1.10.0
cleanup_all # cleanup_all
pushd "$HOME" || return 1 pushd "$HOME" || return 1
if echo "$TOOLBX_TEST_SYSTEM_TAGS" | grep "arch" >/dev/null 2>/dev/null; then if echo "$TOOLBX_TEST_SYSTEM_TAGS" | grep "arch" >/dev/null 2>/dev/null; then

View File

@ -0,0 +1,23 @@
#
# Copyright © 2025 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
[containers]
default_sysctls = [
"net.ipv4.ping_group_range=0 0",
]
[engine]
cgroup_manager = "cgroupfs"

View File

@ -0,0 +1,29 @@
<!--
Copyright © 2025 Red Hat, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<fork/>
<listen>unix:runtime=yes</listen>
<policy context="default">
<allow eavesdrop="true"/>
<allow own="*"/>
<allow send_destination="*" eavesdrop="true"/>
</policy>
<standard_session_servicedirs/>
<type>session</type>
</busconfig>

View File

@ -15,15 +15,21 @@ export XDG_CONFIG_HOME
readonly XDG_DATA_HOME="$HOME/.local/share" readonly XDG_DATA_HOME="$HOME/.local/share"
export XDG_DATA_HOME export XDG_DATA_HOME
readonly XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR:-/run/user/$UID}" readonly XDG_RUNTIME_DIR="$BATS_SUITE_TMPDIR/xdg-runtime-dir"
export XDG_RUNTIME_DIR export XDG_RUNTIME_DIR
readonly XDG_STATE_HOME="$HOME/.local/state" readonly XDG_STATE_HOME="$HOME/.local/state"
export XDG_STATE_HOME export XDG_STATE_HOME
readonly CONTAINERS_CONF="$BATS_TEST_DIRNAME/config/containers.conf"
export CONTAINERS_CONF
readonly CONTAINERS_STORAGE_CONF="$XDG_CONFIG_HOME/containers/storage.conf" readonly CONTAINERS_STORAGE_CONF="$XDG_CONFIG_HOME/containers/storage.conf"
export CONTAINERS_STORAGE_CONF export CONTAINERS_STORAGE_CONF
readonly DBUS_SESSION_BUS_ADDRESS="unix:path=$XDG_RUNTIME_DIR/bus"
export DBUS_SESSION_BUS_ADDRESS
# Helpful globals # Helpful globals
readonly IMAGE_CACHE_DIR="$BATS_SUITE_TMPDIR/image-cache" readonly IMAGE_CACHE_DIR="$BATS_SUITE_TMPDIR/image-cache"
readonly TOOLBX_ROOTLESS_STORAGE_PATH="$XDG_DATA_HOME/containers/storage" readonly TOOLBX_ROOTLESS_STORAGE_PATH="$XDG_DATA_HOME/containers/storage"
@ -49,14 +55,39 @@ declare -Ag IMAGES=([arch]="quay.io/toolbx/arch-toolbox" \
function cleanup_all() { function cleanup_all() {
podman rm --all --force >/dev/null ctr_id="$(podman ps --all --format "{{ .ID }}" --no-trunc | head --lines 1)"
podman rmi --all --force >/dev/null cat "$XDG_RUNTIME_DIR/crun/$ctr_id/status"
echo "Container to kill: $ctr_id"
if [ "$ctr_id" != "" ]; then
crun --debug --log-level=debug kill --all "$ctr_id" 15
echo "Container to kill: crun: $?"
fi
ctr_id="$(podman ps --all --format "{{ .ID }}" --no-trunc | head --lines 2 | tail --lines 1)"
echo "Container to kill: $ctr_id"
if [ "$ctr_id" != "" ]; then
crun --debug --log-level=debug kill --all "$ctr_id" 15
echo "Container to kill: crun: $?"
fi
ctr_id="$(podman ps --all --format "{{ .ID }}" --no-trunc | head --lines 3 | tail --lines 1)"
echo "Container to kill: $ctr_id"
if [ "$ctr_id" != "" ]; then
crun --debug --log-level=debug kill --all "$ctr_id" 15
echo "Container to kill: crun: $?"
fi
podman --log-level debug stop --all
podman rm --all
podman rmi --all
} }
function _setup_environment() { function _setup_environment() {
# shellcheck disable=SC2174 # shellcheck disable=SC2174
mkdir --mode 700 --parents "$HOME" mkdir --mode 700 --parents "$HOME"
mkdir --mode 0700 --parents "$XDG_RUNTIME_DIR"
_setup_containers_storage _setup_containers_storage
} }

View File

@ -15,6 +15,7 @@
# limitations under the License. # limitations under the License.
# #
dbus_daemon_pid=0
missing_dependencies=false missing_dependencies=false
if [ -f "$BATS_TEST_DIRNAME/libs/bats-assert/load.bash" ] && [ -f "$BATS_TEST_DIRNAME/libs/bats-support/load.bash" ]; then if [ -f "$BATS_TEST_DIRNAME/libs/bats-assert/load.bash" ] && [ -f "$BATS_TEST_DIRNAME/libs/bats-support/load.bash" ]; then
@ -40,6 +41,7 @@ setup_suite() {
system_version="$(get_system_version)" system_version="$(get_system_version)"
_setup_environment _setup_environment
dbus_daemon_pid="$(dbus-daemon --config-file "$BATS_TEST_DIRNAME/config/dbus-session.conf" --print-pid)"
if echo "$TOOLBX_TEST_SYSTEM_TAGS" | grep "arch" >/dev/null 2>/dev/null; then if echo "$TOOLBX_TEST_SYSTEM_TAGS" | grep "arch" >/dev/null 2>/dev/null; then
_pull_and_cache_distro_image arch latest || false _pull_and_cache_distro_image arch latest || false
@ -67,7 +69,7 @@ setup_suite() {
_pull_and_cache_distro_image fedora "$((system_version-2))" || false _pull_and_cache_distro_image fedora "$((system_version-2))" || false
fi fi
_setup_docker_registry # _setup_docker_registry
fi fi
} }
@ -79,9 +81,14 @@ teardown_suite() {
return 0 return 0
fi fi
if echo "$TOOLBX_TEST_SYSTEM_TAGS" | grep "commands-options" >/dev/null 2>/dev/null; then if [ "$dbus_daemon_pid" != 0 ]; then
_clean_docker_registry kill -s SIGTERM "$dbus_daemon_pid"
dbus_daemon_pid=0
fi fi
# if echo "$TOOLBX_TEST_SYSTEM_TAGS" | grep "commands-options" >/dev/null 2>/dev/null; then
# _clean_docker_registry
# fi
podman system reset --force >/dev/null podman system reset --force >/dev/null
} }