mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	add validation test for RegisterWithTaints
This commit is contained in:
		@@ -133,7 +133,7 @@ func ValidateKubeletConfiguration(kc *kubeletconfig.KubeletConfiguration) error
 | 
			
		||||
			allErrors = append(allErrors, fmt.Errorf("invalid taint: %v", nodeTaint))
 | 
			
		||||
		}
 | 
			
		||||
		if nodeTaint.TimeAdded != nil {
 | 
			
		||||
			allErrors = append(allErrors, fmt.Errorf("taint TimeAdded is not nil"))
 | 
			
		||||
			allErrors = append(allErrors, fmt.Errorf("invalid configuration: taint.TimeAdded is not nil"))
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -21,6 +21,7 @@ import (
 | 
			
		||||
	"testing"
 | 
			
		||||
	"time"
 | 
			
		||||
 | 
			
		||||
	v1 "k8s.io/api/core/v1"
 | 
			
		||||
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 | 
			
		||||
	componentbaseconfig "k8s.io/component-base/config"
 | 
			
		||||
	kubeletconfig "k8s.io/kubernetes/pkg/kubelet/apis/config"
 | 
			
		||||
@@ -483,6 +484,15 @@ func TestValidateKubeletConfiguration(t *testing.T) {
 | 
			
		||||
			},
 | 
			
		||||
			errMsg: "invalid configuration: memoryThrottlingFactor 1.1 must be greater than 0 and less than or equal to 1.0",
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "invalid Taint.TimeAdded",
 | 
			
		||||
			configure: func(conf *kubeletconfig.KubeletConfiguration) *kubeletconfig.KubeletConfiguration {
 | 
			
		||||
				now := metav1.Now()
 | 
			
		||||
				conf.RegisterWithTaints = []v1.Taint{{TimeAdded: &now}}
 | 
			
		||||
				return conf
 | 
			
		||||
			},
 | 
			
		||||
			errMsg: "invalid configuration: taint.TimeAdded is not nil",
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for _, tc := range cases {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user