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

Add e2e test to validate webhook conversion from one version to another #4255

Open
camilamacedo86 opened this issue Oct 30, 2024 · 7 comments
Assignees
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature. testing
Milestone

Comments

@camilamacedo86
Copy link
Member

camilamacedo86 commented Oct 30, 2024

What do you want to happen?

Description:

To enhance the MultiVersion tutorial, which demonstrates version conversion in webhooks, we created a sample project under: https://github.com/kubernetes-sigs/kubebuilder/tree/master/docs/book/src/multiversion-tutorial/testdata/project

This sample is auto-generated and updated when running make generate-docs as defined here:
https://github.com/kubernetes-sigs/kubebuilder/blob/master/Makefile#L82-L84

Code generation and insertion for documentation (including comments) are handled within:
https://github.com/kubernetes-sigs/kubebuilder/tree/master/hack/docs/internal/multiversion-tutorial

Additionally, we have a GitHub Action that runs e2e tests scaffolded by default for this sample project:

e2e-multiversion-tutorial:
runs-on: ubuntu-latest
strategy:
fail-fast: true
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '~1.22'
- name: Install the latest version of kind
run: |
curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind
- name: Verify kind installation
run: kind version
- name: Create kind cluster
run: kind create cluster
- name: Running make test-e2e for Multiversion tutorial sample
working-directory: docs/book/src/multiversion-tutorial/testdata/project
run: make test-e2e

Goal

The objective of this issue is to supplement the tests in the e2e_test.go file by implementing an e2e test that:

  1. Applies a CronJob resource in v1 and verifies that it converts correctly to v2.
  2. Runs as part of our CI to validate the accuracy of our scaffolded code examples and ensure the functionality is as expected.
  3. Provides additional e2e testing examples, aiding users in creating and validating similar solutions.

By adding this test, we ensure that our examples and scaffolding are validated, providing greater confidence to our users.

Extra Labels

/kind documentation

@camilamacedo86 camilamacedo86 added the kind/feature Categorizes issue or PR as related to a new feature. label Oct 30, 2024
@k8s-ci-robot k8s-ci-robot added the kind/documentation Categorizes issue or PR as related to documentation. label Oct 30, 2024
@camilamacedo86 camilamacedo86 added good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. testing and removed kind/documentation Categorizes issue or PR as related to documentation. labels Oct 30, 2024
@TAM360
Copy link
Contributor

TAM360 commented Oct 31, 2024

/assign

@camilamacedo86
Copy link
Member Author

Hi @TAM360

I was looking this one it is a little hard to do.
So, I will remove "good first issue" but if you still want to look on that please feel free.

@camilamacedo86 camilamacedo86 added help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. and removed good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. labels Nov 1, 2024
@TAM360
Copy link
Contributor

TAM360 commented Nov 1, 2024

@camilamacedo86 I am gonna try working on it.

@priyansh3006
Copy link

/assign

@mateusoliveira43
Copy link
Contributor

/assign

@mateusoliveira43
Copy link
Contributor

@camilamacedo86 with #4449 we can use envtest to test conversion webhooks

Is it preferred to be an E2E test?

@camilamacedo86
Copy link
Member Author

Hi @mateusoliveira43

IHMO, we should have both in the samples to show how to validate them.
So, let's keep this one for the e2e tests, but please feel free to add tests with envtests as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature. testing
Projects
None yet
Development

No branches or pull requests

5 participants