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

Unit tests for cloud/scope/common.go #168

Merged
merged 19 commits into from
Mar 8, 2024
Merged

Conversation

komer3
Copy link
Contributor

@komer3 komer3 commented Mar 6, 2024

What type of PR is this?

What this PR does / why we need it:
Created Unit tests for the cloud/scope/common.go file using gomock and mockgen to mock external dependencies.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

Special notes for your reviewer:

TODOs:

  • squashed commits
  • includes documentation
  • adds unit tests
  • adds or updates e2e tests

@AshleyDumaine AshleyDumaine added testing Pull requests that improve tests go Pull requests that update Go code labels Mar 6, 2024
@komer3 komer3 changed the title Unit tests for common.go Unit tests for cloud/scope/common.go Mar 6, 2024
@komer3 komer3 marked this pull request as ready for review March 6, 2024 19:07
cloud/scope/common_test.go Outdated Show resolved Hide resolved
cloud/scope/common_test.go Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
Makefile Show resolved Hide resolved
expectedError string
}{
{
name: "Check is the function works correctly",
Copy link
Contributor

Choose a reason for hiding this comment

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

The test description is a bit generic. Can you describe what's specific to this test case? i.e. "gets an apiToken from the Secret in a different namespace"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated!

Copy link
Contributor

@AshleyDumaine AshleyDumaine left a comment

Choose a reason for hiding this comment

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

@komer3 LGTM once rebased 👍

@komer3 komer3 merged commit 3ed9ac7 into main Mar 8, 2024
7 checks passed
@AshleyDumaine AshleyDumaine deleted the add-test-cloud-scope-common branch March 8, 2024 23:52
amold1 pushed a commit that referenced this pull request May 17, 2024
* Added test cases to get max test coverage for common.go

---------

Co-authored-by: Khaja Omer <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go Pull requests that update Go code testing Pull requests that improve tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants