internal/mcp: NewClient takes Transport
Pass the client Transport to NewClient instead of Connect. Combine the ConnectionOptions with the ClientOptions. Change-Id: I3acd6cf6d5bf46666742f2a73e2acaef2057ea77 Reviewed-on: https://go-review.googlesource.com/c/tools/+/670215 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
parent
bc84c08031
commit
f8098af1c5
1 changed files with 35 additions and 28 deletions
|
|
@ -81,10 +81,10 @@ func TestEndToEnd(t *testing.T) {
|
|||
clientWG.Done()
|
||||
}()
|
||||
|
||||
c := NewClient("testClient", "v1.0.0", nil)
|
||||
c := NewClient("testClient", "v1.0.0", ct, nil)
|
||||
|
||||
// Connect the client.
|
||||
if err := c.Connect(ctx, ct, nil); err != nil {
|
||||
if err := c.Start(ctx); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
|
|
@ -210,8 +210,8 @@ func basicConnection(t *testing.T, tools ...*Tool) (*ClientConnection, *Client)
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
c := NewClient("testClient", "v1.0.0", nil)
|
||||
if err := c.Connect(ctx, ct, nil); err != nil {
|
||||
c := NewClient("testClient", "v1.0.0", ct, nil)
|
||||
if err := c.Start(ctx); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
return cc, c
|
||||
|
|
@ -250,13 +250,12 @@ func TestBatching(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
c := NewClient("testClient", "v1.0.0", nil)
|
||||
opts := new(ConnectionOptions)
|
||||
c := NewClient("testClient", "v1.0.0", ct, nil)
|
||||
// TODO: this test is broken, because increasing the batch size here causes
|
||||
// 'initialize' to block. Therefore, we can only test with a size of 1.
|
||||
const batchSize = 1
|
||||
BatchSize(ct, batchSize)
|
||||
if err := c.Connect(ctx, ct, opts); err != nil {
|
||||
if err := c.Start(ctx); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer c.Close()
|
||||
|
|
|
|||
Loading…
Reference in a new issue