add test about shutdown but non-existing node.

This commit is contained in:
Indeed 2020-05-04 10:57:01 -07:00
parent b48f5af260
commit 84dfaace5d

View File

@ -416,6 +416,37 @@ func Test_NodesShutdown(t *testing.T) {
},
updatedNodes: []*v1.Node{},
},
{
name: "node is shutdown but provider says it does not exist",
fnh: &testutil.FakeNodeHandler{
Existing: []*v1.Node{
{
ObjectMeta: metav1.ObjectMeta{
Name: "node0",
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.Local),
},
Status: v1.NodeStatus{
Conditions: []v1.NodeCondition{
{
Type: v1.NodeReady,
Status: v1.ConditionUnknown,
LastHeartbeatTime: metav1.Date(2015, 1, 1, 12, 0, 0, 0, time.Local),
LastTransitionTime: metav1.Date(2015, 1, 1, 12, 0, 0, 0, time.Local),
},
},
},
},
},
Clientset: fake.NewSimpleClientset(),
UpdatedNodes: []*v1.Node{},
},
fakeCloud: &fakecloud.Cloud{
NodeShutdown: true,
ExistsByProviderID: false,
ErrShutdownByProviderID: nil,
},
updatedNodes: []*v1.Node{}, // should be empty because node does not exist
},
}
for _, testcase := range testcases {