mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	fix: npe in kubelet test
Signed-off-by: haoyun <yun.hao@daocloud.io> Co-authored-by: Antonio Ojea <antonio.ojea.garcia@gmail.com>
This commit is contained in:
		@@ -2410,9 +2410,12 @@ func TestSyncLabels(t *testing.T) {
 | 
			
		||||
						}
 | 
			
		||||
						for _, action := range actions {
 | 
			
		||||
							if action.GetVerb() == "patch" {
 | 
			
		||||
								patchAction := action.(core.PatchActionImpl)
 | 
			
		||||
								var err error
 | 
			
		||||
								savedNode, err = applyNodeStatusPatch(test.existingNode, patchAction.GetPatch())
 | 
			
		||||
								var (
 | 
			
		||||
									err          error
 | 
			
		||||
									patchAction  = action.(core.PatchActionImpl)
 | 
			
		||||
									patchContent = patchAction.GetPatch()
 | 
			
		||||
								)
 | 
			
		||||
								savedNode, err = applyNodeStatusPatch(test.existingNode, patchContent)
 | 
			
		||||
								if err != nil {
 | 
			
		||||
									t.Logf("node patching failed, %v", err)
 | 
			
		||||
									return false, nil
 | 
			
		||||
@@ -2422,6 +2425,10 @@ func TestSyncLabels(t *testing.T) {
 | 
			
		||||
					} else {
 | 
			
		||||
						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]
 | 
			
		||||
					if !ok {
 | 
			
		||||
						t.Logf("expected kubernetes.io/os label to be present")
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user