Skip to content

Improve runner unit tests#1398

Merged
dgageot merged 5 commits intoGoogleContainerTools:masterfrom
dgageot:improve-runner-unit-tests
Dec 20, 2018
Merged

Improve runner unit tests#1398
dgageot merged 5 commits intoGoogleContainerTools:masterfrom
dgageot:improve-runner-unit-tests

Conversation

@dgageot
Copy link
Copy Markdown
Contributor

@dgageot dgageot commented Dec 18, 2018

Test were broken and wouldn't test what we thought they'd test.

@codecov-io
Copy link
Copy Markdown

codecov-io commented Dec 18, 2018

Codecov Report

Merging #1398 into master will decrease coverage by 0.04%.
The diff coverage is 53.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1398      +/-   ##
==========================================
- Coverage   44.69%   44.65%   -0.05%     
==========================================
  Files         109      111       +2     
  Lines        4546     4546              
==========================================
- Hits         2032     2030       -2     
- Misses       2308     2311       +3     
+ Partials      206      205       -1
Impacted Files Coverage Δ
pkg/skaffold/kubernetes/log.go 6.83% <0%> (-0.06%) ⬇️
pkg/skaffold/runner/runner.go 61.48% <100%> (+6.22%) ⬆️
pkg/skaffold/runner/filters.go 100% <100%> (ø)
pkg/skaffold/runner/dev.go 44.44% <44.44%> (ø)
pkg/skaffold/runner/timings.go 15% <0%> (-15%) ⬇️

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 cf56c15...996c07f. Read the comment docs.

@dgageot dgageot force-pushed the improve-runner-unit-tests branch 3 times, most recently from 511c857 to 767786c Compare December 19, 2018 14:41
@dgageot
Copy link
Copy Markdown
Contributor Author

dgageot commented Dec 19, 2018

ping @balopat This is the first iteration on fixing/adding tests on the Runner.

I have more to come to test the sync. There's a lot of issues with this piece of code

// Stop stops the logger.
func (a *LogAggregator) Stop() {
a.cancel()
if a.cancel != nil {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

now that we're touching this: a.cancel can be nil when it's not yet started, right?
Also, what happens when we call Stop() twice? I.e. the cancelFunc called twice?
What if instead of nil the "default" value of the cancel is a "noop" func, i.e cancel: func() {} in NewLogAggregator - and then still, Stopwill have to remember to set it back to func() {} - this way we don't have to check for nil.
Alternatively we can keep it as it is and have a.cancel=nil represent the Stopped state - but then we have to set a.cancel = nil here. WDYT?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Let me handle that in another PR. Current state is that cancel can be called multiple time, which is a noop passed the first time.

var ErrorConfigurationChanged = errors.New("configuration changed")

// Dev watches for changes and runs the skaffold build and deploy
// pipeline until interrrupted by the user.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
// pipeline until interrrupted by the user.
// pipeline until interrupted by the user.

Copy link
Copy Markdown
Contributor

@balopat balopat left a comment

Choose a reason for hiding this comment

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

LGTM with a small comment on logaggregator.cancel!
Thank you for breaking it up, it looks better already!

Signed-off-by: David Gageot <david@gageot.net>
Signed-off-by: David Gageot <david@gageot.net>
Signed-off-by: David Gageot <david@gageot.net>
Signed-off-by: David Gageot <david@gageot.net>
Signed-off-by: David Gageot <david@gageot.net>
@dgageot dgageot force-pushed the improve-runner-unit-tests branch from 767786c to 996c07f Compare December 20, 2018 07:39
@dgageot dgageot merged commit 4da3012 into GoogleContainerTools:master Dec 20, 2018
@dgageot dgageot deleted the improve-runner-unit-tests branch December 28, 2018 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants