Skip to content

Conversation

@sowmyav27
Copy link
Contributor

@sowmyav27 sowmyav27 commented Sep 9, 2025

What issue type does this pull request address? (keep at least one, remove the others)
/kind test

What does this pull request do? Which issues does it resolve? (use resolves #<issue_number> if possible)
For eng-6661

@sowmyav27 sowmyav27 force-pushed the add-test-eng-6661 branch 2 times, most recently from 8f1fb9a to dbc7868 Compare September 10, 2025 00:58
@sowmyav27 sowmyav27 force-pushed the add-test-eng-6661 branch 2 times, most recently from 9646794 to cd0c636 Compare November 2, 2025 21:13
@sowmyav27 sowmyav27 marked this pull request as ready for review November 3, 2025 18:30
@sowmyav27 sowmyav27 requested review from a team as code owners November 3, 2025 18:30

translatedServiceName := translate.SingleNamespaceHostName(serviceName, serviceNamespace, translate.VClusterName)

ginkgo.By("Verify Service exists in Host Cluster")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed this is only a check about existence. But is this sufficient? I'd test also the content of the objects. E.g. the presence of the input values from above:

				Ports: []corev1.ServicePort{
				{
					Name:       "custom-port",
					Port:       8080,
					Protocol:   corev1.ProtocolTCP,
					TargetPort: intstr.FromInt(5000),
				},
			},

This also applies to the endpoint object.


ginkgo.Context("Verify endpoint sync when endpoint is deployed before service", func() {
ginkgo.It("Should sync Service, Endpoints, and EndpointSlice from vCluster to host cluster", func() {
ctx := f.Context
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: usage of ctx vs. f.Context is not consistent. The object creations use .Create(f.Context, ... and all other use .Get(ctx, ...


ginkgo.By("Create Service Endpoint in vCluster")
_, err := f.VClusterClient.CoreV1().Endpoints(serviceNamespace).Create(f.Context, testEndpoint, metav1.CreateOptions{})
framework.ExpectNoError(err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd always prefer gomega.Expect(err).To(gomega.Succeed()) over framework.ExpectNoError(err)` because:

  1. it delivers way more context in case of failure. E.g. the whole nested error chain instead of only the aggregated error message.
  2. it is universal, can be used in any test, not only the once using framework.

But this is personal preference, feel free to just close this comment in case of disagreement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants