kubeslice-controller icon indicating copy to clipboard operation
kubeslice-controller copied to clipboard

test()- Enhance and Automate E2E Testing Across the KubeSlice Ecosystem (kubeslice-controller)

Open andoriyaprashant opened this issue 2 months ago • 1 comments

Description

This PR enhances and extends the End-to-End (E2E) test suite for the kubeslice-controller repository. The KubeSlice project provides application connectivity and network services across Kubernetes clusters. The existing E2E tests were outdated and incomplete. This PR updates the test suite to ensure robust coverage of critical functionalities and prepares it for automated execution in CI/CD pipelines.

Changes Implemented:

  • Added E2E tests for:
    • Cluster (cluster_test.go)
    • Project (project_test.go)
    • ServiceExportConfig (serviceexport_test.go)
    • SliceConfig (sliceconfig_test.go)
    • SliceQoSConfig (sliceqosconfig_test.go)
    • VpnKeyRotation (vpnkeyrotation_test.go)
  • Improved logging and debugging for test failures
  • Refactored cleanup steps to maintain a consistent test environment

Fixes - https://github.com/kubeslice/kubeslice/issues/56

How Has This Been Tested?

  • Ran the full E2E suite locally using Ginkgo for kubeslice-controller
  • Verified creation, update, and deletion for all CRs listed above

Test Run Data:

Ginkgo detected a version mismatch between the Ginkgo CLI and the version of Ginkgo imported by your packages:
  Ginkgo CLI Version:
    2.27.2
  Mismatched package versions found:
    2.22.0 used by e2e

  Ginkgo will continue to attempt to run but you may see errors (including flag
  parsing errors) and should either update your go.mod or your version of the
  Ginkgo CLI to match.

  To install the matching version of the CLI run
    go install github.com/onsi/ginkgo/v2/ginkgo
  from a path that contains a go.mod file.  Alternatively you can use
    go run github.com/onsi/ginkgo/v2/ginkgo
  from a path that contains a go.mod file to invoke the matching version of the
  Ginkgo CLI.

  If you are attempting to test multiple packages that each have a different
  version of the Ginkgo library with a single Ginkgo CLI that is currently
  unsupported.

Running Suite: KubeSlice E2E Suite - /mnt/c/Users/prashant/Downloads/kubeslice-controller/kubeslice-controller/e2e
===============================================================================================================
Random Seed: 1761770392

Will run 18 of 18 specs
------------------------------
[BeforeSuite]
/mnt/c/Users/prashant/Downloads/kubeslice-controller/kubeslice-controller/e2e/suite_test.go:47
  STEP: Bootstrapping test environment @ 10/29/25 20:40:18.452
[BeforeSuite] PASSED [0.067 seconds]
------------------------------
SliceQoSConfig E2E Tests should create a SliceQoSConfig successfully
/mnt/c/Users/prashant/Downloads/kubeslice-controller/kubeslice-controller/e2e/sliceqosconfig_test.go:29
  STEP: Creating a new SliceQoSConfig @ 10/29/25 20:40:18.52
  STEP: Verifying the SliceQoSConfig exists @ 10/29/25 20:40:18.533
  STEP: Cleaning up SliceQoSConfig after each test @ 10/29/25 20:40:18.541
• [0.041 seconds]
------------------------------
SliceQoSConfig E2E Tests should update an existing SliceQoSConfig
/mnt/c/Users/prashant/Downloads/kubeslice-controller/kubeslice-controller/e2e/sliceqosconfig_test.go:55
  STEP: Ensuring any previous SliceQoSConfig is fully deleted before re-creating @ 10/29/25 20:40:18.561
  STEP: Creating the SliceQoSConfig first @ 10/29/25 20:40:18.568
  STEP: Updating the Priority field @ 10/29/25 20:40:18.582
  STEP: Verifying the updated Priority field @ 10/29/25 20:40:18.865
  STEP: Cleaning up SliceQoSConfig after each test @ 10/29/25 20:40:18.871
