Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing a flaky EndpointSliceMirroring integration test #94089

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 8 additions & 13 deletions test/integration/endpointslice/endpointslicemirroring_test.go
Expand Up @@ -84,7 +84,7 @@ func TestEndpointSliceMirroring(t *testing.T) {
testCases := []struct {
testName string
service *corev1.Service
endpoints *corev1.Endpoints
customEndpoints *corev1.Endpoints
expectEndpointSlice bool
expectEndpointSliceManagedBy string
}{{
Expand All @@ -102,11 +102,6 @@ func TestEndpointSliceMirroring(t *testing.T) {
},
},
},
endpoints: &corev1.Endpoints{
ObjectMeta: metav1.ObjectMeta{
Name: "test-123",
},
},
expectEndpointSlice: true,
expectEndpointSliceManagedBy: "endpointslice-controller.k8s.io",
}, {
Expand All @@ -121,7 +116,7 @@ func TestEndpointSliceMirroring(t *testing.T) {
}},
},
},
endpoints: &corev1.Endpoints{
customEndpoints: &corev1.Endpoints{
ObjectMeta: metav1.ObjectMeta{
Name: "test-123",
},
Expand Down Expand Up @@ -151,13 +146,13 @@ func TestEndpointSliceMirroring(t *testing.T) {
},
},
},
endpoints: nil,
customEndpoints: nil,
expectEndpointSlice: true,
expectEndpointSliceManagedBy: "endpointslice-controller.k8s.io",
}, {
testName: "Endpoints without Service",
service: nil,
endpoints: &corev1.Endpoints{
customEndpoints: &corev1.Endpoints{
ObjectMeta: metav1.ObjectMeta{
Name: "test-123",
},
Expand All @@ -180,10 +175,10 @@ func TestEndpointSliceMirroring(t *testing.T) {
}
}

if tc.endpoints != nil {
resourceName = tc.endpoints.Name
tc.endpoints.Namespace = ns.Name
_, err = client.CoreV1().Endpoints(ns.Name).Create(context.TODO(), tc.endpoints, metav1.CreateOptions{})
if tc.customEndpoints != nil {
resourceName = tc.customEndpoints.Name
tc.customEndpoints.Namespace = ns.Name
_, err = client.CoreV1().Endpoints(ns.Name).Create(context.TODO(), tc.customEndpoints, metav1.CreateOptions{})
if err != nil {
t.Fatalf("Error creating endpoints: %v", err)
}
Expand Down