Implement e2e tests

The introduction of testenv has proven to be very powerful to develop and test new features in sylva-units-operator and workload-cluster-operator.

However, some features like the use of valuesFrom flux sources proposed in !294 (merged) require a source controller to interact with to be properly tested.

This is usually referred as e2e test in kubebuilder/controllers ecosystem. As explained in kubebuilder docs, these tests need a cluster to host 3rd party controllers (usually using kind) in which these operators are installed.

As we can see in code samples, the controllers are usually installed using wrapped kubectl command as we can see here or there.

But we also need to bootstrap these components in the context of sylva, as we're already doing in sylva-core/bootstrap.sh, it would be relevant to use the same code for these two uses-case: it would limit code duplication, and ensure that we're using the same configurations for testing and deployments.

It would be hard to leverage current sylva-core bootstrap code, as this code is not yet modular, and it supposes to clone sylva-core + sylva-toolbox, which would take too much time to setup test environment.

This leads to the conclusion that this work should be done in sylvactl where we would add a bootstrap subcommand that would:

  • Create a kind cluster
  • Install flux in it
  • Then, using flux kustomizations or plain manifests:
    • Install external operator
    • Install sylva unit operator (optionally as it won't be needed when controller will be started in envtest)

This way we would only have to download syvactl and execute that bootstrap command to setup the e2e test environment.

This is tracked in sylvactl#79

Edited Apr 25, 2025 by Francois Eleouet
Assignee Loading
Time tracking Loading