Skip to content

Commit

Permalink
Fix revive checks
Browse files Browse the repository at this point in the history
  • Loading branch information
wenovus committed Jan 8, 2024
1 parent 7782388 commit 85c050d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/gnmitestutil/gnmi.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ func (s *Stubber) Sync() *Stubber {
return s
}

// SetClient is a test stub for ygnmi APIs exercising gNMI.Set.
type SetClient struct {
gpb.GNMIClient
// Responses are the gNMI Responses to return from calls to Set.
Expand All @@ -163,19 +164,24 @@ type SetClient struct {
i int
}

// Reset clears SetClient's internal state.
func (f *SetClient) Reset() {
f.Requests = nil
f.Responses = nil
f.ResponseErrs = nil
f.i = 0
}

// AddResponse appends a gNMI SetResponse to be returned when gNMI.Set is
// called.
func (f *SetClient) AddResponse(resp *gpb.SetResponse, err error) *SetClient {
f.Responses = append(f.Responses, resp)
f.ResponseErrs = append(f.ResponseErrs, err)
return f
}

// Set is a stub that records the provided request, and returns the next stub
// response.
func (f *SetClient) Set(_ context.Context, req *gpb.SetRequest, opts ...grpc.CallOption) (*gpb.SetResponse, error) {
defer func() { f.i++ }()
f.Requests = append(f.Requests, req)
Expand Down

0 comments on commit 85c050d

Please sign in to comment.