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

feat: Adding API defaults unit test + testfile fixture #6889

Merged
merged 8 commits into from
Apr 23, 2024

Conversation

jsnctl
Copy link
Contributor

@jsnctl jsnctl commented Apr 8, 2024

Pull Request Motivation

e.g.

defaultLeaderElectionNamespace = "kube-system"

updated to defaultLeaderElectionNamespace = "kube-system-abc" results in a test failure.

WIP as I wanted to sanity check this was the intention of the ticket & a reasonable pattern to follow before implementing for wider API space, but I'm also not very familiar with defaulter-autogen or the cert-manager project structure (w.r.t internal vs pkg)

Kind

feature/chore

Release Note

NONE

Signed-off-by: Jason Costello <jason@jsnc.tl>
@jetstack-bot jetstack-bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none Denotes a PR that doesn't merit a release note. labels Apr 8, 2024
@jetstack-bot
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 assign inteon for approval. 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

@jetstack-bot jetstack-bot added dco-signoff: no Indicates that at least one commit in this pull request is missing the DCO sign-off message. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Apr 8, 2024
@jetstack-bot
Copy link
Contributor

Hi @jsnctl. Thanks for your PR.

I'm waiting for a cert-manager member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@jetstack-bot jetstack-bot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 8, 2024
@jetstack-bot jetstack-bot added dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. and removed dco-signoff: no Indicates that at least one commit in this pull request is missing the DCO sign-off message. labels Apr 8, 2024
@inteon
Copy link
Member

inteon commented Apr 10, 2024

/ok-to-test

@jetstack-bot jetstack-bot added ok-to-test and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Apr 10, 2024
Signed-off-by: Jason Costello <jason@jsnc.tl>
Signed-off-by: Jason Costello <jason@jsnc.tl>
Signed-off-by: Jason Costello <jason@jsnc.tl>
@jetstack-bot
Copy link
Contributor

@jsnctl: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-cert-manager-master-make-test f447eb1 link true /test pull-cert-manager-master-make-test

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

Copy link

@Osamaabdalsabour Osamaabdalsabour left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/address/

Signed-off-by: Jason Costello <jason@jsnc.tl>
@jsnctl
Copy link
Contributor Author

jsnctl commented Apr 20, 2024

Recent merge from master appears to have resolved some of the CI failures from last week.

@inteon if you're happy with the pattern employed here after your review, I can go ahead and implement in other parts of the API where you think it'd be appropriate?

@inteon
Copy link
Member

inteon commented Apr 20, 2024

Pattern looks great, feel free to do the same thing for the other APIs!

Signed-off-by: Jason Costello <jason@jsnc.tl>
@cert-manager-prow cert-manager-prow bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 21, 2024
Signed-off-by: Jason Costello <jason@jsnc.tl>
@jsnctl
Copy link
Contributor Author

jsnctl commented Apr 23, 2024

@inteon This has now been applied to each of the APIs in internal/apis/config. Have a look across the wider codebase, I think these are the only defaults that're clearly testable in this format—are there any other cases we want to add here?

@inteon inteon self-assigned this Apr 23, 2024
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
@inteon inteon changed the title WIP: feat: Adding API defaults unit test + testfile fixture feat: Adding API defaults unit test + testfile fixture Apr 23, 2024
@cert-manager-prow cert-manager-prow bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 23, 2024
@inteon
Copy link
Member

inteon commented Apr 23, 2024

Thanks @jsnctl for fixing this issue, it should prevent us from unintentionally changing the default values in the future.
I added some code cleanup and formatted the json files so they are more readable.
This PR looks good to me. Please let me know if there is still something you would like to change.

This PR also shows that this area still needs a bit of work (eg. leaseDuration etc. should just be formatted as 1m instead of 60000000000). But those improvements are for another PR.

/lgtm
/approve
/hold In case you want to still change something.

@cert-manager-prow cert-manager-prow bot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm Indicates that a PR is ready to be merged. labels Apr 23, 2024
@cert-manager-prow
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: inteon

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

The pull request process is described 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 approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 23, 2024
@jsnctl
Copy link
Contributor Author

jsnctl commented Apr 23, 2024

Thanks @inteon, no further changes from me so if you're happy, merge away!

@inteon
Copy link
Member

inteon commented Apr 23, 2024

/unhold

@cert-manager-prow cert-manager-prow bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 23, 2024
@inteon inteon merged commit 8d2cb0c into cert-manager:master Apr 23, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. lgtm Indicates that a PR is ready to be merged. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. ok-to-test release-note-none Denotes a PR that doesn't merit a release note. 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.

None yet

4 participants