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

Check-in testdata such that test can be run in IDE/ using go without using Makefile #482

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

Conversation

inteon
Copy link
Member

@inteon inteon commented Nov 21, 2024

Alternative solution for cert-manager/makefile-modules#209.
Makes it possible to run Go tests without Makefile (eg. when running using IDE).

Checks-in the testdata instead of generating on demand as part of the Makefile target.

cc @erikgb

@cert-manager-prow cert-manager-prow bot added the dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. label Nov 21, 2024
@cert-manager-prow
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from inteon. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@cert-manager-prow cert-manager-prow bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 21, 2024
@erikgb
Copy link
Contributor

erikgb commented Nov 21, 2024

The proposed changes will solve my immediate issues, but I am bit worried about the make target dependencies. If I modify the API in Go source code or modify the "testdata" CRD and then run make generate-crds, the "testdata" CRD is not updated. This could be not very clear for users. Do you see a way to fix this with your proposed solution?

We should at least ensure that the "testdata" CRD is up-to-date in CI, but that is maybe OK? Not sure how the verfy-generated mechanism actually works.

@inteon
Copy link
Member Author

inteon commented Nov 25, 2024

The proposed changes will solve my immediate issues, but I am bit worried about the make target dependencies. If I modify the API in Go source code or modify the "testdata" CRD and then run make generate-crds, the "testdata" CRD is not updated. This could be not very clear for users. Do you see a way to fix this with your proposed solution?

We should at least ensure that the "testdata" CRD is up-to-date in CI, but that is maybe OK? Not sure how the verfy-generated mechanism actually works.

When I update eg. types_bundle.go and run make generate, I get the following result:

$ git status
On branch simplify_go_test
Your branch is up to date with 'inteon/simplify_go_test'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   deploy/charts/trust-manager/templates/crd-trust.cert-manager.io_bundles.yaml
        modified:   pkg/apis/trust/v1alpha1/types_bundle.go
        modified:   test/testdata/trust.cert-manager.io_bundles.yaml

no changes added to commit (use "git add" and/or "git commit -a")

Both the deploy/charts/trust-manager/templates/crd-trust.cert-manager.io_bundles.yaml and test/testdata/trust.cert-manager.io_bundles.yaml file got updated + CI should check that they are kept up-to-date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants