From 0082bd00610f3c774bf656b50bb535facf07d11c Mon Sep 17 00:00:00 2001 From: Suraj Narwade Date: Fri, 22 Sep 2017 11:29:23 +0530 Subject: [PATCH] Cleaning up unused functions in /pkg/controller/deployment/util --- .../deployment/util/deployment_util.go | 7 -- .../deployment/util/deployment_util_test.go | 64 +------------------ 2 files changed, 2 insertions(+), 69 deletions(-) diff --git a/pkg/controller/deployment/util/deployment_util.go b/pkg/controller/deployment/util/deployment_util.go index 39872bd17b5..62c814cc8e0 100644 --- a/pkg/controller/deployment/util/deployment_util.go +++ b/pkg/controller/deployment/util/deployment_util.go @@ -548,13 +548,6 @@ func RsListFromClient(c extensionsv1beta1.ExtensionsV1beta1Interface) RsListFunc } } -// podListFromClient returns a podListFunc that wraps the given client. -func podListFromClient(c clientset.Interface) podListFunc { - return func(namespace string, options metav1.ListOptions) (*v1.PodList, error) { - return c.Core().Pods(namespace).List(options) - } -} - // TODO: switch this to full namespacers type RsListFunc func(string, metav1.ListOptions) ([]*extensions.ReplicaSet, error) type podListFunc func(string, metav1.ListOptions) (*v1.PodList, error) diff --git a/pkg/controller/deployment/util/deployment_util_test.go b/pkg/controller/deployment/util/deployment_util_test.go index 115ae9148a1..a26e9dc8894 100644 --- a/pkg/controller/deployment/util/deployment_util_test.go +++ b/pkg/controller/deployment/util/deployment_util_test.go @@ -85,64 +85,6 @@ func addUpdatePodsReactor(fakeClient *fake.Clientset) *fake.Clientset { return fakeClient } -func newPod(now time.Time, ready bool, beforeSec int) v1.Pod { - conditionStatus := v1.ConditionFalse - if ready { - conditionStatus = v1.ConditionTrue - } - return v1.Pod{ - Status: v1.PodStatus{ - Conditions: []v1.PodCondition{ - { - Type: v1.PodReady, - LastTransitionTime: metav1.NewTime(now.Add(-1 * time.Duration(beforeSec) * time.Second)), - Status: conditionStatus, - }, - }, - }, - } -} - -func newRSControllerRef(rs *extensions.ReplicaSet) *metav1.OwnerReference { - isController := true - return &metav1.OwnerReference{ - APIVersion: "extensions/v1beta1", - Kind: "ReplicaSet", - Name: rs.GetName(), - UID: rs.GetUID(), - Controller: &isController, - } -} - -// generatePodFromRS creates a pod, with the input ReplicaSet's selector and its template -func generatePodFromRS(rs extensions.ReplicaSet) v1.Pod { - return v1.Pod{ - ObjectMeta: metav1.ObjectMeta{ - Labels: rs.Labels, - OwnerReferences: []metav1.OwnerReference{*newRSControllerRef(&rs)}, - }, - Spec: rs.Spec.Template.Spec, - } -} - -func generatePod(labels map[string]string, image string) v1.Pod { - return v1.Pod{ - ObjectMeta: metav1.ObjectMeta{ - Labels: labels, - }, - Spec: v1.PodSpec{ - Containers: []v1.Container{ - { - Name: image, - Image: image, - ImagePullPolicy: v1.PullAlways, - TerminationMessagePath: v1.TerminationMessagePathDefault, - }, - }, - }, - } -} - func generateRSWithLabel(labels map[string]string, image string) extensions.ReplicaSet { return extensions.ReplicaSet{ ObjectMeta: metav1.ObjectMeta{ @@ -820,10 +762,8 @@ func TestGetCondition(t *testing.T) { tests := []struct { name string - status extensions.DeploymentStatus - condType extensions.DeploymentConditionType - condStatus v1.ConditionStatus - condReason string + status extensions.DeploymentStatus + condType extensions.DeploymentConditionType expected bool }{