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

Enhance Test for kubebuilder alpha generate Command #4508

Open
camilamacedo86 opened this issue Jan 19, 2025 · 4 comments
Open

Enhance Test for kubebuilder alpha generate Command #4508

camilamacedo86 opened this issue Jan 19, 2025 · 4 comments
Assignees
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. 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

Comments

@camilamacedo86
Copy link
Member

What do you want to happen?

We need to enhance the testing of the kubebuilder alpha generate command. For further information see: https://book.kubebuilder.io/reference/rescaffold

Note that under the testdata we scaffold samples:

The goal here is to validate its functionality for all samples under testdata. A shell script solution is acceptable for this purpose, but if a better approach using Go tests (leveraging the existing test framework) can be implemented to validate the PROJECT file content, it would be preferable. Currently, the command is tested under: e2e/alphagenerate. This enhancement aims to:

Therfore what we need to do is:

  • A CI test that will execute kubebuilder alpha generate inside of each sample under the testdata dir
  • The command should be finished without errors
  • (Optionally and if we find an easy way to do it maintainable ): Verify that the PROJECT file has the same webhooks and APIs as the original.

Extra Labels

No response

@camilamacedo86 camilamacedo86 added kind/feature Categorizes issue or PR as related to a new feature. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. testing labels Jan 19, 2025
@manalilatkar
Copy link

/assign

@camilamacedo86
Copy link
Member Author

In this case, what we probably want is:

  1. Shell Script:
    • Create a shell script and place it under:
      test.
    • The script will contain logic to call the relevant command for all directories under the testdata directory.

Example

# Example shell script logic
for dir in testdata/*; do
    # Call alpha-generate to validate the re-generation of all samples
    $kb alpha generate    
done
  1. Makefile Target:
    • Add a new target to the Makefile, similar to these examples.
    • This target will be named something like test-alpha-generate.

Example

test-alpha-generate:
    ./test/alpha-generate.sh
  1. CI Integration:
  • Update the CI/GitHub workflows located at:
    .github/workflows.
  • Create a new GitHub Action, e.g., test-alpha-generate.
  • Configure the action to run only when changes occur in the following paths:
    • pkg/cli/alpha
    • The new shell script file
    • The workflow or GitHub Action itself

Example

name: Test Alpha Generate

on:
  push:
    paths:
      - 'pkg/cli/alpha/**'
      - 'test/alpha-generate.sh'
      - '.github/workflows/alpha-generate.yml'
  pull_request:
    paths:
      - 'pkg/cli/alpha/**'
      - 'test/**'
      - '.github/workflows/**'

jobs:
  test-alpha-generate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
      - name: Run test-alpha-generate
        run: make test-alpha-generate
 ```

@sbin64
Copy link

sbin64 commented Jan 24, 2025

sorry @camilamacedo86 if there is a no show, can I take this up now?

@manalilatkar
Copy link

sorry @camilamacedo86 if there is a no show, can I take this up now?

@sbin64 I am working on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. 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

3 participants