kubelet: Move TestPortForwardNoSuchContainer() to dockertools package.

Also refactor TestPortForward() to be neutral to container runtime.
This commit is contained in:
Yifan Gu
2015-06-05 14:10:45 -07:00
parent f83d5356d7
commit 6ddffdd736
5 changed files with 47 additions and 55 deletions

View File

@@ -1914,3 +1914,26 @@ func TestSyncPodEventHandlerFails(t *testing.T) {
t.Errorf("Wrong stopped container, expected: bar, get: %q", dockerName.ContainerName)
}
}
func TestPortForwardNoSuchContainer(t *testing.T) {
dm, _ := newTestDockerManager()
podName, podNamespace := "podName", "podNamespace"
err := dm.PortForward(
&kubecontainer.Pod{
ID: "podID",
Name: podName,
Namespace: podNamespace,
Containers: nil,
},
5000,
nil,
)
if err == nil {
t.Fatal("unexpected non-error")
}
expectedErr := noPodInfraContainerError(podName, podNamespace)
if !reflect.DeepEqual(err, expectedErr) {
t.Fatalf("expected %v, but saw %v", expectedErr, err)
}
}