Skip to content

Add test for InstrumentedEnqueueRequestForObject#15

Merged
jmrodri merged 4 commits intooperator-framework:mainfrom
jmrodri:add-test
Jul 30, 2020
Merged

Add test for InstrumentedEnqueueRequestForObject#15
jmrodri merged 4 commits intooperator-framework:mainfrom
jmrodri:add-test

Conversation

@jmrodri
Copy link
Copy Markdown
Member

@jmrodri jmrodri commented Jul 26, 2020

Added a test for the InstrumentedEnqueueRequestForObject to increase the code coverage.

Before the test, handler was at 71.2%

$ make test                                                          
ok      github.com/operator-framework/operator-lib/handler      1.080s  coverage: 71.2% of statements   
...

After adding the test, coverage goes to 100%

$ make test                                                  
ok      github.com/operator-framework/operator-lib/handler      1.082s  coverage: 100.0% of statements
...

@coveralls
Copy link
Copy Markdown

coveralls commented Jul 26, 2020

Pull Request Test Coverage Report for Build 188099145

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+8.8%) to 80.052%

Totals Coverage Status
Change from base Build 187369912: 8.8%
Covered Lines: 309
Relevant Lines: 386

💛 - Coveralls

Copy link
Copy Markdown
Contributor

@camilamacedo86 camilamacedo86 left a comment

Choose a reason for hiding this comment

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

Just a few nits:

Comment thread handler/instrumented_enqueue_object_test.go Outdated
Comment thread handler/instrumented_enqueue_object_test.go Outdated
Comment thread handler/instrumented_enqueue_object_test.go
Comment thread handler/instrumented_enqueue_object_test.go Outdated
@jmrodri
Copy link
Copy Markdown
Member Author

jmrodri commented Jul 28, 2020

Just a few nits:

* Could we add the suffix `_test` which has [special meaning for the Go compiler](https://github.com/golang/go/issues/25223)? So, it would be `package handler_test` instead of `package handler`
  `

No, I wanted it in the same package as the code so I could also test the unexported methods. If we put it in package handler_test then we can only test the exported method which is great but sometimes it's easier to test the error conditions of the unexported methods directly.

Copy link
Copy Markdown
Contributor

@camilamacedo86 camilamacedo86 left a comment

Choose a reason for hiding this comment

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

/lgtm 👍

Copy link
Copy Markdown
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.

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 30, 2020
@jmrodri jmrodri merged commit d5362cf into operator-framework:main Jul 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants