Unit test for scatter_conn using new HealthCheck#6458
Merged
harshit-gangal merged 1 commit intovitessio:masterfrom Jul 22, 2020
Merged
Unit test for scatter_conn using new HealthCheck#6458harshit-gangal merged 1 commit intovitessio:masterfrom
harshit-gangal merged 1 commit intovitessio:masterfrom
Conversation
…nit testing of ScatterConn Signed-off-by: deepthi <deepthi@planetscale.com>
Comment on lines
-108
to
-124
| func TestScatterConnExecuteMulti(t *testing.T) { | ||
| testScatterConnGeneric(t, "TestScatterConnExecuteMultiShard", func(sc *ScatterConn, shards []string) (*sqltypes.Result, error) { | ||
| res := srvtopo.NewResolver(&sandboxTopo{}, sc.gateway, "aa") | ||
| rss, err := res.ResolveDestination(ctx, "TestScatterConnExecuteMultiShard", topodatapb.TabletType_REPLICA, key.DestinationShards(shards)) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
|
|
||
| queries := make([]*querypb.BoundQuery, len(rss)) | ||
| for i := range rss { | ||
| queries[i] = &querypb.BoundQuery{ | ||
| Sql: "query", | ||
| BindVariables: nil, | ||
| } | ||
| } | ||
|
|
||
| qr, errs := sc.ExecuteMultiShard(ctx, rss, queries, NewSafeSession(nil), false /*autocommit*/) |
Member
There was a problem hiding this comment.
I think you removed others test. Needs to bring them back
Comment on lines
+736
to
+744
| func newTestScatterConn(hc discovery.HealthCheck, serv srvtopo.Server, cell string) *ScatterConn { | ||
| // The topo.Server is used to start watching the cells described | ||
| // in '-cells_to_watch' command line parameter, which is | ||
| // empty by default. So it's unused in this test, set to nil. | ||
| gw := NewTabletGateway(ctx, hc, serv, cell) | ||
| tc := NewTxConn(gw, vtgatepb.TransactionMode_TWOPC) | ||
| return NewScatterConn("", tc, gw) | ||
| } | ||
|
|
Member
There was a problem hiding this comment.
you moved it to separate file. Then this does not belong here.
Collaborator
Author
There was a problem hiding this comment.
good point. we can fix it by moving it to the other test file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactored interfaces and function signatures to allow unit testing.
Created enough of FakeHealthCheck for testing ScatterConn.
Signed-off-by: deepthi deepthi@planetscale.com