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

pkg/announce: make interface functions public and add tests #3596

Merged
merged 1 commit into from
May 2, 2024

Conversation

embik
Copy link
Member

@embik embik commented May 1, 2024

What type of PR is this?

After refactoring pkg/announce in #3580, this is the first wave of tests to validate that the new packages work properly. I didn't want to have all tests in one PR (as that will result in a very large diff to review), and I was hoping to get some feedback on my approach before committing to work on additional tests.

In this PR:

  • the functions on the implementation interface for k8s.io/release/pkg/announce.Announce are made public, because otherwise they can't be used for mock tests. I'm not sure why I chose them to be private in the first place.
  • some light validation is added to the CreateForRelease method to ensure that empty data (empty changelog HTML or Go version) is caught.
  • Reading the changelog file has been moved to the implementation interface, to eliminate the remaining direct filesystem call.
  • Tests have been added that make sure creating an announcement fails for various failure scenarios.

Overall, CreateForBranch and CreateForRelease are very simple methods, but this adds test coverage nonetheless. If this is looking good, I will move on to the sub-packages in pkg/announce in future PRs.

/kind cleanup

What this PR does / why we need it:

Which issue(s) this PR fixes:

Special notes for your reviewer:

Does this PR introduce a user-facing change?

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-priority labels May 1, 2024
@k8s-ci-robot k8s-ci-robot requested review from jrsapi and salaxander May 1, 2024 08:30
@k8s-ci-robot k8s-ci-robot added area/release-eng Issues or PRs related to the Release Engineering subproject sig/release Categorizes an issue or PR as relevant to SIG Release. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 1, 2024
@embik embik force-pushed the announce-tests branch from b04b97d to 486dddf Compare May 1, 2024 10:27
Copy link
Member

@saschagrunert saschagrunert left a comment

Choose a reason for hiding this comment

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

Awesome work, thank you!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 2, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: embik, saschagrunert

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 2, 2024
@k8s-ci-robot k8s-ci-robot merged commit df5ab32 into kubernetes:master May 2, 2024
11 checks passed
@embik embik deleted the announce-tests branch May 2, 2024 07:42
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. area/release-eng Issues or PRs related to the Release Engineering subproject cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority release-note-none Denotes a PR that doesn't merit a release note. sig/release Categorizes an issue or PR as relevant to SIG Release. 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.

3 participants