mirror of https://github.com/kubernetes/kops.git
Add test for ensuring taints are merged correctly
This commit is contained in:
parent
beebcf444b
commit
0dd0aef1ea
|
|
@ -70,6 +70,7 @@ func TestPopulateInstanceGroup_Role_Required(t *testing.T) {
|
||||||
expectErrorFromPopulateInstanceGroup(t, cluster, g, channel, "spec.role")
|
expectErrorFromPopulateInstanceGroup(t, cluster, g, channel, "spec.role")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TestPopulateInstanceGroup_AddTaintsCollision ensures we handle IGs with a user configured taint that kOps also adds by default
|
||||||
func TestPopulateInstanceGroup_AddTaintsCollision(t *testing.T) {
|
func TestPopulateInstanceGroup_AddTaintsCollision(t *testing.T) {
|
||||||
_, cluster := buildMinimalCluster()
|
_, cluster := buildMinimalCluster()
|
||||||
input := buildMinimalNodeInstanceGroup()
|
input := buildMinimalNodeInstanceGroup()
|
||||||
|
|
@ -87,11 +88,41 @@ func TestPopulateInstanceGroup_AddTaintsCollision(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("error from PopulateInstanceGroupSpec: %v", err)
|
t.Fatalf("error from PopulateInstanceGroupSpec: %v", err)
|
||||||
}
|
}
|
||||||
if len(output.Spec.Taints) != 1 {
|
if len(output.Spec.Kubelet.Taints) != 1 {
|
||||||
t.Errorf("Expected only 1 taint, got %d", len(output.Spec.Taints))
|
t.Errorf("Expected only 1 taint, got %d", len(output.Spec.Taints))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TestPopulateInstanceGroup_AddTaintsCollision2 ensures we handle taints that are configured in multiple parts of the spec and multiple resources.
|
||||||
|
// This one also adds a second taint that we should see in the final result
|
||||||
|
func TestPopulateInstanceGroup_AddTaintsCollision3(t *testing.T) {
|
||||||
|
taint := "e2etest:NoSchedule"
|
||||||
|
taint2 := "e2etest:NoExecute"
|
||||||
|
_, cluster := buildMinimalCluster()
|
||||||
|
cluster.Spec.Kubelet = &kopsapi.KubeletConfigSpec{
|
||||||
|
Taints: []string{taint, taint2},
|
||||||
|
}
|
||||||
|
input := buildMinimalNodeInstanceGroup()
|
||||||
|
input.Spec.Taints = []string{taint}
|
||||||
|
input.Spec.Kubelet = &kopsapi.KubeletConfigSpec{
|
||||||
|
Taints: []string{taint},
|
||||||
|
}
|
||||||
|
|
||||||
|
channel := &kopsapi.Channel{}
|
||||||
|
|
||||||
|
cloud, err := BuildCloud(cluster)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("error from BuildCloud: %v", err)
|
||||||
|
}
|
||||||
|
output, err := PopulateInstanceGroupSpec(cluster, input, cloud, channel)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("error from PopulateInstanceGroupSpec: %v", err)
|
||||||
|
}
|
||||||
|
if len(output.Spec.Kubelet.Taints) != 2 {
|
||||||
|
t.Errorf("Expected only 2 taints, got %d", len(output.Spec.Kubelet.Taints))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestPopulateInstanceGroup_AddTaints(t *testing.T) {
|
func TestPopulateInstanceGroup_AddTaints(t *testing.T) {
|
||||||
_, cluster := buildMinimalCluster()
|
_, cluster := buildMinimalCluster()
|
||||||
input := buildMinimalNodeInstanceGroup()
|
input := buildMinimalNodeInstanceGroup()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue