Skip to content

Commit

Permalink
Eliminate PodmanSystemdScope
Browse files Browse the repository at this point in the history
It seems this utility is not all that generally useful,
so eliminate it from the global namespace.

Use PodmanWithOptions directly, which will also allow a future
simplification.

Should not change behavior.

Signed-off-by: Miloslav Trmač <[email protected]>
  • Loading branch information
mtrmac committed Jan 22, 2025
1 parent 9363c8c commit 91fc5ea
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 24 deletions.
11 changes: 0 additions & 11 deletions test/e2e/libpod_suite_remote_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,6 @@ func (p *PodmanTestIntegration) PodmanWithOptions(options PodmanExecOptions, arg
return &PodmanSessionIntegration{podmanSession}
}

// PodmanSystemdScope runs the podman command in a new systemd scope
func (p *PodmanTestIntegration) PodmanSystemdScope(args []string) *PodmanSessionIntegration {
wrapper := []string{"systemd-run", "--scope"}
if isRootless() {
wrapper = []string{"systemd-run", "--scope", "--user"}
}
return p.PodmanWithOptions(PodmanExecOptions{
Wrapper: wrapper,
}, args...)
}

func (p *PodmanTestIntegration) setDefaultRegistriesConfigEnv() {
defaultFile := "registries.conf"
if UsingCacheRegistry() {
Expand Down
11 changes: 0 additions & 11 deletions test/e2e/libpod_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,6 @@ func (p *PodmanTestIntegration) PodmanWithOptions(options PodmanExecOptions, arg
return &PodmanSessionIntegration{podmanSession}
}

// PodmanSystemdScope runs the podman command in a new systemd scope
func (p *PodmanTestIntegration) PodmanSystemdScope(args []string) *PodmanSessionIntegration {
wrapper := []string{"systemd-run", "--scope"}
if isRootless() {
wrapper = []string{"systemd-run", "--scope", "--user"}
}
return p.PodmanWithOptions(PodmanExecOptions{
Wrapper: wrapper,
}, args...)
}

func (p *PodmanTestIntegration) setDefaultRegistriesConfigEnv() {
defaultFile := "registries.conf"
if UsingCacheRegistry() {
Expand Down
10 changes: 8 additions & 2 deletions test/e2e/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1704,7 +1704,13 @@ VOLUME %s`, ALPINE, volPath, volPath)
}
}

container := podmanTest.PodmanSystemdScope([]string{"run", "--rm", "--cgroups=split", ALPINE, "cat", "/proc/self/cgroup"})
scopeOptions := PodmanExecOptions{
Wrapper: []string{"systemd-run", "--scope"},
}
if isRootless() {
scopeOptions.Wrapper = append(scopeOptions.Wrapper, "--user")
}
container := podmanTest.PodmanWithOptions(scopeOptions, "run", "--rm", "--cgroups=split", ALPINE, "cat", "/proc/self/cgroup")
container.WaitWithDefaultTimeout()
Expect(container).Should(Exit(0))
checkLines(container.OutputToStringArray())
Expand All @@ -1713,7 +1719,7 @@ VOLUME %s`, ALPINE, volPath, volPath)
ContainSubstring("Running as unit: "))) // systemd >= 255

// check that --cgroups=split is honored also when a container runs in a pod
container = podmanTest.PodmanSystemdScope([]string{"run", "--rm", "--pod", "new:split-test-pod", "--cgroups=split", ALPINE, "cat", "/proc/self/cgroup"})
container = podmanTest.PodmanWithOptions(scopeOptions, "run", "--rm", "--pod", "new:split-test-pod", "--cgroups=split", ALPINE, "cat", "/proc/self/cgroup")
container.WaitWithDefaultTimeout()
Expect(container).Should(Exit(0))
checkLines(container.OutputToStringArray())
Expand Down

0 comments on commit 91fc5ea

Please sign in to comment.