From e2d49fb650372e66e62f01e6332ef3e6c5621863 Mon Sep 17 00:00:00 2001 From: Ed Santiago Date: Thu, 16 Mar 2023 15:32:56 -0600 Subject: [PATCH] CI: test and confirm DESIRED_DATABASE Just like we do with RUNTIME and NETWORK. Skipped for now in system tests because there's no way yet to actually set the database backend. Also, in system test oneliner (first test), include DB Signed-off-by: Ed Santiago --- test/e2e/info_test.go | 15 +++++++++++++++ test/system/001-basic.bats | 1 + test/system/005-info.bats | 20 ++++++++++++++++++++ 3 files changed, 36 insertions(+) diff --git a/test/e2e/info_test.go b/test/e2e/info_test.go index c6cca6e866..7de0f22f8b 100644 --- a/test/e2e/info_test.go +++ b/test/e2e/info_test.go @@ -181,4 +181,19 @@ var _ = Describe("Podman Info", func() { Expect(session).To(Exit(0)) Expect(session.OutputToString()).To(Equal(want)) }) + + It("Podman info: check desired database backend", func() { + // defined in .cirrus.yml + want := os.Getenv("CI_DESIRED_DATABASE") + if want == "" { + if os.Getenv("CIRRUS_CI") == "" { + Skip("CI_DESIRED_DATABASE is not set--this is OK because we're not running under Cirrus") + } + Fail("CIRRUS_CI is set, but CI_DESIRED_DATABASE is not! See #16389") + } + session := podmanTest.Podman([]string{"info", "--format", "{{.Host.DatabaseBackend}}"}) + session.WaitWithDefaultTimeout() + Expect(session).To(Exit(0)) + Expect(session.OutputToString()).To(Equal(want)) + }) }) diff --git a/test/system/001-basic.bats b/test/system/001-basic.bats index 2f7f0966ca..a2f0f57d7b 100644 --- a/test/system/001-basic.bats +++ b/test/system/001-basic.bats @@ -50,6 +50,7 @@ function setup() { 'Logdriver:{{.Host.LogDriver}}' 'Cgroups:{{.Host.CgroupsVersion}}+{{.Host.CgroupManager}}' 'Net:{{.Host.NetworkBackend}}' + 'DB:{{.Host.DatabaseBackend}}' ) run_podman info --format "$(IFS='/' echo ${want[@]})" echo "# $output" >&3 diff --git a/test/system/005-info.bats b/test/system/005-info.bats index 8561a873c7..42ea58a1d6 100644 --- a/test/system/005-info.bats +++ b/test/system/005-info.bats @@ -93,6 +93,26 @@ host.slirp4netns.executable | $expr_path is "$output" "$CI_DESIRED_NETWORK" "CI_DESIRED_NETWORK (from .cirrus.yml)" } +@test "podman info - confirm desired database" { + skip "FIXME: no way yet (2023-03-16) to override DB in system tests" + if [[ -z "$CI_DESIRED_DATABASE" ]]; then + # When running in Cirrus, CI_DESIRED_DATABASE *must* be defined + # in .cirrus.yml so we can double-check that all CI VMs are + # using netavark or cni as desired. + if [[ -n "$CIRRUS_CI" ]]; then + die "CIRRUS_CI is set, but CI_DESIRED_DATABASE is not! See #16389" + fi + + # Not running under Cirrus (e.g., gating tests, or dev laptop). + # Totally OK to skip this test. + skip "CI_DESIRED_DATABASE is unset--OK, because we're not in Cirrus" + fi + + run_podman info --format '{{.Host.DatabaseBackend}}' + is "$output" "$CI_DESIRED_DATABASE" "CI_DESIRED_DATABASE (from .cirrus.yml)" +} + + # 2021-04-06 discussed in watercooler: RHEL must never use crun, even if # using cgroups v2. @test "podman info - RHEL8 must use runc" {