• [0.323 seconds]
------------------------------
SliceQoSConfig E2E Tests should delete an existing SliceQoSConfig
/mnt/c/Users/prashant/Downloads/kubeslice-controller/kubeslice-controller/e2e/sliceqosconfig_test.go:98
  STEP: Ensuring any previous SliceQoSConfig is fully deleted before re-creating @ 10/29/25 20:40:18.884
  STEP: Creating the SliceQoSConfig first @ 10/29/25 20:40:19.143
  STEP: Deleting the SliceQoSConfig @ 10/29/25 20:40:19.15
  STEP: Verifying the SliceQoSConfig is deleted @ 10/29/25 20:40:19.159
  STEP: Cleaning up SliceQoSConfig after each test @ 10/29/25 20:40:19.164
• [0.284 seconds]
------------------------------
VpnKeyRotation Controller E2E Tests should create a VpnKeyRotation CR successfully
/mnt/c/Users/prashant/Downloads/kubeslice-controller/kubeslice-controller/e2e/vpnkeyrotation_test.go:59
  STEP: creating the VpnKeyRotation resource before each test @ 10/29/25 20:40:19.168
  STEP: fetching the created resource @ 10/29/25 20:40:19.18
• [0.024 seconds]
------------------------------
VpnKeyRotation Controller E2E Tests should update ClusterGatewayMapping after reconciliation
/mnt/c/Users/prashant/Downloads/kubeslice-controller/kubeslice-controller/e2e/vpnkeyrotation_test.go:69
  STEP: creating the VpnKeyRotation resource before each test @ 10/29/25 20:40:19.192
  STEP: ensuring ClusterGatewayMapping is initially empty @ 10/29/25 20:40:19.212
  STEP: simulating reconciliation by updating mapping @ 10/29/25 20:40:19.212
• [0.048 seconds]
------------------------------
VpnKeyRotation Controller E2E Tests should update CertificateCreationTime and CertificateExpiryTime after rotation
/mnt/c/Users/prashant/Downloads/kubeslice-controller/kubeslice-controller/e2e/vpnkeyrotation_test.go:90
  STEP: creating the VpnKeyRotation resource before each test @ 10/29/25 20:40:19.24
• [0.042 seconds]
------------------------------
VpnKeyRotation Controller E2E Tests should increment RotationCount after certificate expiry
/mnt/c/Users/prashant/Downloads/kubeslice-controller/kubeslice-controller/e2e/vpnkeyrotation_test.go:110
  STEP: creating the VpnKeyRotation resource before each test @ 10/29/25 20:40:19.282
• [0.046 seconds]
------------------------------
E2E: Cluster CRD lifecycle should create a Cluster CR successfully
/mnt/c/Users/prashant/Downloads/kubeslice-controller/kubeslice-controller/e2e/cluster_test.go:52
  STEP: Applying Cluster manifest @ 10/29/25 20:40:19.337
  STEP: Fetching created Cluster from API @ 10/29/25 20:40:19.348
• [0.025 seconds]
------------------------------
E2E: Cluster CRD lifecycle should reconcile and update Cluster status
/mnt/c/Users/prashant/Downloads/kubeslice-controller/kubeslice-controller/e2e/cluster_test.go:85
  STEP: Waiting for Cluster to be reconciled (status may be empty in local builds) @ 10/29/25 20:40:19.354
• [0.003 seconds]
------------------------------
E2E: Cluster CRD lifecycle should update Cluster CR when modifying spec
/mnt/c/Users/prashant/Downloads/kubeslice-controller/kubeslice-controller/e2e/cluster_test.go:105
  STEP: Patching Cluster with new NodeIP @ 10/29/25 20:40:19.357
  STEP: Validating new NodeIP appears in spec @ 10/29/25 20:40:19.364
• [0.011 seconds]
------------------------------
E2E: Cluster CRD lifecycle should delete Cluster CR cleanly
/mnt/c/Users/prashant/Downloads/kubeslice-controller/kubeslice-controller/e2e/cluster_test.go:120
  STEP: Deleting Cluster CR @ 10/29/25 20:40:19.368
  STEP: Verifying Cluster CR is deleted @ 10/29/25 20:40:19.377
  STEP: Cleaning up Cluster CR @ 10/29/25 20:40:19.379
