Skip to content

Conversation

@andoriyaprashant
Copy link

Description

This PR introduces a complete end-to-end (E2E) testing setup for the worker-operator repository.
It lays the foundation for verifying the full reconciliation lifecycle of critical resources like Slice, SliceGateway, ServiceExport, and ServiceImport.

Fixes kubeslice/kubeslice#56

Key Highlights

The E2E testing framework introduces a comprehensive test setup and validation flow across multiple core components. The foundation lies in suite_test.go, which serves as the backbone of all tests. It initializes a local Kubernetes control plane using envtest, installs all CRDs, and sets up the client used for interacting with the cluster. Additionally, it provides reusable helper functions like createNamespaceIfNotExists, createTestPod, and createSlice, enabling modular and maintainable test cases.

The serviceexport_test.go file validates the complete ServiceExport lifecycle by ensuring the resource creation, reconciliation, and status updates are handled correctly through asynchronous checks using Ginkgo’s Eventually blocks. Similarly, serviceimport_test.go verifies the ServiceImport reconciliation process by testing that fields such as ImportStatus and ExposedPorts update accurately. It also uses a test Pod to simulate realistic cross-cluster service behavior.

The slice_test.go file provides end-to-end coverage for the Slice CRD from creation and status updates to cleanup ensuring that slice lifecycle management and pod associations across namespaces function as expected. Meanwhile, slicegateway_test.go focuses on SliceGateway reconciliation and gateway pod creation, validating that all gateway components are properly deployed and their statuses are updated during reconciliation.

Finally, the Makefile has been updated with a new e2e-test target, simplifying the process of running all E2E tests locally with a single command:

make e2e-test

How Has This Been Tested?

  • Verified E2E environment setup (envtest) runs successfully.
  • Confirmed CRD installation and manager initialization.
  • All E2E tests executed locally using make e2e-test.

Checklist:

  • The title of the PR states what changed and the related issues number (used for the release note).
  • Does this PR requires documentation updates?
  • I've updated documentation as required by this PR.
  • I have ran go fmt
  • I have updated the helm chart as required by this PR.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have tested it for all user roles.
  • I have added all the required unit test cases.
  • I have verified the E2E test cases with new code changes.
  • I have added all the required E2E test cases.

Does this PR introduce a breaking change?


Signed-off-by: andoriyaprashant <prashantandoriya@gmail.com>
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.

Feature: Enhance and Automate End-to-End (E2E) Testing Across the KubeSlice Ecosystem

1 participant