-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add some tests for Sync #1406
Conversation
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
Signed-off-by: David Gageot <[email protected]>
Signed-off-by: David Gageot <[email protected]>
There was a problem hiding this 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?
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? |
I see, true, calling it a |
Not even a facade - it's a "union mock" of all collaborators :) |
No description provided.