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

@@ -19,6 +19,7 @@ package container
import (
"fmt"
"io"
"reflect"
"strings"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
@@ -282,6 +283,11 @@ func (p *Pod) FindContainerByName(containerName string) *Container {
return nil
}
// IsEmpty returns true if the pod is empty.
func (p *Pod) IsEmpty() bool {
return reflect.DeepEqual(p, &Pod{})
}
// GetPodFullName returns a name that uniquely identifies a pod.
func GetPodFullName(pod *api.Pod) string {
// Use underscore as the delimiter because it is not allowed in pod name