Skip to content

adjust mocks generation #1922

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

Merged
merged 2 commits into from
Apr 9, 2021

Conversation

M00nF1sh
Copy link
Collaborator

@M00nF1sh M00nF1sh commented Apr 8, 2021

adjust mocks generation so that

  1. mocks for internal packages are generated within the same package as source file.
  2. mocks for 3rd party packages are generated within the global mocks folder.

We do this to avoid cycle imports.

  • the test file might to be same as source code in order to test un-exported functions.
  • the mocks need to import source code's package if the mocked interface includes data structures from source package
  • if test file(in source package) imports mocks package while mock package imports source package, there is a cycle imports.

@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Apr 8, 2021
@k8s-ci-robot k8s-ci-robot requested a review from kishorj April 8, 2021 23:13
@codecov-io
Copy link

Codecov Report

Merging #1922 (75110e9) into main (f82b48b) will decrease coverage by 0.34%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1922      +/-   ##
==========================================
- Coverage   49.29%   48.95%   -0.35%     
==========================================
  Files         115      122       +7     
  Lines        6428     6590     +162     
==========================================
+ Hits         3169     3226      +57     
- Misses       2982     3087     +105     
  Partials      277      277              
Impacted Files Coverage Δ
pkg/ingress/cert_discovery_mocks.go 27.27% <ø> (ø)
pkg/k8s/finalizer_mocks.go 0.00% <ø> (ø)
pkg/k8s/pod_info_repo_mocks.go 0.00% <0.00%> (ø)
pkg/networking/security_group_manager_mocks.go 0.00% <0.00%> (ø)
pkg/networking/subnet_resolver_mocks.go 0.00% <ø> (ø)
pkg/webhook/mutator_mocks.go 100.00% <ø> (ø)
pkg/webhook/validator_mocks.go 100.00% <ø> (ø)
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f82b48b...75110e9. Read the comment docs.

@M00nF1sh
Copy link
Collaborator Author

M00nF1sh commented Apr 8, 2021

/test pull-aws-load-balancer-controller-unit-test

@kishorj
Copy link
Collaborator

kishorj commented Apr 8, 2021

/lgtm

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kishorj, M00nF1sh

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 lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 8, 2021
@k8s-ci-robot k8s-ci-robot merged commit 7007710 into kubernetes-sigs:main Apr 9, 2021
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants