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 some tests for Sync #1406

Merged
merged 2 commits into from
Dec 21, 2018
Merged

Conversation

dgageot
Copy link
Contributor

@dgageot dgageot commented Dec 20, 2018

No description provided.

@codecov-io
Copy link

Codecov Report

Merging #1406 into master will increase coverage by 0.17%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1406      +/-   ##
==========================================
+ Coverage   44.65%   44.83%   +0.17%     
==========================================
  Files         111      111              
  Lines        4546     4546              
==========================================
+ Hits         2030     2038       +8     
+ Misses       2311     2304       -7     
+ Partials      205      204       -1
Impacted Files Coverage Δ
pkg/skaffold/runner/dev.go 52.77% <0%> (+8.33%) ⬆️
pkg/skaffold/runner/changes.go 100% <0%> (+16.66%) ⬆️

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 4da3012...eac9151. Read the comment docs.

@codecov-io
Copy link

codecov-io commented Dec 20, 2018

Codecov Report

Merging #1406 into master will increase coverage by 0.17%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1406      +/-   ##
==========================================
+ Coverage   44.65%   44.83%   +0.17%     
==========================================
  Files         111      111              
  Lines        4546     4546              
==========================================
+ Hits         2030     2038       +8     
+ Misses       2311     2304       -7     
+ Partials      205      204       -1
Impacted Files Coverage Δ
pkg/skaffold/runner/dev.go 52.77% <0%> (+8.33%) ⬆️
pkg/skaffold/runner/changes.go 100% <0%> (+16.66%) ⬆️

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 45e6a30...64289f8. Read the comment docs.

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

I might be missing something and this might be totally idiomatic go - but as a first look, I'm not a big fan of the TestBench concept - because it introduces a new abstraction that is not really necessary and is confusing and will have to implement everything that a Runner would need vs. the separate TestBuilder, TestTester, etc. It seems that TestBench is only used to create a Runner anyways. How about a RunnerBuilder using the builder pattern with fluid syntax, which would in the end give you a MockRunner - e.g. for testcases you could pass in

runner: runnerBuilder().WithBuildErrors([]error{errors.New("")}).Build(),

to capture actions, you could pass the MockRunner instance to TestBuilder, TestTester, etc. and they can record the calls there - or alternatively they can record it themselves and MockRunner could collect it from them on the Actions() call. What do you think?

@dgageot
Copy link
Contributor Author

dgageot commented Dec 21, 2018

The idea here is I think the opposite of what you’re saying. The TestBench does not produce a MockRunner, it creates an actual runner with mocked dependencies. To test the code of the Runner, we test need a TestBuilder, a TestTester, a TestSyncer and a TestDeployer. The TestBench implements all those deps, with a shared state that facilitates the assertions. It’s teally a bench on which you plug a runner and collect information. Is it clearer?

@balopat
Copy link
Contributor

balopat commented Dec 21, 2018

I see, true, calling it a MockRunner would miss the point. Let's go with it, I just haven't seen this before - maybe some comments can help clarifying the responsibility of TestBench that it's a facade for all of the mocked collaborators of Runner.

@balopat
Copy link
Contributor

balopat commented Dec 21, 2018

Not even a facade - it's a "union mock" of all collaborators :)

@balopat balopat merged commit c4105f1 into GoogleContainerTools:master Dec 21, 2018
@dgageot dgageot deleted the sync-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