Merge pull request #27387 from mheon/remove_boltdb

Remove BoltDB state support
This commit is contained in:
openshift-merge-bot[bot]
2025-10-28 17:41:05 +00:00
committed by GitHub
31 changed files with 278 additions and 5703 deletions

View File

@@ -332,9 +332,6 @@ func PodmanTestCreateUtil(tempDir string, target PodmanTestCreateUtilTarget) *Po
os.Setenv("DISABLE_HC_SYSTEMD", "true")
dbBackend := "sqlite"
if os.Getenv("PODMAN_DB") == "boltdb" {
dbBackend = "boltdb"
}
networkBackend := Netavark
networkConfigDir := "/etc/containers/networks"
@@ -1377,8 +1374,8 @@ func (p *PodmanTestIntegration) makeOptions(args []string, options PodmanExecOpt
eventsType = "none"
}
podmanOptions := strings.Split(fmt.Sprintf("%s--root %s --runroot %s --runtime %s --conmon %s --network-config-dir %s --network-backend %s --cgroup-manager %s --tmpdir %s --events-backend %s --db-backend %s",
debug, p.Root, p.RunRoot, p.OCIRuntime, p.ConmonBinary, p.NetworkConfigDir, p.NetworkBackend.ToString(), p.CgroupManager, p.TmpDir, eventsType, p.DatabaseBackend), " ")
podmanOptions := strings.Split(fmt.Sprintf("%s--root %s --runroot %s --runtime %s --conmon %s --network-config-dir %s --network-backend %s --cgroup-manager %s --tmpdir %s --events-backend %s",
debug, p.Root, p.RunRoot, p.OCIRuntime, p.ConmonBinary, p.NetworkConfigDir, p.NetworkBackend.ToString(), p.CgroupManager, p.TmpDir, eventsType), " ")
podmanOptions = append(podmanOptions, strings.Split(p.StorageOptions, " ")...)
if !options.NoCache {

View File

@@ -168,68 +168,6 @@ var _ = Describe("Podman Info", func() {
Expect(session.OutputToString()).To(Equal("netavark"))
})
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(ExitCleanly())
Expect(session.OutputToString()).To(Equal(want))
})
It("podman --db-backend info basic check", Serial, func() {
SkipIfRemote("--db-backend only supported on the local client")
const desiredDB = "CI_DESIRED_DATABASE"
type argWant struct {
arg string
want string
}
backends := []argWant{
// default should be sqlite
{arg: "", want: "sqlite"},
{arg: "boltdb", want: "boltdb"},
// now because a boltdb exists it should use boltdb when default is requested
{arg: "", want: "boltdb"},
{arg: "sqlite", want: "sqlite"},
// just because we requested sqlite doesn't mean it stays that way.
// once a boltdb exists, podman will forevermore stick with it
{arg: "", want: "boltdb"},
}
for _, tt := range backends {
oldDesiredDB := os.Getenv(desiredDB)
if tt.arg == "boltdb" {
err := os.Setenv(desiredDB, "boltdb")
Expect(err).To(Not(HaveOccurred()))
defer os.Setenv(desiredDB, oldDesiredDB)
}
session := podmanTest.Podman([]string{"--db-backend", tt.arg, "--log-level=info", "info", "--format", "{{.Host.DatabaseBackend}}"})
session.WaitWithDefaultTimeout()
Expect(session).To(Exit(0))
Expect(session.OutputToString()).To(Equal(tt.want))
Expect(session.ErrorToString()).To(ContainSubstring("Using %s as database backend", tt.want))
if tt.arg == "boltdb" {
err := os.Setenv(desiredDB, oldDesiredDB)
Expect(err).To(Not(HaveOccurred()))
}
}
// make sure we get an error for bogus values
session := podmanTest.Podman([]string{"--db-backend", "bogus", "info", "--format", "{{.Host.DatabaseBackend}}"})
session.WaitWithDefaultTimeout()
Expect(session).To(ExitWithError(125, `Error: unsupported database backend: "bogus"`))
})
It("Podman info: check desired storage driver", func() {
// defined in .cirrus.yml
want := os.Getenv("CI_DESIRED_STORAGE")

View File

@@ -122,8 +122,8 @@ func (p *PodmanTestIntegration) StopRemoteService() {
// getRemoteOptions assembles all the podman main options
func getRemoteOptions(p *PodmanTestIntegration, args []string) []string {
networkDir := p.NetworkConfigDir
podmanOptions := strings.Split(fmt.Sprintf("--root %s --runroot %s --runtime %s --conmon %s --network-config-dir %s --network-backend %s --cgroup-manager %s --tmpdir %s --events-backend %s --db-backend %s",
p.Root, p.RunRoot, p.OCIRuntime, p.ConmonBinary, networkDir, p.NetworkBackend.ToString(), p.CgroupManager, p.TmpDir, "file", p.DatabaseBackend), " ")
podmanOptions := strings.Split(fmt.Sprintf("--root %s --runroot %s --runtime %s --conmon %s --network-config-dir %s --network-backend %s --cgroup-manager %s --tmpdir %s --events-backend %s",
p.Root, p.RunRoot, p.OCIRuntime, p.ConmonBinary, networkDir, p.NetworkBackend.ToString(), p.CgroupManager, p.TmpDir, "file"), " ")
podmanOptions = append(podmanOptions, strings.Split(p.StorageOptions, " ")...)
podmanOptions = append(podmanOptions, args...)

View File

@@ -167,11 +167,7 @@ var _ = Describe("Podman network connect and disconnect", func() {
con2 := podmanTest.Podman([]string{"network", "connect", netName, "test"})
con2.WaitWithDefaultTimeout()
if podmanTest.DatabaseBackend == "boltdb" {
Expect(con2).Should(ExitWithError(125, fmt.Sprintf("container %s is already connected to network %q: network is already connected", cid, netName)))
} else {
Expect(con2).Should(ExitWithError(125, fmt.Sprintf("container %s is already connected to network %s: network is already connected", cid, netName)))
}
Expect(con2).Should(ExitWithError(125, fmt.Sprintf("container %s is already connected to network %s: network is already connected", cid, netName)))
})
It("podman network connect", func() {

View File

@@ -204,9 +204,6 @@ var _ = Describe("Podman pod rm", func() {
session.WaitWithDefaultTimeout()
// FIXME-someday: consolidate different error messages
expect = "no pod with name or ID test1 found"
if podmanTest.DatabaseBackend == "boltdb" {
expect = "test1 is a container, not a pod"
}
if IsRemote() {
expect = `unable to find pod "test1"`
}

View File

@@ -54,7 +54,7 @@ var _ = Describe("Systemd activate", func() {
systemdArgs := []string{
"-E", "http_proxy", "-E", "https_proxy", "-E", "no_proxy",
"-E", "HTTP_PROXY", "-E", "HTTPS_PROXY", "-E", "NO_PROXY",
"-E", "XDG_RUNTIME_DIR", "-E", "CI_DESIRED_DATABASE",
"-E", "XDG_RUNTIME_DIR",
"--listen", addr,
podmanTest.PodmanBinary}
systemdArgs = append(systemdArgs, podmanOptions...)
@@ -121,7 +121,7 @@ var _ = Describe("Systemd activate", func() {
// start systemd activation with datagram socket
activateSession := testUtils.StartSystemExec(activate, []string{
"--datagram", "--listen", addr, "-E", "CI_DESIRED_DATABASE",
"--datagram", "--listen", addr,
podmanTest.PodmanBinary,
"--root=" + filepath.Join(tempdir, "server_root"),
"system", "service",

View File

@@ -103,10 +103,6 @@ var _ = Describe("Podman volume rm", func() {
session = podmanTest.Podman([]string{"volume", "rm", "myv"})
session.WaitWithDefaultTimeout()
expect := "more than one result for volume name myv: volume already exists"
if podmanTest.DatabaseBackend == "boltdb" {
// boltdb issues volume name in quotes
expect = `more than one result for volume name "myv": volume already exists`
}
Expect(session).To(ExitWithError(125, expect))
session = podmanTest.Podman([]string{"volume", "ls"})

View File

@@ -103,28 +103,6 @@ host.slirp4netns.executable | $expr_path
is "$output" "$CI_DESIRED_NETWORK" ".Host.NetworkBackend"
}
@test "podman info - confirm desired database" {
# Always run this and preserve its value. We will check again in 999-*.bats
run_podman info --format '{{.Host.DatabaseBackend}}'
db_backend="$output"
echo "$db_backend" > $BATS_SUITE_TMPDIR/db-backend
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
is "$db_backend" "$CI_DESIRED_DATABASE" "CI_DESIRED_DATABASE (from .cirrus.yml)"
}
@test "podman info - confirm desired storage driver" {
if [[ -z "$CI_DESIRED_STORAGE" ]]; then
# When running in Cirrus, CI_DESIRED_STORAGE *must* be defined
@@ -289,23 +267,6 @@ EOF
}
# TODO 6.0: Remove this
@test "podman - BoltDB cannot create new databases" {
skip_if_remote "DB checks only work for local Podman"
safe_opts=$(podman_isolation_opts ${PODMAN_TMPDIR})
CI_DESIRED_DATABASE= run_podman 125 $safe_opts --db-backend=boltdb info
assert "$output" =~ "deprecated, no new BoltDB databases can be created" \
"without CI_DESIRED_DATABASE"
CI_DESIRED_DATABASE=boltdb run_podman $safe_opts --log-level=debug --db-backend=boltdb info
assert "$output" =~ "Allowing deprecated database backend" \
"with CI_DESIRED_DATABASE"
SUPPRESS_BOLTDB_WARNING=true run_podman $safe_opts system reset --force
}
@test "podman - empty string defaults for certain values" {
skip_if_remote "Test uses nonstandard paths for c/storage directories"

View File

@@ -84,11 +84,6 @@ verify_iid_and_name() {
@test "podman image scp transfer" {
skip_if_remote "only applicable under local podman"
# See https://github.com/containers/podman/pull/21300 for details
if [[ "$CI_DESIRED_DATABASE" = "boltdb" ]]; then
skip "impossible due to pitfalls in our SSH implementation"
fi
# FIXME: Broken on debian SID; still broken 2024-09-11
# See https://github.com/containers/podman/pull/23020#issuecomment-2179284640
OS_RELEASE_ID="${OS_RELEASE_ID:-$(source /etc/os-release; echo $ID)}"

View File

@@ -1,30 +0,0 @@
#!/usr/bin/env bats
#
# Final set of tests to run.
#
load helpers
# Confirm that we're still using the same database we started with.
#
# This should never fail! If it does, it means that some test somewhere
# has run podman with --db-backend, which is known to wreak havoc.
#
# See https://github.com/containers/podman/issues/20563
@test "podman database backend has not changed" {
# File is always written in 005-info.bats. It must always exist
# by the time we get here...
db_backend_file=$BATS_SUITE_TMPDIR/db-backend
if [[ ! -e "$db_backend_file" ]]; then
# ...except in a manual run like "hack/bats 999"
if [[ $BATS_SUITE_TEST_NUMBER -le 5 ]]; then
skip "$db_backend_file missing, but this is a short manual bats run, so, ok"
fi
die "Internal error: $db_backend_file does not exist! (check 005-*.bats)"
fi
run_podman info --format '{{.Host.DatabaseBackend}}'
assert "$output" = "$(<$db_backend_file)" ".Host.DatabaseBackend has changed!"
}

View File

@@ -218,11 +218,7 @@ EOF
# Whichever DB was picked by old_podman, make sure we honor it
@test "info - database" {
run_podman info --format '{{.Host.DatabaseBackend}}'
if version_is_older_than 4.8; then
assert "$output" = "boltdb" "DatabaseBackend for podman < 4.8"
else
assert "$output" = "sqlite" "DatabaseBackend for podman >= 4.8"
fi
assert "$output" = "sqlite" "DatabaseBackend for podman >= 4.8"
}
@test "images" {