• [0.016 seconds]
------------------------------
SliceConfig E2E tests should create a SliceConfig successfully
/mnt/c/Users/prashant/Downloads/kubeslice-controller/kubeslice-controller/e2e/sliceconfig_test.go:28
  STEP: creating a SliceConfig custom resource @ 10/29/25 20:40:19.384
  STEP: verifying the SliceConfig exists @ 10/29/25 20:40:19.392
• [0.013 seconds]
------------------------------
SliceConfig E2E tests should update SliceConfig successfully
/mnt/c/Users/prashant/Downloads/kubeslice-controller/kubeslice-controller/e2e/sliceconfig_test.go:69
  STEP: updating the MaxClusters field @ 10/29/25 20:40:19.398
  STEP: verifying the updated MaxClusters field @ 10/29/25 20:40:19.414
• [0.022 seconds]
------------------------------
SliceConfig E2E tests should delete SliceConfig successfully
/mnt/c/Users/prashant/Downloads/kubeslice-controller/kubeslice-controller/e2e/sliceconfig_test.go:95
  STEP: deleting the SliceConfig custom resource @ 10/29/25 20:40:19.419
  STEP: verifying the SliceConfig is deleted @ 10/29/25 20:40:19.437
• [0.527 seconds]
------------------------------
ServiceExportConfig Controller When creating a ServiceExportConfig Should reconcile and set labels correctly
/mnt/c/Users/prashant/Downloads/kubeslice-controller/kubeslice-controller/e2e/serviceexport_test.go:18
• [0.552 seconds]
------------------------------
Project E2E should create a Project successfully
/mnt/c/Users/prashant/Downloads/kubeslice-controller/kubeslice-controller/e2e/project_test.go:41
  STEP: creating a Project resource @ 10/29/25 20:40:20.498
  STEP: verifying the Project was created @ 10/29/25 20:40:20.515
  STEP: Cleaning up Project after each test @ 10/29/25 20:40:20.536
• [0.338 seconds]
------------------------------
Project E2E should update the Project with new service accounts
/mnt/c/Users/prashant/Downloads/kubeslice-controller/kubeslice-controller/e2e/project_test.go:68
  STEP: creating a Project resource @ 10/29/25 20:40:20.836
  STEP: updating the Project with ReadOnly user @ 10/29/25 20:40:20.843
  STEP: verifying the Project was updated @ 10/29/25 20:40:21.116
  STEP:  Cleaning up Project after each test @ 10/29/25 20:40:21.119
• [0.550 seconds]
------------------------------
Project E2E should delete a Project successfully
/mnt/c/Users/prashant/Downloads/kubeslice-controller/kubeslice-controller/e2e/project_test.go:101
  STEP: creating a Project resource @ 10/29/25 20:40:21.387
  STEP: deleting the Project @ 10/29/25 20:40:21.394
  STEP: verifying the Project is deleted @ 10/29/25 20:40:21.414
  STEP:  Cleaning up Project after each test @ 10/29/25 20:40:21.417
• [0.037 seconds]
------------------------------
[AfterSuite]
/mnt/c/Users/prashant/Downloads/kubeslice-controller/kubeslice-controller/e2e/suite_test.go:75
  STEP: Tearing down test environment (if needed) @ 10/29/25 20:40:21.424
[AfterSuite] PASSED [0.000 seconds]
------------------------------

Ran 18 of 18 Specs in 2.972 seconds
SUCCESS! -- 18 Passed | 0 Failed | 0 Pending | 0 Skipped
PASS

Ginkgo ran 1 suite in 29.350116603s
Test Suite Passed
 E2E tests completed successfully

Checklist:

  • [X] 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.
  • [X] I have performed a self-review of my own code.
  • [X] I have commented my code, particularly in hard-to-understand areas.
  • [X] I have tested it for all user roles.
  • [X] I have added all the required unit test cases.

andoriyaprashant avatar Sep 30 '25 13:09 andoriyaprashant

Hey @andoriyaprashant thanks for the PR, did you figure out a fix for the failing tests ?

gourishkb avatar Oct 07 '25 12:10 gourishkb