From 90f408ba8810ba65e133d2cf0682dff9d28d9b59 Mon Sep 17 00:00:00 2001 From: Andrew McDermott Date: Fri, 22 Feb 2019 14:00:36 +0000 Subject: [PATCH] UPSTREAM: : openshift: Remove old test functions These are now covered by TestControllerNodeGroupForNodeLookup --- .../machineapi_controller_test.go | 172 ------------------ 1 file changed, 172 deletions(-) diff --git a/cluster-autoscaler/cloudprovider/openshiftmachineapi/machineapi_controller_test.go b/cluster-autoscaler/cloudprovider/openshiftmachineapi/machineapi_controller_test.go index 40198e60a2c8..1e54285f0a2d 100644 --- a/cluster-autoscaler/cloudprovider/openshiftmachineapi/machineapi_controller_test.go +++ b/cluster-autoscaler/cloudprovider/openshiftmachineapi/machineapi_controller_test.go @@ -636,178 +636,6 @@ func TestControllerNodeGroupForNodeWithMissingMachineOwner(t *testing.T) { } } -func TestControllerNodeGroupForNodeSuccessFromMachineSet(t *testing.T) { - node := &apiv1.Node{ - TypeMeta: v1.TypeMeta{ - Kind: "Node", - }, - ObjectMeta: v1.ObjectMeta{ - Name: "node", - Annotations: map[string]string{ - machineAnnotationKey: "test-namespace/machine", - }, - }, - Spec: apiv1.NodeSpec{ - ProviderID: "provider-id", - }, - } - - machineSet := &v1beta1.MachineSet{ - TypeMeta: v1.TypeMeta{ - Kind: "MachineSet", - }, - ObjectMeta: v1.ObjectMeta{ - Name: "machineset", - Namespace: "test-namespace", - UID: uuid1, - }, - } - - machine := &v1beta1.Machine{ - TypeMeta: v1.TypeMeta{ - Kind: "Machine", - }, - ObjectMeta: v1.ObjectMeta{ - Name: "machine", - Namespace: "test-namespace", - OwnerReferences: []v1.OwnerReference{{ - Name: machineSet.Name, - Kind: machineSet.Kind, - UID: machineSet.UID, - }}, - }, - } - - controller, stop := mustCreateTestController(t, testControllerConfig{ - nodeObjects: []runtime.Object{ - node, - }, - machineObjects: []runtime.Object{ - machine, - machineSet, - }, - }) - defer stop() - - ng, err := controller.nodeGroupForNode(&apiv1.Node{ - TypeMeta: v1.TypeMeta{ - Kind: "Node", - }, - ObjectMeta: v1.ObjectMeta{ - Name: "node", - }, - Spec: apiv1.NodeSpec{ - ProviderID: "provider-id", - }, - }) - - if err != nil { - t.Fatal("expected no error") - } - - if ng == nil { - t.Fatal("expected a nodegroup") - } - - expected := path.Join(machineSet.Namespace, machineSet.Name) - if actual := ng.Id(); actual != expected { - t.Errorf("expected %q, got %q", expected, actual) - } -} - -func TestControllerNodeGroupForNodeSuccessFromMachineDeployment(t *testing.T) { - node := &apiv1.Node{ - TypeMeta: v1.TypeMeta{ - Kind: "Node", - }, - ObjectMeta: v1.ObjectMeta{ - Name: "node", - Annotations: map[string]string{ - machineAnnotationKey: "test-namespace/machine", - }, - }, - Spec: apiv1.NodeSpec{ - ProviderID: "provider-id", - }, - } - - machineDeployment := &v1beta1.MachineDeployment{ - TypeMeta: v1.TypeMeta{ - Kind: "MachineDeployment", - }, - ObjectMeta: v1.ObjectMeta{ - Name: "machinedeployment", - Namespace: "test-namespace", - }, - } - - machineSet := &v1beta1.MachineSet{ - TypeMeta: v1.TypeMeta{ - Kind: "MachineSet", - }, - ObjectMeta: v1.ObjectMeta{ - Name: "machineset", - Namespace: "test-namespace", - OwnerReferences: []v1.OwnerReference{{ - Kind: "MachineDeployment", - Name: machineDeployment.Name, - }}, - }, - } - - machine := &v1beta1.Machine{ - TypeMeta: v1.TypeMeta{ - Kind: "Machine", - }, - ObjectMeta: v1.ObjectMeta{ - Name: "machine", - Namespace: "test-namespace", - OwnerReferences: []v1.OwnerReference{{ - Name: machineSet.Name, - Kind: machineSet.Kind, - UID: machineSet.UID, - }}, - }, - } - - controller, stop := mustCreateTestController(t, testControllerConfig{ - nodeObjects: []runtime.Object{ - node, - }, - machineObjects: []runtime.Object{ - machine, - machineSet, - machineDeployment, - }, - }) - defer stop() - - ng, err := controller.nodeGroupForNode(&apiv1.Node{ - TypeMeta: v1.TypeMeta{ - Kind: "Node", - }, - ObjectMeta: v1.ObjectMeta{ - Name: "node", - }, - Spec: apiv1.NodeSpec{ - ProviderID: "provider-id", - }, - }) - - if err != nil { - t.Fatal("expected no error") - } - - if ng == nil { - t.Fatal("expected a nodegroup") - } - - expected := path.Join(machineDeployment.Namespace, machineDeployment.Name) - if actual := ng.Id(); actual != expected { - t.Errorf("expected %q, got %q", expected, actual) - } -} - func TestControllerNodeGroupsWithMachineDeployments(t *testing.T) { machineDeploymentTemplate := &v1beta1.MachineDeployment{ TypeMeta: v1.TypeMeta{