test()- Enhance and Automate E2E Testing Across the KubeSlice Ecosystem (worker-operator) #452
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces a complete end-to-end (E2E) testing setup for the
worker-operatorrepository.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:
How Has This Been Tested?
Checklist:
go fmtDoes this PR introduce a breaking change?