Merge pull request #26467 from euank/delete-old-e2e-tests

Automatic merge from submit-queue

e2e: Delete old code

These tests were added commented out over a year ago. Now they don't compile. The port forward test has a whole file devoted to replacing it (`e2e/portforward.go`) and while the exec test doesn't have a perfect replacement, it has several tests that cover for it (exec over a websocket, an e2e_node test, all the kubectl execs). If we want that test, it would be better to write it fresh anyways.

cc @ncdc
This commit is contained in:
k8s-merge-robot 2016-06-24 13:56:35 -07:00 committed by GitHub
commit 46e7c7160a

View File

@ -1426,182 +1426,4 @@ var _ = framework.KubeDescribe("Pods", func() {
framework.Failf("expected %s back-off got=%s on delay2", kubelet.MaxContainerBackOff, delay2)
}
})
// The following tests for remote command execution and port forwarding are
// commented out because the GCE environment does not currently have nsenter
// in the kubelet's PATH, nor does it have socat installed. Once we figure
// out the best way to have nsenter and socat available in GCE (and hopefully
// all providers), we can enable these tests.
/*
It("should support remote command execution", func() {
clientConfig, err := framework.LoadConfig()
if err != nil {
framework.Failf("Failed to create client config: %v", err)
}
podClient := f.Client.Pods(f.Namespace.Name)
By("creating the pod")
name := "pod-exec-" + string(util.NewUUID())
value := strconv.Itoa(time.Now().Nanosecond())
pod := &api.Pod{
ObjectMeta: api.ObjectMeta{
Name: name,
Labels: map[string]string{
"name": "foo",
"time": value,
},
},
Spec: api.PodSpec{
Containers: []api.Container{
{
Name: "nginx",
Image: "gcr.io/google_containers/nginx:1.7.9",
},
},
},
}
By("submitting the pod to kubernetes")
_, err = podClient.Create(pod)
if err != nil {
framework.Failf("Failed to create pod: %v", err)
}
defer func() {
// We call defer here in case there is a problem with
// the test so we can ensure that we clean up after
// ourselves
podClient.Delete(pod.Name, api.NewDeleteOptions(0))
}()
By("waiting for the pod to start running")
framework.ExpectNoError(f.WaitForPodRunning(pod.Name))
By("verifying the pod is in kubernetes")
selector := labels.SelectorFromSet(labels.Set(map[string]string{"time": value}))
options := api.ListOptions{LabelSelector: selector}
pods, err := podClient.List(options)
if err != nil {
framework.Failf("Failed to query for pods: %v", err)
}
Expect(len(pods.Items)).To(Equal(1))
pod = &pods.Items[0]
By(fmt.Sprintf("executing command on host %s pod %s in container %s",
pod.Status.Host, pod.Name, pod.Spec.Containers[0].Name))
req := f.Client.Get().
Prefix("proxy").
Resource("nodes").
Name(pod.Status.Host).
Suffix("exec", f.Namespace.Name, pod.Name, pod.Spec.Containers[0].Name)
out := &bytes.Buffer{}
e := remotecommand.New(req, clientConfig, []string{"whoami"}, nil, out, nil, false)
err = e.Execute()
if err != nil {
framework.Failf("Failed to execute command on host %s pod %s in container %s: %v",
pod.Status.Host, pod.Name, pod.Spec.Containers[0].Name, err)
}
if e, a := "root\n", out.String(); e != a {
framework.Failf("exec: whoami: expected '%s', got '%s'", e, a)
}
})
It("should support port forwarding", func() {
clientConfig, err := framework.LoadConfig()
if err != nil {
framework.Failf("Failed to create client config: %v", err)
}
podClient := f.Client.Pods(f.Namespace.Name)
By("creating the pod")
name := "pod-portforward-" + string(util.NewUUID())
value := strconv.Itoa(time.Now().Nanosecond())
pod := &api.Pod{
ObjectMeta: api.ObjectMeta{
Name: name,
Labels: map[string]string{
"name": "foo",
"time": value,
},
},
Spec: api.PodSpec{
Containers: []api.Container{
{
Name: "nginx",
Image: "gcr.io/google_containers/nginx:1.7.9",
Ports: []api.Port{{ContainerPort: 80}},
},
},
},
}
By("submitting the pod to kubernetes")
_, err = podClient.Create(pod)
if err != nil {
framework.Failf("Failed to create pod: %v", err)
}
defer func() {
// We call defer here in case there is a problem with
// the test so we can ensure that we clean up after
// ourselves
podClient.Delete(pod.Name, api.NewDeleteOptions(0))
}()
By("waiting for the pod to start running")
framework.ExpectNoError(f.WaitForPodRunning(pod.Name))
By("verifying the pod is in kubernetes")
selector := labels.SelectorFromSet(labels.Set(map[string]string{"time": value}))
options := api.ListOptions{LabelSelector: selector}
pods, err := podClient.List(options)
if err != nil {
framework.Failf("Failed to query for pods: %v", err)
}
Expect(len(pods.Items)).To(Equal(1))
pod = &pods.Items[0]
By(fmt.Sprintf("initiating port forwarding to host %s pod %s in container %s",
pod.Status.Host, pod.Name, pod.Spec.Containers[0].Name))
req := f.Client.Get().
Prefix("proxy").
Resource("nodes").
Name(pod.Status.Host).
Suffix("portForward", f.Namespace.Name, pod.Name)
stopChan := make(chan struct{})
pf, err := portforward.New(req, clientConfig, []string{"5678:80"}, stopChan)
if err != nil {
framework.Failf("Error creating port forwarder: %s", err)
}
errorChan := make(chan error)
go func() {
errorChan <- pf.ForwardPorts()
}()
// wait for listeners to start
<-pf.Ready
resp, err := http.Get("http://localhost:5678/")
if err != nil {
framework.Failf("Error with http get to localhost:5678: %s", err)
}
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
framework.Failf("Error reading response body: %s", err)
}
titleRegex := regexp.MustCompile("<title>(.+)</title>")
matches := titleRegex.FindStringSubmatch(string(body))
if len(matches) != 2 {
Fail("Unable to locate page title in response HTML")
}
if e, a := "Welcome to nginx on Debian!", matches[1]; e != a {
framework.Failf("<title>: expected '%s', got '%s'", e, a)
}
})
*/
})