Skip to content

Commit

Permalink
test: align to interface changes
Browse files Browse the repository at this point in the history
Signed-off-by: Boris Glimcher <[email protected]>
  • Loading branch information
glimchb committed Oct 9, 2023
1 parent a3b9b68 commit 660c0a5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions pkg/kvm/kvm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package kvm

import (
"context"
"fmt"
"log"
"net"
Expand Down Expand Up @@ -48,6 +49,9 @@ type stubJSONRRPC struct {
err error
}

// build time check that struct implements interface
var _ spdk.JSONRPC = (*stubJSONRRPC)(nil)

func (s stubJSONRRPC) GetID() uint64 {
return 0
}
Expand All @@ -56,11 +60,11 @@ func (s stubJSONRRPC) StartUnixListener() net.Listener {
return nil
}

func (s stubJSONRRPC) GetVersion() string {
func (s stubJSONRRPC) GetVersion(_ context.Context) string {
return ""
}

func (s stubJSONRRPC) Call(method string, _, result interface{}) error {
func (s stubJSONRRPC) Call(_ context.Context, method string, _, result interface{}) error {
if method == "vhost_create_blk_controller" {
if s.err == nil {
resultCreateVirtioBLk, ok := result.(*spdk.VhostCreateBlkControllerResult)
Expand Down
8 changes: 6 additions & 2 deletions pkg/middleend/qos_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package middleend

import (
"context"
"fmt"
"net"
"testing"
Expand Down Expand Up @@ -33,6 +34,9 @@ type stubJSONRRPC struct {
params []any
}

// build time check that struct implements interface
var _ spdk.JSONRPC = (*stubJSONRRPC)(nil)

func (s *stubJSONRRPC) GetID() uint64 {
return 0
}
Expand All @@ -41,11 +45,11 @@ func (s *stubJSONRRPC) StartUnixListener() net.Listener {
return nil
}

func (s *stubJSONRRPC) GetVersion() string {
func (s *stubJSONRRPC) GetVersion(_ context.Context) string {
return ""
}

func (s *stubJSONRRPC) Call(_ string, param interface{}, _ interface{}) error {
func (s *stubJSONRRPC) Call(_ context.Context, _ string, param interface{}, _ interface{}) error {
s.params = append(s.params, param)
return nil
}
Expand Down

0 comments on commit 660c0a5

Please sign in to comment.