vendor: Update vendoring for the exec client and server implementations
Signed-off-by: Jacek J. Łakis <jacek.lakis@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
parent
d25b88583f
commit
bf51655a7b
2124 changed files with 809703 additions and 5 deletions
226
vendor/cloud.google.com/go/debugger/apiv2/controller2_client.go
generated
vendored
Normal file
226
vendor/cloud.google.com/go/debugger/apiv2/controller2_client.go
generated
vendored
Normal file
|
@ -0,0 +1,226 @@
|
|||
// Copyright 2017, Google Inc. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// AUTO-GENERATED CODE. DO NOT EDIT.
|
||||
|
||||
package debugger
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"cloud.google.com/go/internal/version"
|
||||
gax "github.com/googleapis/gax-go"
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/api/option"
|
||||
"google.golang.org/api/transport"
|
||||
clouddebuggerpb "google.golang.org/genproto/googleapis/devtools/clouddebugger/v2"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
)
|
||||
|
||||
// Controller2CallOptions contains the retry settings for each method of Controller2Client.
|
||||
type Controller2CallOptions struct {
|
||||
RegisterDebuggee []gax.CallOption
|
||||
ListActiveBreakpoints []gax.CallOption
|
||||
UpdateActiveBreakpoint []gax.CallOption
|
||||
}
|
||||
|
||||
func defaultController2ClientOptions() []option.ClientOption {
|
||||
return []option.ClientOption{
|
||||
option.WithEndpoint("clouddebugger.googleapis.com:443"),
|
||||
option.WithScopes(
|
||||
"https://www.googleapis.com/auth/cloud-platform",
|
||||
"https://www.googleapis.com/auth/cloud_debugger",
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
func defaultController2CallOptions() *Controller2CallOptions {
|
||||
retry := map[[2]string][]gax.CallOption{
|
||||
{"default", "idempotent"}: {
|
||||
gax.WithRetry(func() gax.Retryer {
|
||||
return gax.OnCodes([]codes.Code{
|
||||
codes.DeadlineExceeded,
|
||||
codes.Unavailable,
|
||||
}, gax.Backoff{
|
||||
Initial: 100 * time.Millisecond,
|
||||
Max: 60000 * time.Millisecond,
|
||||
Multiplier: 1.3,
|
||||
})
|
||||
}),
|
||||
},
|
||||
{"default", "non_idempotent"}: {
|
||||
gax.WithRetry(func() gax.Retryer {
|
||||
return gax.OnCodes([]codes.Code{
|
||||
codes.Unavailable,
|
||||
}, gax.Backoff{
|
||||
Initial: 100 * time.Millisecond,
|
||||
Max: 60000 * time.Millisecond,
|
||||
Multiplier: 1.3,
|
||||
})
|
||||
}),
|
||||
},
|
||||
}
|
||||
return &Controller2CallOptions{
|
||||
RegisterDebuggee: retry[[2]string{"default", "non_idempotent"}],
|
||||
ListActiveBreakpoints: retry[[2]string{"default", "idempotent"}],
|
||||
UpdateActiveBreakpoint: retry[[2]string{"default", "idempotent"}],
|
||||
}
|
||||
}
|
||||
|
||||
// Controller2Client is a client for interacting with Stackdriver Debugger API.
|
||||
type Controller2Client struct {
|
||||
// The connection to the service.
|
||||
conn *grpc.ClientConn
|
||||
|
||||
// The gRPC API client.
|
||||
controller2Client clouddebuggerpb.Controller2Client
|
||||
|
||||
// The call options for this service.
|
||||
CallOptions *Controller2CallOptions
|
||||
|
||||
// The metadata to be sent with each request.
|
||||
xGoogHeader string
|
||||
}
|
||||
|
||||
// NewController2Client creates a new controller2 client.
|
||||
//
|
||||
// The Controller service provides the API for orchestrating a collection of
|
||||
// debugger agents to perform debugging tasks. These agents are each attached
|
||||
// to a process of an application which may include one or more replicas.
|
||||
//
|
||||
// The debugger agents register with the Controller to identify the application
|
||||
// being debugged, the Debuggee. All agents that register with the same data,
|
||||
// represent the same Debuggee, and are assigned the same `debuggee_id`.
|
||||
//
|
||||
// The debugger agents call the Controller to retrieve the list of active
|
||||
// Breakpoints. Agents with the same `debuggee_id` get the same breakpoints
|
||||
// list. An agent that can fulfill the breakpoint request updates the
|
||||
// Controller with the breakpoint result. The controller selects the first
|
||||
// result received and discards the rest of the results.
|
||||
// Agents that poll again for active breakpoints will no longer have
|
||||
// the completed breakpoint in the list and should remove that breakpoint from
|
||||
// their attached process.
|
||||
//
|
||||
// The Controller service does not provide a way to retrieve the results of
|
||||
// a completed breakpoint. This functionality is available using the Debugger
|
||||
// service.
|
||||
func NewController2Client(ctx context.Context, opts ...option.ClientOption) (*Controller2Client, error) {
|
||||
conn, err := transport.DialGRPC(ctx, append(defaultController2ClientOptions(), opts...)...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
c := &Controller2Client{
|
||||
conn: conn,
|
||||
CallOptions: defaultController2CallOptions(),
|
||||
|
||||
controller2Client: clouddebuggerpb.NewController2Client(conn),
|
||||
}
|
||||
c.SetGoogleClientInfo()
|
||||
return c, nil
|
||||
}
|
||||
|
||||
// Connection returns the client's connection to the API service.
|
||||
func (c *Controller2Client) Connection() *grpc.ClientConn {
|
||||
return c.conn
|
||||
}
|
||||
|
||||
// Close closes the connection to the API service. The user should invoke this when
|
||||
// the client is no longer required.
|
||||
func (c *Controller2Client) Close() error {
|
||||
return c.conn.Close()
|
||||
}
|
||||
|
||||
// SetGoogleClientInfo sets the name and version of the application in
|
||||
// the `x-goog-api-client` header passed on each request. Intended for
|
||||
// use by Google-written clients.
|
||||
func (c *Controller2Client) SetGoogleClientInfo(keyval ...string) {
|
||||
kv := append([]string{"gl-go", version.Go()}, keyval...)
|
||||
kv = append(kv, "gapic", version.Repo, "gax", gax.Version, "grpc", "")
|
||||
c.xGoogHeader = gax.XGoogHeader(kv...)
|
||||
}
|
||||
|
||||
// RegisterDebuggee registers the debuggee with the controller service.
|
||||
//
|
||||
// All agents attached to the same application should call this method with
|
||||
// the same request content to get back the same stable `debuggee_id`. Agents
|
||||
// should call this method again whenever `google.rpc.Code.NOT_FOUND` is
|
||||
// returned from any controller method.
|
||||
//
|
||||
// This allows the controller service to disable the agent or recover from any
|
||||
// data loss. If the debuggee is disabled by the server, the response will
|
||||
// have `is_disabled` set to `true`.
|
||||
func (c *Controller2Client) RegisterDebuggee(ctx context.Context, req *clouddebuggerpb.RegisterDebuggeeRequest) (*clouddebuggerpb.RegisterDebuggeeResponse, error) {
|
||||
ctx = insertXGoog(ctx, c.xGoogHeader)
|
||||
var resp *clouddebuggerpb.RegisterDebuggeeResponse
|
||||
err := gax.Invoke(ctx, func(ctx context.Context) error {
|
||||
var err error
|
||||
resp, err = c.controller2Client.RegisterDebuggee(ctx, req)
|
||||
return err
|
||||
}, c.CallOptions.RegisterDebuggee...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// ListActiveBreakpoints returns the list of all active breakpoints for the debuggee.
|
||||
//
|
||||
// The breakpoint specification (location, condition, and expression
|
||||
// fields) is semantically immutable, although the field values may
|
||||
// change. For example, an agent may update the location line number
|
||||
// to reflect the actual line where the breakpoint was set, but this
|
||||
// doesn't change the breakpoint semantics.
|
||||
//
|
||||
// This means that an agent does not need to check if a breakpoint has changed
|
||||
// when it encounters the same breakpoint on a successive call.
|
||||
// Moreover, an agent should remember the breakpoints that are completed
|
||||
// until the controller removes them from the active list to avoid
|
||||
// setting those breakpoints again.
|
||||
func (c *Controller2Client) ListActiveBreakpoints(ctx context.Context, req *clouddebuggerpb.ListActiveBreakpointsRequest) (*clouddebuggerpb.ListActiveBreakpointsResponse, error) {
|
||||
ctx = insertXGoog(ctx, c.xGoogHeader)
|
||||
var resp *clouddebuggerpb.ListActiveBreakpointsResponse
|
||||
err := gax.Invoke(ctx, func(ctx context.Context) error {
|
||||
var err error
|
||||
resp, err = c.controller2Client.ListActiveBreakpoints(ctx, req)
|
||||
return err
|
||||
}, c.CallOptions.ListActiveBreakpoints...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// UpdateActiveBreakpoint updates the breakpoint state or mutable fields.
|
||||
// The entire Breakpoint message must be sent back to the controller
|
||||
// service.
|
||||
//
|
||||
// Updates to active breakpoint fields are only allowed if the new value
|
||||
// does not change the breakpoint specification. Updates to the `location`,
|
||||
// `condition` and `expression` fields should not alter the breakpoint
|
||||
// semantics. These may only make changes such as canonicalizing a value
|
||||
// or snapping the location to the correct line of code.
|
||||
func (c *Controller2Client) UpdateActiveBreakpoint(ctx context.Context, req *clouddebuggerpb.UpdateActiveBreakpointRequest) (*clouddebuggerpb.UpdateActiveBreakpointResponse, error) {
|
||||
ctx = insertXGoog(ctx, c.xGoogHeader)
|
||||
var resp *clouddebuggerpb.UpdateActiveBreakpointResponse
|
||||
err := gax.Invoke(ctx, func(ctx context.Context) error {
|
||||
var err error
|
||||
resp, err = c.controller2Client.UpdateActiveBreakpoint(ctx, req)
|
||||
return err
|
||||
}, c.CallOptions.UpdateActiveBreakpoint...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
87
vendor/cloud.google.com/go/debugger/apiv2/controller2_client_example_test.go
generated
vendored
Normal file
87
vendor/cloud.google.com/go/debugger/apiv2/controller2_client_example_test.go
generated
vendored
Normal file
|
@ -0,0 +1,87 @@
|
|||
// Copyright 2017, Google Inc. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// AUTO-GENERATED CODE. DO NOT EDIT.
|
||||
|
||||
package debugger_test
|
||||
|
||||
import (
|
||||
"cloud.google.com/go/debugger/apiv2"
|
||||
"golang.org/x/net/context"
|
||||
clouddebuggerpb "google.golang.org/genproto/googleapis/devtools/clouddebugger/v2"
|
||||
)
|
||||
|
||||
func ExampleNewController2Client() {
|
||||
ctx := context.Background()
|
||||
c, err := debugger.NewController2Client(ctx)
|
||||
if err != nil {
|
||||
// TODO: Handle error.
|
||||
}
|
||||
// TODO: Use client.
|
||||
_ = c
|
||||
}
|
||||
|
||||
func ExampleController2Client_RegisterDebuggee() {
|
||||
ctx := context.Background()
|
||||
c, err := debugger.NewController2Client(ctx)
|
||||
if err != nil {
|
||||
// TODO: Handle error.
|
||||
}
|
||||
|
||||
req := &clouddebuggerpb.RegisterDebuggeeRequest{
|
||||
// TODO: Fill request struct fields.
|
||||
}
|
||||
resp, err := c.RegisterDebuggee(ctx, req)
|
||||
if err != nil {
|
||||
// TODO: Handle error.
|
||||
}
|
||||
// TODO: Use resp.
|
||||
_ = resp
|
||||
}
|
||||
|
||||
func ExampleController2Client_ListActiveBreakpoints() {
|
||||
ctx := context.Background()
|
||||
c, err := debugger.NewController2Client(ctx)
|
||||
if err != nil {
|
||||
// TODO: Handle error.
|
||||
}
|
||||
|
||||
req := &clouddebuggerpb.ListActiveBreakpointsRequest{
|
||||
// TODO: Fill request struct fields.
|
||||
}
|
||||
resp, err := c.ListActiveBreakpoints(ctx, req)
|
||||
if err != nil {
|
||||
// TODO: Handle error.
|
||||
}
|
||||
// TODO: Use resp.
|
||||
_ = resp
|
||||
}
|
||||
|
||||
func ExampleController2Client_UpdateActiveBreakpoint() {
|
||||
ctx := context.Background()
|
||||
c, err := debugger.NewController2Client(ctx)
|
||||
if err != nil {
|
||||
// TODO: Handle error.
|
||||
}
|
||||
|
||||
req := &clouddebuggerpb.UpdateActiveBreakpointRequest{
|
||||
// TODO: Fill request struct fields.
|
||||
}
|
||||
resp, err := c.UpdateActiveBreakpoint(ctx, req)
|
||||
if err != nil {
|
||||
// TODO: Handle error.
|
||||
}
|
||||
// TODO: Use resp.
|
||||
_ = resp
|
||||
}
|
219
vendor/cloud.google.com/go/debugger/apiv2/debugger2_client.go
generated
vendored
Normal file
219
vendor/cloud.google.com/go/debugger/apiv2/debugger2_client.go
generated
vendored
Normal file
|
@ -0,0 +1,219 @@
|
|||
// Copyright 2017, Google Inc. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// AUTO-GENERATED CODE. DO NOT EDIT.
|
||||
|
||||
package debugger
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"cloud.google.com/go/internal/version"
|
||||
gax "github.com/googleapis/gax-go"
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/api/option"
|
||||
"google.golang.org/api/transport"
|
||||
clouddebuggerpb "google.golang.org/genproto/googleapis/devtools/clouddebugger/v2"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
)
|
||||
|
||||
// Debugger2CallOptions contains the retry settings for each method of Debugger2Client.
|
||||
type Debugger2CallOptions struct {
|
||||
SetBreakpoint []gax.CallOption
|
||||
GetBreakpoint []gax.CallOption
|
||||
DeleteBreakpoint []gax.CallOption
|
||||
ListBreakpoints []gax.CallOption
|
||||
ListDebuggees []gax.CallOption
|
||||
}
|
||||
|
||||
func defaultDebugger2ClientOptions() []option.ClientOption {
|
||||
return []option.ClientOption{
|
||||
option.WithEndpoint("clouddebugger.googleapis.com:443"),
|
||||
option.WithScopes(
|
||||
"https://www.googleapis.com/auth/cloud-platform",
|
||||
"https://www.googleapis.com/auth/cloud_debugger",
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
func defaultDebugger2CallOptions() *Debugger2CallOptions {
|
||||
retry := map[[2]string][]gax.CallOption{
|
||||
{"default", "idempotent"}: {
|
||||
gax.WithRetry(func() gax.Retryer {
|
||||
return gax.OnCodes([]codes.Code{
|
||||
codes.DeadlineExceeded,
|
||||
codes.Unavailable,
|
||||
}, gax.Backoff{
|
||||
Initial: 100 * time.Millisecond,
|
||||
Max: 60000 * time.Millisecond,
|
||||
Multiplier: 1.3,
|
||||
})
|
||||
}),
|
||||
},
|
||||
{"default", "non_idempotent"}: {
|
||||
gax.WithRetry(func() gax.Retryer {
|
||||
return gax.OnCodes([]codes.Code{
|
||||
codes.Unavailable,
|
||||
}, gax.Backoff{
|
||||
Initial: 100 * time.Millisecond,
|
||||
Max: 60000 * time.Millisecond,
|
||||
Multiplier: 1.3,
|
||||
})
|
||||
}),
|
||||
},
|
||||
}
|
||||
return &Debugger2CallOptions{
|
||||
SetBreakpoint: retry[[2]string{"default", "non_idempotent"}],
|
||||
GetBreakpoint: retry[[2]string{"default", "idempotent"}],
|
||||
DeleteBreakpoint: retry[[2]string{"default", "idempotent"}],
|
||||
ListBreakpoints: retry[[2]string{"default", "idempotent"}],
|
||||
ListDebuggees: retry[[2]string{"default", "idempotent"}],
|
||||
}
|
||||
}
|
||||
|
||||
// Debugger2Client is a client for interacting with Stackdriver Debugger API.
|
||||
type Debugger2Client struct {
|
||||
// The connection to the service.
|
||||
conn *grpc.ClientConn
|
||||
|
||||
// The gRPC API client.
|
||||
debugger2Client clouddebuggerpb.Debugger2Client
|
||||
|
||||
// The call options for this service.
|
||||
CallOptions *Debugger2CallOptions
|
||||
|
||||
// The metadata to be sent with each request.
|
||||
xGoogHeader string
|
||||
}
|
||||
|
||||
// NewDebugger2Client creates a new debugger2 client.
|
||||
//
|
||||
// The Debugger service provides the API that allows users to collect run-time
|
||||
// information from a running application, without stopping or slowing it down
|
||||
// and without modifying its state. An application may include one or
|
||||
// more replicated processes performing the same work.
|
||||
//
|
||||
// The application is represented using the Debuggee concept. The Debugger
|
||||
// service provides a way to query for available Debuggees, but does not
|
||||
// provide a way to create one. A debuggee is created using the Controller
|
||||
// service, usually by running a debugger agent with the application.
|
||||
//
|
||||
// The Debugger service enables the client to set one or more Breakpoints on a
|
||||
// Debuggee and collect the results of the set Breakpoints.
|
||||
func NewDebugger2Client(ctx context.Context, opts ...option.ClientOption) (*Debugger2Client, error) {
|
||||
conn, err := transport.DialGRPC(ctx, append(defaultDebugger2ClientOptions(), opts...)...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
c := &Debugger2Client{
|
||||
conn: conn,
|
||||
CallOptions: defaultDebugger2CallOptions(),
|
||||
|
||||
debugger2Client: clouddebuggerpb.NewDebugger2Client(conn),
|
||||
}
|
||||
c.SetGoogleClientInfo()
|
||||
return c, nil
|
||||
}
|
||||
|
||||
// Connection returns the client's connection to the API service.
|
||||
func (c *Debugger2Client) Connection() *grpc.ClientConn {
|
||||
return c.conn
|
||||
}
|
||||
|
||||
// Close closes the connection to the API service. The user should invoke this when
|
||||
// the client is no longer required.
|
||||
func (c *Debugger2Client) Close() error {
|
||||
return c.conn.Close()
|
||||
}
|
||||
|
||||
// SetGoogleClientInfo sets the name and version of the application in
|
||||
// the `x-goog-api-client` header passed on each request. Intended for
|
||||
// use by Google-written clients.
|
||||
func (c *Debugger2Client) SetGoogleClientInfo(keyval ...string) {
|
||||
kv := append([]string{"gl-go", version.Go()}, keyval...)
|
||||
kv = append(kv, "gapic", version.Repo, "gax", gax.Version, "grpc", "")
|
||||
c.xGoogHeader = gax.XGoogHeader(kv...)
|
||||
}
|
||||
|
||||
// SetBreakpoint sets the breakpoint to the debuggee.
|
||||
func (c *Debugger2Client) SetBreakpoint(ctx context.Context, req *clouddebuggerpb.SetBreakpointRequest) (*clouddebuggerpb.SetBreakpointResponse, error) {
|
||||
ctx = insertXGoog(ctx, c.xGoogHeader)
|
||||
var resp *clouddebuggerpb.SetBreakpointResponse
|
||||
err := gax.Invoke(ctx, func(ctx context.Context) error {
|
||||
var err error
|
||||
resp, err = c.debugger2Client.SetBreakpoint(ctx, req)
|
||||
return err
|
||||
}, c.CallOptions.SetBreakpoint...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// GetBreakpoint gets breakpoint information.
|
||||
func (c *Debugger2Client) GetBreakpoint(ctx context.Context, req *clouddebuggerpb.GetBreakpointRequest) (*clouddebuggerpb.GetBreakpointResponse, error) {
|
||||
ctx = insertXGoog(ctx, c.xGoogHeader)
|
||||
var resp *clouddebuggerpb.GetBreakpointResponse
|
||||
err := gax.Invoke(ctx, func(ctx context.Context) error {
|
||||
var err error
|
||||
resp, err = c.debugger2Client.GetBreakpoint(ctx, req)
|
||||
return err
|
||||
}, c.CallOptions.GetBreakpoint...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// DeleteBreakpoint deletes the breakpoint from the debuggee.
|
||||
func (c *Debugger2Client) DeleteBreakpoint(ctx context.Context, req *clouddebuggerpb.DeleteBreakpointRequest) error {
|
||||
ctx = insertXGoog(ctx, c.xGoogHeader)
|
||||
err := gax.Invoke(ctx, func(ctx context.Context) error {
|
||||
var err error
|
||||
_, err = c.debugger2Client.DeleteBreakpoint(ctx, req)
|
||||
return err
|
||||
}, c.CallOptions.DeleteBreakpoint...)
|
||||
return err
|
||||
}
|
||||
|
||||
// ListBreakpoints lists all breakpoints for the debuggee.
|
||||
func (c *Debugger2Client) ListBreakpoints(ctx context.Context, req *clouddebuggerpb.ListBreakpointsRequest) (*clouddebuggerpb.ListBreakpointsResponse, error) {
|
||||
ctx = insertXGoog(ctx, c.xGoogHeader)
|
||||
var resp *clouddebuggerpb.ListBreakpointsResponse
|
||||
err := gax.Invoke(ctx, func(ctx context.Context) error {
|
||||
var err error
|
||||
resp, err = c.debugger2Client.ListBreakpoints(ctx, req)
|
||||
return err
|
||||
}, c.CallOptions.ListBreakpoints...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// ListDebuggees lists all the debuggees that the user can set breakpoints to.
|
||||
func (c *Debugger2Client) ListDebuggees(ctx context.Context, req *clouddebuggerpb.ListDebuggeesRequest) (*clouddebuggerpb.ListDebuggeesResponse, error) {
|
||||
ctx = insertXGoog(ctx, c.xGoogHeader)
|
||||
var resp *clouddebuggerpb.ListDebuggeesResponse
|
||||
err := gax.Invoke(ctx, func(ctx context.Context) error {
|
||||
var err error
|
||||
resp, err = c.debugger2Client.ListDebuggees(ctx, req)
|
||||
return err
|
||||
}, c.CallOptions.ListDebuggees...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
121
vendor/cloud.google.com/go/debugger/apiv2/debugger2_client_example_test.go
generated
vendored
Normal file
121
vendor/cloud.google.com/go/debugger/apiv2/debugger2_client_example_test.go
generated
vendored
Normal file
|
@ -0,0 +1,121 @@
|
|||
// Copyright 2017, Google Inc. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// AUTO-GENERATED CODE. DO NOT EDIT.
|
||||
|
||||
package debugger_test
|
||||
|
||||
import (
|
||||
"cloud.google.com/go/debugger/apiv2"
|
||||
"golang.org/x/net/context"
|
||||
clouddebuggerpb "google.golang.org/genproto/googleapis/devtools/clouddebugger/v2"
|
||||
)
|
||||
|
||||
func ExampleNewDebugger2Client() {
|
||||
ctx := context.Background()
|
||||
c, err := debugger.NewDebugger2Client(ctx)
|
||||
if err != nil {
|
||||
// TODO: Handle error.
|
||||
}
|
||||
// TODO: Use client.
|
||||
_ = c
|
||||
}
|
||||
|
||||
func ExampleDebugger2Client_SetBreakpoint() {
|
||||
ctx := context.Background()
|
||||
c, err := debugger.NewDebugger2Client(ctx)
|
||||
if err != nil {
|
||||
// TODO: Handle error.
|
||||
}
|
||||
|
||||
req := &clouddebuggerpb.SetBreakpointRequest{
|
||||
// TODO: Fill request struct fields.
|
||||
}
|
||||
resp, err := c.SetBreakpoint(ctx, req)
|
||||
if err != nil {
|
||||
// TODO: Handle error.
|
||||
}
|
||||
// TODO: Use resp.
|
||||
_ = resp
|
||||
}
|
||||
|
||||
func ExampleDebugger2Client_GetBreakpoint() {
|
||||
ctx := context.Background()
|
||||
c, err := debugger.NewDebugger2Client(ctx)
|
||||
if err != nil {
|
||||
// TODO: Handle error.
|
||||
}
|
||||
|
||||
req := &clouddebuggerpb.GetBreakpointRequest{
|
||||
// TODO: Fill request struct fields.
|
||||
}
|
||||
resp, err := c.GetBreakpoint(ctx, req)
|
||||
if err != nil {
|
||||
// TODO: Handle error.
|
||||
}
|
||||
// TODO: Use resp.
|
||||
_ = resp
|
||||
}
|
||||
|
||||
func ExampleDebugger2Client_DeleteBreakpoint() {
|
||||
ctx := context.Background()
|
||||
c, err := debugger.NewDebugger2Client(ctx)
|
||||
if err != nil {
|
||||
// TODO: Handle error.
|
||||
}
|
||||
|
||||
req := &clouddebuggerpb.DeleteBreakpointRequest{
|
||||
// TODO: Fill request struct fields.
|
||||
}
|
||||
err = c.DeleteBreakpoint(ctx, req)
|
||||
if err != nil {
|
||||
// TODO: Handle error.
|
||||
}
|
||||
}
|
||||
|
||||
func ExampleDebugger2Client_ListBreakpoints() {
|
||||
ctx := context.Background()
|
||||
c, err := debugger.NewDebugger2Client(ctx)
|
||||
if err != nil {
|
||||
// TODO: Handle error.
|
||||
}
|
||||
|
||||
req := &clouddebuggerpb.ListBreakpointsRequest{
|
||||
// TODO: Fill request struct fields.
|
||||
}
|
||||
resp, err := c.ListBreakpoints(ctx, req)
|
||||
if err != nil {
|
||||
// TODO: Handle error.
|
||||
}
|
||||
// TODO: Use resp.
|
||||
_ = resp
|
||||
}
|
||||
|
||||
func ExampleDebugger2Client_ListDebuggees() {
|
||||
ctx := context.Background()
|
||||
c, err := debugger.NewDebugger2Client(ctx)
|
||||
if err != nil {
|
||||
// TODO: Handle error.
|
||||
}
|
||||
|
||||
req := &clouddebuggerpb.ListDebuggeesRequest{
|
||||
// TODO: Fill request struct fields.
|
||||
}
|
||||
resp, err := c.ListDebuggees(ctx, req)
|
||||
if err != nil {
|
||||
// TODO: Handle error.
|
||||
}
|
||||
// TODO: Use resp.
|
||||
_ = resp
|
||||
}
|
36
vendor/cloud.google.com/go/debugger/apiv2/doc.go
generated
vendored
Normal file
36
vendor/cloud.google.com/go/debugger/apiv2/doc.go
generated
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
// Copyright 2017, Google Inc. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// AUTO-GENERATED CODE. DO NOT EDIT.
|
||||
|
||||
// Package debugger is an experimental, auto-generated package for the
|
||||
// debugger API.
|
||||
//
|
||||
// Examines the call stack and variables of a running application
|
||||
// without stopping or slowing it down.
|
||||
//
|
||||
// Use the client at cloud.google.com/go/cmd/go-cloud-debug-agent in preference to this.
|
||||
package debugger // import "cloud.google.com/go/debugger/apiv2"
|
||||
|
||||
import (
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/grpc/metadata"
|
||||
)
|
||||
|
||||
func insertXGoog(ctx context.Context, val string) context.Context {
|
||||
md, _ := metadata.FromContext(ctx)
|
||||
md = md.Copy()
|
||||
md["x-goog-api-client"] = []string{val}
|
||||
return metadata.NewContext(ctx, md)
|
||||
}
|
641
vendor/cloud.google.com/go/debugger/apiv2/mock_test.go
generated
vendored
Normal file
641
vendor/cloud.google.com/go/debugger/apiv2/mock_test.go
generated
vendored
Normal file
|
@ -0,0 +1,641 @@
|
|||
// Copyright 2017, Google Inc. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// AUTO-GENERATED CODE. DO NOT EDIT.
|
||||
|
||||
package debugger
|
||||
|
||||
import (
|
||||
google_protobuf "github.com/golang/protobuf/ptypes/empty"
|
||||
clouddebuggerpb "google.golang.org/genproto/googleapis/devtools/clouddebugger/v2"
|
||||
)
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"io"
|
||||
"log"
|
||||
"net"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/golang/protobuf/ptypes"
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/api/option"
|
||||
status "google.golang.org/genproto/googleapis/rpc/status"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
)
|
||||
|
||||
var _ = io.EOF
|
||||
var _ = ptypes.MarshalAny
|
||||
var _ status.Status
|
||||
|
||||
type mockDebugger2Server struct {
|
||||
// Embed for forward compatibility.
|
||||
// Tests will keep working if more methods are added
|
||||
// in the future.
|
||||
clouddebuggerpb.Debugger2Server
|
||||
|
||||
reqs []proto.Message
|
||||
|
||||
// If set, all calls return this error.
|
||||
err error
|
||||
|
||||
// responses to return if err == nil
|
||||
resps []proto.Message
|
||||
}
|
||||
|
||||
func (s *mockDebugger2Server) SetBreakpoint(_ context.Context, req *clouddebuggerpb.SetBreakpointRequest) (*clouddebuggerpb.SetBreakpointResponse, error) {
|
||||
s.reqs = append(s.reqs, req)
|
||||
if s.err != nil {
|
||||
return nil, s.err
|
||||
}
|
||||
return s.resps[0].(*clouddebuggerpb.SetBreakpointResponse), nil
|
||||
}
|
||||
|
||||
func (s *mockDebugger2Server) GetBreakpoint(_ context.Context, req *clouddebuggerpb.GetBreakpointRequest) (*clouddebuggerpb.GetBreakpointResponse, error) {
|
||||
s.reqs = append(s.reqs, req)
|
||||
if s.err != nil {
|
||||
return nil, s.err
|
||||
}
|
||||
return s.resps[0].(*clouddebuggerpb.GetBreakpointResponse), nil
|
||||
}
|
||||
|
||||
func (s *mockDebugger2Server) DeleteBreakpoint(_ context.Context, req *clouddebuggerpb.DeleteBreakpointRequest) (*google_protobuf.Empty, error) {
|
||||
s.reqs = append(s.reqs, req)
|
||||
if s.err != nil {
|
||||
return nil, s.err
|
||||
}
|
||||
return s.resps[0].(*google_protobuf.Empty), nil
|
||||
}
|
||||
|
||||
func (s *mockDebugger2Server) ListBreakpoints(_ context.Context, req *clouddebuggerpb.ListBreakpointsRequest) (*clouddebuggerpb.ListBreakpointsResponse, error) {
|
||||
s.reqs = append(s.reqs, req)
|
||||
if s.err != nil {
|
||||
return nil, s.err
|
||||
}
|
||||
return s.resps[0].(*clouddebuggerpb.ListBreakpointsResponse), nil
|
||||
}
|
||||
|
||||
func (s *mockDebugger2Server) ListDebuggees(_ context.Context, req *clouddebuggerpb.ListDebuggeesRequest) (*clouddebuggerpb.ListDebuggeesResponse, error) {
|
||||
s.reqs = append(s.reqs, req)
|
||||
if s.err != nil {
|
||||
return nil, s.err
|
||||
}
|
||||
return s.resps[0].(*clouddebuggerpb.ListDebuggeesResponse), nil
|
||||
}
|
||||
|
||||
type mockController2Server struct {
|
||||
// Embed for forward compatibility.
|
||||
// Tests will keep working if more methods are added
|
||||
// in the future.
|
||||
clouddebuggerpb.Controller2Server
|
||||
|
||||
reqs []proto.Message
|
||||
|
||||
// If set, all calls return this error.
|
||||
err error
|
||||
|
||||
// responses to return if err == nil
|
||||
resps []proto.Message
|
||||
}
|
||||
|
||||
func (s *mockController2Server) RegisterDebuggee(_ context.Context, req *clouddebuggerpb.RegisterDebuggeeRequest) (*clouddebuggerpb.RegisterDebuggeeResponse, error) {
|
||||
s.reqs = append(s.reqs, req)
|
||||
if s.err != nil {
|
||||
return nil, s.err
|
||||
}
|
||||
return s.resps[0].(*clouddebuggerpb.RegisterDebuggeeResponse), nil
|
||||
}
|
||||
|
||||
func (s *mockController2Server) ListActiveBreakpoints(_ context.Context, req *clouddebuggerpb.ListActiveBreakpointsRequest) (*clouddebuggerpb.ListActiveBreakpointsResponse, error) {
|
||||
s.reqs = append(s.reqs, req)
|
||||
if s.err != nil {
|
||||
return nil, s.err
|
||||
}
|
||||
return s.resps[0].(*clouddebuggerpb.ListActiveBreakpointsResponse), nil
|
||||
}
|
||||
|
||||
func (s *mockController2Server) UpdateActiveBreakpoint(_ context.Context, req *clouddebuggerpb.UpdateActiveBreakpointRequest) (*clouddebuggerpb.UpdateActiveBreakpointResponse, error) {
|
||||
s.reqs = append(s.reqs, req)
|
||||
if s.err != nil {
|
||||
return nil, s.err
|
||||
}
|
||||
return s.resps[0].(*clouddebuggerpb.UpdateActiveBreakpointResponse), nil
|
||||
}
|
||||
|
||||
// clientOpt is the option tests should use to connect to the test server.
|
||||
// It is initialized by TestMain.
|
||||
var clientOpt option.ClientOption
|
||||
|
||||
var (
|
||||
mockDebugger2 mockDebugger2Server
|
||||
mockController2 mockController2Server
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
flag.Parse()
|
||||
|
||||
serv := grpc.NewServer()
|
||||
clouddebuggerpb.RegisterDebugger2Server(serv, &mockDebugger2)
|
||||
clouddebuggerpb.RegisterController2Server(serv, &mockController2)
|
||||
|
||||
lis, err := net.Listen("tcp", "localhost:0")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
go serv.Serve(lis)
|
||||
|
||||
conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure())
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
clientOpt = option.WithGRPCConn(conn)
|
||||
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
func TestDebugger2SetBreakpoint(t *testing.T) {
|
||||
var expectedResponse *clouddebuggerpb.SetBreakpointResponse = &clouddebuggerpb.SetBreakpointResponse{}
|
||||
|
||||
mockDebugger2.err = nil
|
||||
mockDebugger2.reqs = nil
|
||||
|
||||
mockDebugger2.resps = append(mockDebugger2.resps[:0], expectedResponse)
|
||||
|
||||
var debuggeeId string = "debuggeeId-997255898"
|
||||
var breakpoint *clouddebuggerpb.Breakpoint = &clouddebuggerpb.Breakpoint{}
|
||||
var clientVersion string = "clientVersion-1506231196"
|
||||
var request = &clouddebuggerpb.SetBreakpointRequest{
|
||||
DebuggeeId: debuggeeId,
|
||||
Breakpoint: breakpoint,
|
||||
ClientVersion: clientVersion,
|
||||
}
|
||||
|
||||
c, err := NewDebugger2Client(context.Background(), clientOpt)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
resp, err := c.SetBreakpoint(context.Background(), request)
|
||||
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if want, got := request, mockDebugger2.reqs[0]; !proto.Equal(want, got) {
|
||||
t.Errorf("wrong request %q, want %q", got, want)
|
||||
}
|
||||
|
||||
if want, got := expectedResponse, resp; !proto.Equal(want, got) {
|
||||
t.Errorf("wrong response %q, want %q)", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDebugger2SetBreakpointError(t *testing.T) {
|
||||
errCode := codes.Internal
|
||||
mockDebugger2.err = grpc.Errorf(errCode, "test error")
|
||||
|
||||
var debuggeeId string = "debuggeeId-997255898"
|
||||
var breakpoint *clouddebuggerpb.Breakpoint = &clouddebuggerpb.Breakpoint{}
|
||||
var clientVersion string = "clientVersion-1506231196"
|
||||
var request = &clouddebuggerpb.SetBreakpointRequest{
|
||||
DebuggeeId: debuggeeId,
|
||||
Breakpoint: breakpoint,
|
||||
ClientVersion: clientVersion,
|
||||
}
|
||||
|
||||
c, err := NewDebugger2Client(context.Background(), clientOpt)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
resp, err := c.SetBreakpoint(context.Background(), request)
|
||||
|
||||
if c := grpc.Code(err); c != errCode {
|
||||
t.Errorf("got error code %q, want %q", c, errCode)
|
||||
}
|
||||
_ = resp
|
||||
}
|
||||
func TestDebugger2GetBreakpoint(t *testing.T) {
|
||||
var expectedResponse *clouddebuggerpb.GetBreakpointResponse = &clouddebuggerpb.GetBreakpointResponse{}
|
||||
|
||||
mockDebugger2.err = nil
|
||||
mockDebugger2.reqs = nil
|
||||
|
||||
mockDebugger2.resps = append(mockDebugger2.resps[:0], expectedResponse)
|
||||
|
||||
var debuggeeId string = "debuggeeId-997255898"
|
||||
var breakpointId string = "breakpointId498424873"
|
||||
var clientVersion string = "clientVersion-1506231196"
|
||||
var request = &clouddebuggerpb.GetBreakpointRequest{
|
||||
DebuggeeId: debuggeeId,
|
||||
BreakpointId: breakpointId,
|
||||
ClientVersion: clientVersion,
|
||||
}
|
||||
|
||||
c, err := NewDebugger2Client(context.Background(), clientOpt)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
resp, err := c.GetBreakpoint(context.Background(), request)
|
||||
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if want, got := request, mockDebugger2.reqs[0]; !proto.Equal(want, got) {
|
||||
t.Errorf("wrong request %q, want %q", got, want)
|
||||
}
|
||||
|
||||
if want, got := expectedResponse, resp; !proto.Equal(want, got) {
|
||||
t.Errorf("wrong response %q, want %q)", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDebugger2GetBreakpointError(t *testing.T) {
|
||||
errCode := codes.Internal
|
||||
mockDebugger2.err = grpc.Errorf(errCode, "test error")
|
||||
|
||||
var debuggeeId string = "debuggeeId-997255898"
|
||||
var breakpointId string = "breakpointId498424873"
|
||||
var clientVersion string = "clientVersion-1506231196"
|
||||
var request = &clouddebuggerpb.GetBreakpointRequest{
|
||||
DebuggeeId: debuggeeId,
|
||||
BreakpointId: breakpointId,
|
||||
ClientVersion: clientVersion,
|
||||
}
|
||||
|
||||
c, err := NewDebugger2Client(context.Background(), clientOpt)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
resp, err := c.GetBreakpoint(context.Background(), request)
|
||||
|
||||
if c := grpc.Code(err); c != errCode {
|
||||
t.Errorf("got error code %q, want %q", c, errCode)
|
||||
}
|
||||
_ = resp
|
||||
}
|
||||
func TestDebugger2DeleteBreakpoint(t *testing.T) {
|
||||
var expectedResponse *google_protobuf.Empty = &google_protobuf.Empty{}
|
||||
|
||||
mockDebugger2.err = nil
|
||||
mockDebugger2.reqs = nil
|
||||
|
||||
mockDebugger2.resps = append(mockDebugger2.resps[:0], expectedResponse)
|
||||
|
||||
var debuggeeId string = "debuggeeId-997255898"
|
||||
var breakpointId string = "breakpointId498424873"
|
||||
var clientVersion string = "clientVersion-1506231196"
|
||||
var request = &clouddebuggerpb.DeleteBreakpointRequest{
|
||||
DebuggeeId: debuggeeId,
|
||||
BreakpointId: breakpointId,
|
||||
ClientVersion: clientVersion,
|
||||
}
|
||||
|
||||
c, err := NewDebugger2Client(context.Background(), clientOpt)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
err = c.DeleteBreakpoint(context.Background(), request)
|
||||
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if want, got := request, mockDebugger2.reqs[0]; !proto.Equal(want, got) {
|
||||
t.Errorf("wrong request %q, want %q", got, want)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestDebugger2DeleteBreakpointError(t *testing.T) {
|
||||
errCode := codes.Internal
|
||||
mockDebugger2.err = grpc.Errorf(errCode, "test error")
|
||||
|
||||
var debuggeeId string = "debuggeeId-997255898"
|
||||
var breakpointId string = "breakpointId498424873"
|
||||
var clientVersion string = "clientVersion-1506231196"
|
||||
var request = &clouddebuggerpb.DeleteBreakpointRequest{
|
||||
DebuggeeId: debuggeeId,
|
||||
BreakpointId: breakpointId,
|
||||
ClientVersion: clientVersion,
|
||||
}
|
||||
|
||||
c, err := NewDebugger2Client(context.Background(), clientOpt)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
err = c.DeleteBreakpoint(context.Background(), request)
|
||||
|
||||
if c := grpc.Code(err); c != errCode {
|
||||
t.Errorf("got error code %q, want %q", c, errCode)
|
||||
}
|
||||
}
|
||||
func TestDebugger2ListBreakpoints(t *testing.T) {
|
||||
var nextWaitToken string = "nextWaitToken1006864251"
|
||||
var expectedResponse = &clouddebuggerpb.ListBreakpointsResponse{
|
||||
NextWaitToken: nextWaitToken,
|
||||
}
|
||||
|
||||
mockDebugger2.err = nil
|
||||
mockDebugger2.reqs = nil
|
||||
|
||||
mockDebugger2.resps = append(mockDebugger2.resps[:0], expectedResponse)
|
||||
|
||||
var debuggeeId string = "debuggeeId-997255898"
|
||||
var clientVersion string = "clientVersion-1506231196"
|
||||
var request = &clouddebuggerpb.ListBreakpointsRequest{
|
||||
DebuggeeId: debuggeeId,
|
||||
ClientVersion: clientVersion,
|
||||
}
|
||||
|
||||
c, err := NewDebugger2Client(context.Background(), clientOpt)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
resp, err := c.ListBreakpoints(context.Background(), request)
|
||||
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if want, got := request, mockDebugger2.reqs[0]; !proto.Equal(want, got) {
|
||||
t.Errorf("wrong request %q, want %q", got, want)
|
||||
}
|
||||
|
||||
if want, got := expectedResponse, resp; !proto.Equal(want, got) {
|
||||
t.Errorf("wrong response %q, want %q)", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDebugger2ListBreakpointsError(t *testing.T) {
|
||||
errCode := codes.Internal
|
||||
mockDebugger2.err = grpc.Errorf(errCode, "test error")
|
||||
|
||||
var debuggeeId string = "debuggeeId-997255898"
|
||||
var clientVersion string = "clientVersion-1506231196"
|
||||
var request = &clouddebuggerpb.ListBreakpointsRequest{
|
||||
DebuggeeId: debuggeeId,
|
||||
ClientVersion: clientVersion,
|
||||
}
|
||||
|
||||
c, err := NewDebugger2Client(context.Background(), clientOpt)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
resp, err := c.ListBreakpoints(context.Background(), request)
|
||||
|
||||
if c := grpc.Code(err); c != errCode {
|
||||
t.Errorf("got error code %q, want %q", c, errCode)
|
||||
}
|
||||
_ = resp
|
||||
}
|
||||
func TestDebugger2ListDebuggees(t *testing.T) {
|
||||
var expectedResponse *clouddebuggerpb.ListDebuggeesResponse = &clouddebuggerpb.ListDebuggeesResponse{}
|
||||
|
||||
mockDebugger2.err = nil
|
||||
mockDebugger2.reqs = nil
|
||||
|
||||
mockDebugger2.resps = append(mockDebugger2.resps[:0], expectedResponse)
|
||||
|
||||
var project string = "project-309310695"
|
||||
var clientVersion string = "clientVersion-1506231196"
|
||||
var request = &clouddebuggerpb.ListDebuggeesRequest{
|
||||
Project: project,
|
||||
ClientVersion: clientVersion,
|
||||
}
|
||||
|
||||
c, err := NewDebugger2Client(context.Background(), clientOpt)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
resp, err := c.ListDebuggees(context.Background(), request)
|
||||
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if want, got := request, mockDebugger2.reqs[0]; !proto.Equal(want, got) {
|
||||
t.Errorf("wrong request %q, want %q", got, want)
|
||||
}
|
||||
|
||||
if want, got := expectedResponse, resp; !proto.Equal(want, got) {
|
||||
t.Errorf("wrong response %q, want %q)", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDebugger2ListDebuggeesError(t *testing.T) {
|
||||
errCode := codes.Internal
|
||||
mockDebugger2.err = grpc.Errorf(errCode, "test error")
|
||||
|
||||
var project string = "project-309310695"
|
||||
var clientVersion string = "clientVersion-1506231196"
|
||||
var request = &clouddebuggerpb.ListDebuggeesRequest{
|
||||
Project: project,
|
||||
ClientVersion: clientVersion,
|
||||
}
|
||||
|
||||
c, err := NewDebugger2Client(context.Background(), clientOpt)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
resp, err := c.ListDebuggees(context.Background(), request)
|
||||
|
||||
if c := grpc.Code(err); c != errCode {
|
||||
t.Errorf("got error code %q, want %q", c, errCode)
|
||||
}
|
||||
_ = resp
|
||||
}
|
||||
func TestController2RegisterDebuggee(t *testing.T) {
|
||||
var expectedResponse *clouddebuggerpb.RegisterDebuggeeResponse = &clouddebuggerpb.RegisterDebuggeeResponse{}
|
||||
|
||||
mockController2.err = nil
|
||||
mockController2.reqs = nil
|
||||
|
||||
mockController2.resps = append(mockController2.resps[:0], expectedResponse)
|
||||
|
||||
var debuggee *clouddebuggerpb.Debuggee = &clouddebuggerpb.Debuggee{}
|
||||
var request = &clouddebuggerpb.RegisterDebuggeeRequest{
|
||||
Debuggee: debuggee,
|
||||
}
|
||||
|
||||
c, err := NewController2Client(context.Background(), clientOpt)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
resp, err := c.RegisterDebuggee(context.Background(), request)
|
||||
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if want, got := request, mockController2.reqs[0]; !proto.Equal(want, got) {
|
||||
t.Errorf("wrong request %q, want %q", got, want)
|
||||
}
|
||||
|
||||
if want, got := expectedResponse, resp; !proto.Equal(want, got) {
|
||||
t.Errorf("wrong response %q, want %q)", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestController2RegisterDebuggeeError(t *testing.T) {
|
||||
errCode := codes.Internal
|
||||
mockController2.err = grpc.Errorf(errCode, "test error")
|
||||
|
||||
var debuggee *clouddebuggerpb.Debuggee = &clouddebuggerpb.Debuggee{}
|
||||
var request = &clouddebuggerpb.RegisterDebuggeeRequest{
|
||||
Debuggee: debuggee,
|
||||
}
|
||||
|
||||
c, err := NewController2Client(context.Background(), clientOpt)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
resp, err := c.RegisterDebuggee(context.Background(), request)
|
||||
|
||||
if c := grpc.Code(err); c != errCode {
|
||||
t.Errorf("got error code %q, want %q", c, errCode)
|
||||
}
|
||||
_ = resp
|
||||
}
|
||||
func TestController2ListActiveBreakpoints(t *testing.T) {
|
||||
var nextWaitToken string = "nextWaitToken1006864251"
|
||||
var waitExpired bool = false
|
||||
var expectedResponse = &clouddebuggerpb.ListActiveBreakpointsResponse{
|
||||
NextWaitToken: nextWaitToken,
|
||||
WaitExpired: waitExpired,
|
||||
}
|
||||
|
||||
mockController2.err = nil
|
||||
mockController2.reqs = nil
|
||||
|
||||
mockController2.resps = append(mockController2.resps[:0], expectedResponse)
|
||||
|
||||
var debuggeeId string = "debuggeeId-997255898"
|
||||
var request = &clouddebuggerpb.ListActiveBreakpointsRequest{
|
||||
DebuggeeId: debuggeeId,
|
||||
}
|
||||
|
||||
c, err := NewController2Client(context.Background(), clientOpt)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
resp, err := c.ListActiveBreakpoints(context.Background(), request)
|
||||
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if want, got := request, mockController2.reqs[0]; !proto.Equal(want, got) {
|
||||
t.Errorf("wrong request %q, want %q", got, want)
|
||||
}
|
||||
|
||||
if want, got := expectedResponse, resp; !proto.Equal(want, got) {
|
||||
t.Errorf("wrong response %q, want %q)", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestController2ListActiveBreakpointsError(t *testing.T) {
|
||||
errCode := codes.Internal
|
||||
mockController2.err = grpc.Errorf(errCode, "test error")
|
||||
|
||||
var debuggeeId string = "debuggeeId-997255898"
|
||||
var request = &clouddebuggerpb.ListActiveBreakpointsRequest{
|
||||
DebuggeeId: debuggeeId,
|
||||
}
|
||||
|
||||
c, err := NewController2Client(context.Background(), clientOpt)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
resp, err := c.ListActiveBreakpoints(context.Background(), request)
|
||||
|
||||
if c := grpc.Code(err); c != errCode {
|
||||
t.Errorf("got error code %q, want %q", c, errCode)
|
||||
}
|
||||
_ = resp
|
||||
}
|
||||
func TestController2UpdateActiveBreakpoint(t *testing.T) {
|
||||
var expectedResponse *clouddebuggerpb.UpdateActiveBreakpointResponse = &clouddebuggerpb.UpdateActiveBreakpointResponse{}
|
||||
|
||||
mockController2.err = nil
|
||||
mockController2.reqs = nil
|
||||
|
||||
mockController2.resps = append(mockController2.resps[:0], expectedResponse)
|
||||
|
||||
var debuggeeId string = "debuggeeId-997255898"
|
||||
var breakpoint *clouddebuggerpb.Breakpoint = &clouddebuggerpb.Breakpoint{}
|
||||
var request = &clouddebuggerpb.UpdateActiveBreakpointRequest{
|
||||
DebuggeeId: debuggeeId,
|
||||
Breakpoint: breakpoint,
|
||||
}
|
||||
|
||||
c, err := NewController2Client(context.Background(), clientOpt)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
resp, err := c.UpdateActiveBreakpoint(context.Background(), request)
|
||||
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if want, got := request, mockController2.reqs[0]; !proto.Equal(want, got) {
|
||||
t.Errorf("wrong request %q, want %q", got, want)
|
||||
}
|
||||
|
||||
if want, got := expectedResponse, resp; !proto.Equal(want, got) {
|
||||
t.Errorf("wrong response %q, want %q)", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestController2UpdateActiveBreakpointError(t *testing.T) {
|
||||
errCode := codes.Internal
|
||||
mockController2.err = grpc.Errorf(errCode, "test error")
|
||||
|
||||
var debuggeeId string = "debuggeeId-997255898"
|
||||
var breakpoint *clouddebuggerpb.Breakpoint = &clouddebuggerpb.Breakpoint{}
|
||||
var request = &clouddebuggerpb.UpdateActiveBreakpointRequest{
|
||||
DebuggeeId: debuggeeId,
|
||||
Breakpoint: breakpoint,
|
||||
}
|
||||
|
||||
c, err := NewController2Client(context.Background(), clientOpt)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
resp, err := c.UpdateActiveBreakpoint(context.Background(), request)
|
||||
|
||||
if c := grpc.Code(err); c != errCode {
|
||||
t.Errorf("got error code %q, want %q", c, errCode)
|
||||
}
|
||||
_ = resp
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue