Merge pull request #10225 from priyawadhwa/force-systemd-fix
Fix TestForceSystemdFlag tests on containerdpull/10240/head
commit
452d8db91e
|
@ -82,16 +82,36 @@ func TestForceSystemdFlag(t *testing.T) {
|
|||
t.Errorf("failed to start minikube with args: %q : %v", rr.Command(), err)
|
||||
}
|
||||
|
||||
rr, err = Run(t, exec.CommandContext(ctx, Target(), "-p", profile, "ssh", "docker info --format {{.CgroupDriver}}"))
|
||||
containerRuntime := ContainerRuntime()
|
||||
switch containerRuntime {
|
||||
case "docker":
|
||||
validateDockerSystemd(ctx, t, profile)
|
||||
case "containerd":
|
||||
validateContainerdSystemd(ctx, t, profile)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func validateDockerSystemd(ctx context.Context, t *testing.T, profile string) {
|
||||
rr, err := Run(t, exec.CommandContext(ctx, Target(), "-p", profile, "ssh", "docker info --format {{.CgroupDriver}}"))
|
||||
if err != nil {
|
||||
t.Errorf("failed to get docker cgroup driver. args %q: %v", rr.Command(), err)
|
||||
}
|
||||
|
||||
if !strings.Contains(rr.Output(), "systemd") {
|
||||
t.Fatalf("expected systemd cgroup driver, got: %v", rr.Output())
|
||||
}
|
||||
}
|
||||
|
||||
func validateContainerdSystemd(ctx context.Context, t *testing.T, profile string) {
|
||||
rr, err := Run(t, exec.CommandContext(ctx, Target(), "-p", profile, "ssh", "cat /etc/containerd/config.toml"))
|
||||
if err != nil {
|
||||
t.Errorf("failed to get docker cgroup driver. args %q: %v", rr.Command(), err)
|
||||
}
|
||||
if !strings.Contains(rr.Output(), "systemd_cgroup = true") {
|
||||
t.Fatalf("expected systemd cgroup driver, got: %v", rr.Output())
|
||||
}
|
||||
}
|
||||
|
||||
func TestForceSystemdEnv(t *testing.T) {
|
||||
if NoneDriver() {
|
||||
t.Skip("skipping: none driver does not support ssh or bundle docker")
|
||||
|
@ -109,13 +129,11 @@ func TestForceSystemdEnv(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Errorf("failed to start minikube with args: %q : %v", rr.Command(), err)
|
||||
}
|
||||
|
||||
rr, err = Run(t, exec.CommandContext(ctx, Target(), "-p", profile, "ssh", "docker info --format {{.CgroupDriver}}"))
|
||||
if err != nil {
|
||||
t.Errorf("failed to get docker cgroup driver. args %q: %v", rr.Command(), err)
|
||||
}
|
||||
|
||||
if !strings.Contains(rr.Output(), "systemd") {
|
||||
t.Fatalf("expected systemd cgroup driver, got: %v", rr.Output())
|
||||
containerRuntime := ContainerRuntime()
|
||||
switch containerRuntime {
|
||||
case "docker":
|
||||
validateDockerSystemd(ctx, t, profile)
|
||||
case "containerd":
|
||||
validateContainerdSystemd(ctx, t, profile)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue