Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce chainsaw as e2e testing framework #1758

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

abaguas
Copy link
Collaborator

@abaguas abaguas commented Oct 21, 2024

As stated in #1660, the terratest setup is quite complex. When developing new features it is often necessary to tweak the e2e testing setup, and at the moment it is quite time consuming to get it right. In addition, e2e tests are slow, they take about 25 minutes to run.

In this PR I experiment with Chainsaw Kyverno, the most popular testing framework for operators. I implemented the failover playground test as a proof of concept and I believe we can move forward with more tests. Let me know your thoughts.

Analysis

Advantages:

  • declarative testing allows developers to focus only on the expected outcomes, not the testing logic
  • open-source framework frees up capacity since we no longer have to maintain a testing framework
  • stepTemplate CRD allows reuse of steps across multiple tests
  • tests run in parallel. We have a new opportunity to get parallelism right and reduce testing time
  • contains all the features we need to run a test

Disadvantages:

  • no loops. Running the same test for different ingress types will involve test duplication, but at least steps can be reused. Hopefully this feature will come soon.

Test logic

The test's logic is as follows:

  • Create the podinfo application
  • Wait until initialization is complete: the DNSEndpoint is populated on both clusters
  • Fetch the expected DNS targets from the DNSEndpoint resource and compare it with the dig's results
  • Delete podinfo
  • Fetch the expected DNS targets from the DNSEndpoint resource and compare it with the dig's results
  • Recreate podinfo
  • Fetch the expected DNS targets from the DNSEndpoint resource and compare it with the dig's results

@abaguas abaguas marked this pull request as draft October 21, 2024 22:12
@abaguas abaguas force-pushed the chainsaw/kyverno branch 2 times, most recently from 57f4d8e to 7431e3e Compare October 21, 2024 22:29
@abaguas abaguas marked this pull request as ready for review October 21, 2024 22:57
@abaguas abaguas force-pushed the chainsaw/kyverno branch 2 times, most recently from 21f437d to 0e14672 Compare October 26, 2024 19:56
Signed-off-by: Andre Baptista Aguas <[email protected]>
@abaguas abaguas changed the title chainsaw PoC Introduce chainsaw as e2e testing framework Nov 1, 2024
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.

1 participant