5
@test "podman info - basic test" {
9
buildahVersion: *[0-9.]\\\+
10
conmon:\\\s\\\+package:
13
ociRuntime:\\\s\\\+name:
21
imageStore:\\\s\\\+number: 1
23
cgroupManager: \\\(systemd\\\|cgroupfs\\\)
26
defer-assertion-failures
29
is "$output" ".*$expect" "output includes '$expect'"
30
done < <(parse_table "$expected_keys")
33
@test "podman info - json" {
34
run_podman info --format=json
36
expr_nvr="[a-z0-9-]\\\+-[a-z0-9.]\\\+-[a-z0-9]\\\+\."
37
expr_path="/[a-z0-9\\\/.-]\\\+\\\$"
39
# FIXME: if we're ever able to get package versions on Debian,
40
# add '-[0-9]' to all '*.package' queries below.
42
host.buildahVersion | [1-9][0-9]*\.[0-9.]\\\+.*
43
host.conmon.path | $expr_path
44
host.conmon.package | .*conmon.*
45
host.cgroupManager | \\\(systemd\\\|cgroupfs\\\)
46
host.cgroupVersion | v[12]
47
host.networkBackendInfo | .*dns.*package.*
48
host.ociRuntime.path | $expr_path
49
host.pasta | .*executable.*package.*
50
host.rootlessNetworkCmd | pasta
51
store.configFile | $expr_path
52
store.graphDriverName | [a-z0-9]\\\+\\\$
53
store.graphRoot | $expr_path
54
store.imageStore.number | 1
55
host.slirp4netns.executable | $expr_path
58
defer-assertion-failures
60
while read field expect; do
61
actual=$(echo "$output" | jq -r ".$field")
62
dprint "# actual=<$actual> expect=<$expect>"
63
is "$actual" "$expect" "jq .$field"
64
done < <(parse_table "$tests")
67
@test "podman info - confirm desired runtime" {
68
if [[ -z "$CI_DESIRED_RUNTIME" ]]; then
69
# When running in Cirrus, CI_DESIRED_RUNTIME *must* be defined
70
# in .cirrus.yml so we can double-check that all CI VMs are
71
# using crun/runc as desired.
72
if [[ -n "$CIRRUS_CI" ]]; then
73
die "CIRRUS_CI is set, but CI_DESIRED_RUNTIME is not! See #14912"
76
# Not running under Cirrus (e.g., gating tests, or dev laptop).
77
# Totally OK to skip this test.
78
skip "CI_DESIRED_RUNTIME is unset--OK, because we're not in Cirrus"
81
run_podman info --format '{{.Host.OCIRuntime.Name}}'
82
is "$output" "$CI_DESIRED_RUNTIME" "CI_DESIRED_RUNTIME (from .cirrus.yml)"
85
@test "podman info - confirm desired network backend" {
86
run_podman info --format '{{.Host.NetworkBackend}}'
87
is "$output" "netavark" "netavark backend"
90
@test "podman info - confirm desired database" {
91
# Always run this and preserve its value. We will check again in 999-*.bats
92
run_podman info --format '{{.Host.DatabaseBackend}}'
94
echo "$db_backend" > $BATS_SUITE_TMPDIR/db-backend
96
if [[ -z "$CI_DESIRED_DATABASE" ]]; then
97
# When running in Cirrus, CI_DESIRED_DATABASE *must* be defined
98
# in .cirrus.yml so we can double-check that all CI VMs are
99
# using netavark or cni as desired.
100
if [[ -n "$CIRRUS_CI" ]]; then
101
die "CIRRUS_CI is set, but CI_DESIRED_DATABASE is not! See #16389"
104
# Not running under Cirrus (e.g., gating tests, or dev laptop).
105
# Totally OK to skip this test.
106
skip "CI_DESIRED_DATABASE is unset--OK, because we're not in Cirrus"
109
is "$db_backend" "$CI_DESIRED_DATABASE" "CI_DESIRED_DATABASE (from .cirrus.yml)"
112
@test "podman info - confirm desired storage driver" {
113
if [[ -z "$CI_DESIRED_STORAGE" ]]; then
114
# When running in Cirrus, CI_DESIRED_STORAGE *must* be defined
115
# in .cirrus.yml so we can double-check that all CI VMs are
116
# using overlay or vfs as desired.
117
if [[ -n "$CIRRUS_CI" ]]; then
118
die "CIRRUS_CI is set, but CI_DESIRED_STORAGE is not! See #20161"
121
# Not running under Cirrus (e.g., gating tests, or dev laptop).
122
# Totally OK to skip this test.
123
skip "CI_DESIRED_STORAGE is unset--OK, because we're not in Cirrus"
126
is "$(podman_storage_driver)" "$CI_DESIRED_STORAGE" "podman storage driver is not CI_DESIRED_STORAGE (from .cirrus.yml)"
129
# 2021-04-06 discussed in watercooler: RHEL must never use crun, even if
131
@test "podman info - RHEL8 must use runc" {
132
local osrelease=/etc/os-release
133
test -e $osrelease || skip "Not a RHEL system (no $osrelease)"
135
local osname=$(source $osrelease; echo $NAME)
136
if [[ $osname =~ Red.Hat || $osname =~ CentOS ]]; then
137
# Version can include minor; strip off first dot an all beyond it
138
local osver=$(source $osrelease; echo $VERSION_ID)
139
test ${osver%%.*} -le 8 || skip "$osname $osver > RHEL8"
142
# FIXME: what does 'CentOS 8' even mean? What is $VERSION_ID in CentOS?
143
is "$(podman_runtime)" "runc" "$osname only supports OCI Runtime = runc"
145
skip "only applicable on RHEL, this is $osname"
149
@test "podman info --storage-opt='' " {
150
skip_if_remote "--storage-opt flag is not supported for remote"
151
skip_if_rootless "storage opts are required for rootless running"
152
run_podman --storage-opt='' info
153
# Note this will not work in rootless mode, unless you specify
154
# storage-driver=vfs, until we have kernels that support rootless overlay
156
is "$output" ".*graphOptions: {}" "output includes graphOptions: {}"
159
@test "podman info netavark " {
160
# Confirm netavark in use when explicitly required by execution environment.
161
if [[ "$NETWORK_BACKEND" == "netavark" ]]; then
162
if ! is_netavark; then
163
# Assume is_netavark() will provide debugging feedback.
164
die "Netavark driver testing required, but not in use by podman."
167
skip "Netavark testing not requested (\$NETWORK_BACKEND='$NETWORK_BACKEND')"
171
@test "podman --root PATH info - basic output" {
173
run_podman --storage-driver=vfs --root ${PODMAN_TMPDIR}/nothing-here-move-along info --format '{{ .Store.GraphOptions }}'
174
is "$output" "map\[\]" "'podman --root should reset GraphOptions to []"
178
@test "rootless podman with symlinked $HOME" {
179
# This is only needed as rootless, but we don't have a skip_if_root
180
# And it will not hurt to run as root.
181
skip_if_remote "path validation is only done in libpod, does not effect remote"
183
new_home=$PODMAN_TMPDIR/home
185
ln -s /home $new_home
187
# Just need the command to run cleanly
188
HOME=$PODMAN_TMPDIR/$HOME run_podman info
193
@test "podman --root PATH --volumepath info - basic output" {
194
volumePath=${PODMAN_TMPDIR}/volumesGoHere
196
run_podman --storage-driver=vfs --root ${PODMAN_TMPDIR}/nothing-here-move-along --volumepath ${volumePath} info --format '{{ .Store.VolumePath }}'
197
is "$output" "${volumePath}" "'podman --volumepath should reset VolumePath"
201
@test "CONTAINERS_CONF_OVERRIDE" {
202
skip_if_remote "remote does not support CONTAINERS_CONF*"
204
# Need to include runtime because it's runc in debian CI,
205
# and crun 1.11.1 barfs with "read from sync socket"
206
containersConf=$PODMAN_TMPDIR/containers.conf
207
cat >$containersConf <<EOF
209
runtime="$(podman_runtime)"
212
env = [ "CONF1=conf1" ]
214
[engine.volume_plugins]
215
volplugin1 = "This is not actually used or seen anywhere"
218
overrideConf=$PODMAN_TMPDIR/override.conf
219
cat >$overrideConf <<EOF
221
env = [ "CONF2=conf2" ]
223
[engine.volume_plugins]
224
volplugin2 = "This is not actually used or seen anywhere, either"
227
CONTAINERS_CONF="$containersConf" run_podman 1 run --rm $IMAGE printenv CONF1 CONF2
228
is "$output" "conf1" "with CONTAINERS_CONF only"
230
CONTAINERS_CONF_OVERRIDE=$overrideConf run_podman 1 run --rm $IMAGE printenv CONF1 CONF2
231
is "$output" "conf2" "with CONTAINERS_CONF_OVERRIDE only"
233
# CONTAINERS_CONF will be overridden by _OVERRIDE. env is overridden, not merged.
234
CONTAINERS_CONF=$containersConf CONTAINERS_CONF_OVERRIDE=$overrideConf run_podman 1 run --rm $IMAGE printenv CONF1 CONF2
235
is "$output" "conf2" "with both CONTAINERS_CONF and CONTAINERS_CONF_OVERRIDE"
237
# Merge test: each of those conf files defines a distinct volume plugin.
238
# Confirm that we see both. 'info' outputs in random order, so we need to
240
CONTAINERS_CONF=$containersConf CONTAINERS_CONF_OVERRIDE=$overrideConf run_podman info --format '{{.Plugins.Volume}}'
241
assert "$output" =~ "volplugin1" "CONTAINERS_CONF_OVERRIDE does not clobber volume_plugins from CONTAINERS_CONF"
242
assert "$output" =~ "volplugin2" "volume_plugins seen from CONTAINERS_CONF_OVERRIDE"
246
@test "podman - BoltDB cannot create new databases" {
247
skip_if_remote "DB checks only work for local Podman"
249
safe_opts=$(podman_isolation_opts ${PODMAN_TMPDIR})
251
CI_DESIRED_DATABASE= run_podman 125 $safe_opts --db-backend=boltdb info
252
assert "$output" =~ "deprecated, no new BoltDB databases can be created" \
253
"without CI_DESIRED_DATABASE"
255
CI_DESIRED_DATABASE=boltdb run_podman $safe_opts --log-level=debug --db-backend=boltdb info
256
assert "$output" =~ "Allowing deprecated database backend" \
257
"with CI_DESIRED_DATABASE"
259
run_podman $safe_opts system reset --force