Skip to content

Commit

Permalink
UPSTREAM: <carry>: openshift: Remove old test functions
Browse files Browse the repository at this point in the history
These are now covered by TestControllerNodeGroupForNodeLookup
  • Loading branch information
frobware committed Feb 22, 2019
1 parent fd88786 commit 90f408b
Showing 1 changed file with 0 additions and 172 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit 90f408b

Please sign in to comment.