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] Unit tests for Extension reconciler #690

Conversation

varshaprasad96
Copy link
Member

Description

This PR:

  • Removes the additional HasKappAPI test, since the feature is anyway protected using featureGate. This also helps in running tests easily.
  • Adds unit tests for Extension controller.

Reviewer Checklist

  • API Go Documentation
  • Tests: Unit Tests (and E2E Tests, if appropriate)
  • Comprehensive Commit Messages
  • Links to related GitHub Issue(s)

Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com>
@varshaprasad96 varshaprasad96 requested a review from a team as a code owner March 11, 2024 22:46
Copy link

codecov bot commented Mar 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.76%. Comparing base (6865e1d) to head (733dc4e).
Report is 22 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main     #690       +/-   ##
===========================================
+ Coverage   64.01%   75.76%   +11.74%     
===========================================
  Files          22       22               
  Lines        1370     1345       -25     
===========================================
+ Hits          877     1019      +142     
+ Misses        442      265      -177     
- Partials       51       61       +10     
Flag Coverage Δ
e2e 47.65% <ø> (+0.28%) ⬆️
unit 70.47% <ø> (+12.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@joelanford joelanford left a comment

Choose a reason for hiding this comment

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

It seems like there may be an opportunity to collapse some of the test code because it looks like a decent chunk is repetitive between different tests.

You might consider a table-driven set of tests, where a test case could contain arbitrary setup and assertion functions that could be implemented per test case.

@@ -92,6 +86,931 @@ func TestExtensionReconcile(t *testing.T) {
}
}

func TestExtensionNonExistentPackage(t *testing.T) {
defer featuregatetesting.SetFeatureGateDuringTest(t, features.OperatorControllerFeatureGate, features.EnableExtensionAPI, true)()
Copy link
Contributor

Choose a reason for hiding this comment

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

These new tests looked like they had similar enough structure to potentially be done in this kind of format. Seems to me like that might be more maintainable?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oops, just realized this is a duplicate comment of Joe's here.

@openshift-merge-robot
Copy link

PR needs rebase.

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.

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 29, 2024
@perdasilva
Copy link
Contributor

closing due to inactivity - please re-open if we still need this =D

@perdasilva perdasilva closed this May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants