Merge pull request #10428 from priyawadhwa/auto-network-plugin
Fix TestNetworkPlugins/group/auto/KubeletFlags on containerd/criopull/10430/head^2
commit
859ec2a44b
|
@ -92,31 +92,16 @@ func TestNetworkPlugins(t *testing.T) {
|
|||
}
|
||||
if !t.Failed() {
|
||||
t.Run("KubeletFlags", func(t *testing.T) {
|
||||
var rr *RunResult
|
||||
var err error
|
||||
|
||||
// none does not support 'minikube ssh'
|
||||
rr, err := Run(t, exec.CommandContext(ctx, Target(), "ssh", "-p", profile, "pgrep -a kubelet"))
|
||||
if NoneDriver() {
|
||||
rr, err = Run(t, exec.CommandContext(ctx, "pgrep", "-a", "kubelet"))
|
||||
} else {
|
||||
rr, err = Run(t, exec.CommandContext(ctx, Target(), "ssh", "-p", profile, "pgrep -a kubelet"))
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("ssh failed: %v", err)
|
||||
}
|
||||
out := rr.Stdout.String()
|
||||
|
||||
if tc.kubeletPlugin == "" {
|
||||
if strings.Contains(out, "--network-plugin") {
|
||||
t.Errorf("expected no network plug-in, got %s", out)
|
||||
}
|
||||
} else {
|
||||
if !strings.Contains(out, fmt.Sprintf("--network-plugin=%s", tc.kubeletPlugin)) {
|
||||
t.Errorf("expected --network-plugin=%s, got %s", tc.kubeletPlugin, out)
|
||||
}
|
||||
}
|
||||
|
||||
verifyKubeletFlagsOutput(t, tc.kubeletPlugin, out)
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -206,3 +191,16 @@ func TestNetworkPlugins(t *testing.T) {
|
|||
}
|
||||
})
|
||||
}
|
||||
|
||||
func verifyKubeletFlagsOutput(t *testing.T, kubeletPlugin, out string) {
|
||||
if kubeletPlugin == "" {
|
||||
if strings.Contains(out, "--network-plugin") && ContainerRuntime() == "docker" {
|
||||
t.Errorf("expected no network plug-in, got %s", out)
|
||||
}
|
||||
if !strings.Contains(out, "--network-plugin=cni") && ContainerRuntime() != "docker" {
|
||||
t.Errorf("expected cni network plugin with conatinerd/crio, got %s", out)
|
||||
}
|
||||
} else if !strings.Contains(out, fmt.Sprintf("--network-plugin=%s", kubeletPlugin)) {
|
||||
t.Errorf("expected --network-plugin=%s, got %s", kubeletPlugin, out)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue