From ca9b63add2092a627ba5e8e88e35c1fdb2777d69 Mon Sep 17 00:00:00 2001 From: Euan Kemp Date: Fri, 27 May 2016 16:55:42 -0700 Subject: [PATCH] e2e: Delete old code --- test/e2e/pods.go | 178 ----------------------------------------------- 1 file changed, 178 deletions(-) diff --git a/test/e2e/pods.go b/test/e2e/pods.go index da3d0821e46..1201d76d928 100644 --- a/test/e2e/pods.go +++ b/test/e2e/pods.go @@ -1422,182 +1422,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("(.+)") - 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(": expected '%s', got '%s'", e, a) - } - }) - */ })