mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-19 09:52:49 +00:00
test/integration/endpointslice: remove references to EndpointSliceTerminatingCondition feature gate
Signed-off-by: Andrew Sy Kim <andrewsy@google.com>
This commit is contained in:
parent
5ca805fdee
commit
9e24680d0b
@ -27,69 +27,24 @@ import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
"k8s.io/client-go/informers"
|
||||
clientset "k8s.io/client-go/kubernetes"
|
||||
featuregatetesting "k8s.io/component-base/featuregate/testing"
|
||||
kubeapiservertesting "k8s.io/kubernetes/cmd/kube-apiserver/app/testing"
|
||||
"k8s.io/kubernetes/pkg/controller/endpointslice"
|
||||
"k8s.io/kubernetes/pkg/features"
|
||||
"k8s.io/kubernetes/test/integration/framework"
|
||||
utilpointer "k8s.io/utils/pointer"
|
||||
)
|
||||
|
||||
// TestEndpointSliceTerminating tests that terminating pods are NOT included in EndpointSlice when
|
||||
// the feature gate EndpointSliceTerminatingCondition is off. If the gate is on, it tests that
|
||||
// terminating endpoints are included but with the correct conditions set for ready, serving and terminating.
|
||||
// TestEndpointSliceTerminating tests that terminating endpoints are included with the
|
||||
// correct conditions set for ready, serving and terminating.
|
||||
func TestEndpointSliceTerminating(t *testing.T) {
|
||||
testcases := []struct {
|
||||
name string
|
||||
podStatus corev1.PodStatus
|
||||
expectedEndpoints []discovery.Endpoint
|
||||
terminatingGate bool
|
||||
}{
|
||||
{
|
||||
name: "ready terminating pods not included, terminating gate off",
|
||||
podStatus: corev1.PodStatus{
|
||||
Phase: corev1.PodRunning,
|
||||
Conditions: []corev1.PodCondition{
|
||||
{
|
||||
Type: corev1.PodReady,
|
||||
Status: corev1.ConditionTrue,
|
||||
},
|
||||
},
|
||||
PodIP: "10.0.0.1",
|
||||
PodIPs: []corev1.PodIP{
|
||||
{
|
||||
IP: "10.0.0.1",
|
||||
},
|
||||
},
|
||||
},
|
||||
expectedEndpoints: []discovery.Endpoint{},
|
||||
terminatingGate: false,
|
||||
},
|
||||
{
|
||||
name: "not ready terminating pods not included, terminating gate off",
|
||||
podStatus: corev1.PodStatus{
|
||||
Phase: corev1.PodRunning,
|
||||
Conditions: []corev1.PodCondition{
|
||||
{
|
||||
Type: corev1.PodReady,
|
||||
Status: corev1.ConditionFalse,
|
||||
},
|
||||
},
|
||||
PodIP: "10.0.0.1",
|
||||
PodIPs: []corev1.PodIP{
|
||||
{
|
||||
IP: "10.0.0.1",
|
||||
},
|
||||
},
|
||||
},
|
||||
expectedEndpoints: []discovery.Endpoint{},
|
||||
terminatingGate: false,
|
||||
},
|
||||
{
|
||||
name: "ready terminating pods included, terminating gate on",
|
||||
name: "ready terminating pods",
|
||||
podStatus: corev1.PodStatus{
|
||||
Phase: corev1.PodRunning,
|
||||
Conditions: []corev1.PodCondition{
|
||||
@ -115,10 +70,9 @@ func TestEndpointSliceTerminating(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
terminatingGate: true,
|
||||
},
|
||||
{
|
||||
name: "not ready terminating pods included, terminating gate on",
|
||||
name: "not ready terminating pods",
|
||||
podStatus: corev1.PodStatus{
|
||||
Phase: corev1.PodRunning,
|
||||
Conditions: []corev1.PodCondition{
|
||||
@ -144,14 +98,11 @@ func TestEndpointSliceTerminating(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
terminatingGate: true,
|
||||
},
|
||||
}
|
||||
|
||||
for _, testcase := range testcases {
|
||||
t.Run(testcase.name, func(t *testing.T) {
|
||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.EndpointSliceTerminatingCondition, testcase.terminatingGate)()
|
||||
|
||||
// Disable ServiceAccount admission plugin as we don't have serviceaccount controller running.
|
||||
server := kubeapiservertesting.StartTestServerOrDie(t, nil, []string{"--disable-admission-plugins=ServiceAccount"}, framework.SharedEtcd())
|
||||
defer server.TearDownFn()
|
||||
|
Loading…
Reference in New Issue
Block a user