mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 07:27:21 +00:00
boring
This commit is contained in:
@@ -912,7 +912,6 @@ func TestRegisterWithApiServer(t *testing.T) {
|
||||
kubeletapis.LabelArch: goruntime.GOARCH,
|
||||
},
|
||||
},
|
||||
Spec: v1.NodeSpec{ExternalID: testKubeletHostname},
|
||||
}, nil
|
||||
})
|
||||
kubeClient.AddReactor("*", "*", func(action core.Action) (bool, runtime.Object, error) {
|
||||
@@ -966,7 +965,7 @@ func TestTryRegisterWithApiServer(t *testing.T) {
|
||||
ErrStatus: metav1.Status{Reason: metav1.StatusReasonConflict},
|
||||
}
|
||||
|
||||
newNode := func(cmad bool, externalID string) *v1.Node {
|
||||
newNode := func(cmad bool) *v1.Node {
|
||||
node := &v1.Node{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
@@ -975,9 +974,6 @@ func TestTryRegisterWithApiServer(t *testing.T) {
|
||||
kubeletapis.LabelArch: goruntime.GOARCH,
|
||||
},
|
||||
},
|
||||
Spec: v1.NodeSpec{
|
||||
ExternalID: externalID,
|
||||
},
|
||||
}
|
||||
|
||||
if cmad {
|
||||
@@ -1010,17 +1006,17 @@ func TestTryRegisterWithApiServer(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "success case - existing node - no change in CMAD",
|
||||
newNode: newNode(true, "a"),
|
||||
newNode: newNode(true),
|
||||
createError: alreadyExists,
|
||||
existingNode: newNode(true, "a"),
|
||||
existingNode: newNode(true),
|
||||
expectedResult: true,
|
||||
expectedActions: 2,
|
||||
},
|
||||
{
|
||||
name: "success case - existing node - CMAD disabled",
|
||||
newNode: newNode(false, "a"),
|
||||
newNode: newNode(false),
|
||||
createError: alreadyExists,
|
||||
existingNode: newNode(true, "a"),
|
||||
existingNode: newNode(true),
|
||||
expectedResult: true,
|
||||
expectedActions: 3,
|
||||
testSavedNode: true,
|
||||
@@ -1029,33 +1025,25 @@ func TestTryRegisterWithApiServer(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "success case - existing node - CMAD enabled",
|
||||
newNode: newNode(true, "a"),
|
||||
newNode: newNode(true),
|
||||
createError: alreadyExists,
|
||||
existingNode: newNode(false, "a"),
|
||||
existingNode: newNode(false),
|
||||
expectedResult: true,
|
||||
expectedActions: 3,
|
||||
testSavedNode: true,
|
||||
savedNodeIndex: 2,
|
||||
savedNodeCMAD: true,
|
||||
},
|
||||
{
|
||||
name: "success case - external ID changed",
|
||||
newNode: newNode(false, "b"),
|
||||
createError: alreadyExists,
|
||||
existingNode: newNode(false, "a"),
|
||||
expectedResult: false,
|
||||
expectedActions: 3,
|
||||
},
|
||||
{
|
||||
name: "create failed",
|
||||
newNode: newNode(false, "b"),
|
||||
newNode: newNode(false),
|
||||
createError: conflict,
|
||||
expectedResult: false,
|
||||
expectedActions: 1,
|
||||
},
|
||||
{
|
||||
name: "get existing node failed",
|
||||
newNode: newNode(false, "a"),
|
||||
newNode: newNode(false),
|
||||
createError: alreadyExists,
|
||||
getError: conflict,
|
||||
expectedResult: false,
|
||||
@@ -1063,22 +1051,13 @@ func TestTryRegisterWithApiServer(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "update existing node failed",
|
||||
newNode: newNode(false, "a"),
|
||||
newNode: newNode(false),
|
||||
createError: alreadyExists,
|
||||
existingNode: newNode(true, "a"),
|
||||
existingNode: newNode(true),
|
||||
patchError: conflict,
|
||||
expectedResult: false,
|
||||
expectedActions: 3,
|
||||
},
|
||||
{
|
||||
name: "delete existing node failed",
|
||||
newNode: newNode(false, "b"),
|
||||
createError: alreadyExists,
|
||||
existingNode: newNode(false, "a"),
|
||||
deleteError: conflict,
|
||||
expectedResult: false,
|
||||
expectedActions: 3,
|
||||
},
|
||||
}
|
||||
|
||||
notImplemented := func(action core.Action) (bool, runtime.Object, error) {
|
||||
|
||||
Reference in New Issue
Block a user