mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
Merge pull request #106414 from jonyhy96/kubelet-fix-flake
kubelet: fix npe in test
This commit is contained in:
commit
ddfc53922c
@ -2410,9 +2410,12 @@ func TestSyncLabels(t *testing.T) {
|
|||||||
}
|
}
|
||||||
for _, action := range actions {
|
for _, action := range actions {
|
||||||
if action.GetVerb() == "patch" {
|
if action.GetVerb() == "patch" {
|
||||||
patchAction := action.(core.PatchActionImpl)
|
var (
|
||||||
var err error
|
err error
|
||||||
savedNode, err = applyNodeStatusPatch(test.existingNode, patchAction.GetPatch())
|
patchAction = action.(core.PatchActionImpl)
|
||||||
|
patchContent = patchAction.GetPatch()
|
||||||
|
)
|
||||||
|
savedNode, err = applyNodeStatusPatch(test.existingNode, patchContent)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Logf("node patching failed, %v", err)
|
t.Logf("node patching failed, %v", err)
|
||||||
return false, nil
|
return false, nil
|
||||||
@ -2422,6 +2425,10 @@ func TestSyncLabels(t *testing.T) {
|
|||||||
} else {
|
} else {
|
||||||
savedNode = test.existingNode
|
savedNode = test.existingNode
|
||||||
}
|
}
|
||||||
|
if savedNode == nil || savedNode.Labels == nil {
|
||||||
|
t.Logf("savedNode.Labels should not be nil")
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
val, ok := savedNode.Labels[v1.LabelOSStable]
|
val, ok := savedNode.Labels[v1.LabelOSStable]
|
||||||
if !ok {
|
if !ok {
|
||||||
t.Logf("expected kubernetes.io/os label to be present")
|
t.Logf("expected kubernetes.io/os label to be present")
|
||||||
|
Loading…
Reference in New Issue
Block a user