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 <Boris.Glimcher@emc.com>
  • Loading branch information
glimchb committed Oct 9, 2023
1 parent a3b9b68 commit 743a9dd
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 20 deletions.
2 changes: 1 addition & 1 deletion pkg/backend/nvme_path.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func (s *Server) DeleteNvmePath(ctx context.Context, in *pb.DeleteNvmePathReques
}

// UpdateNvmePath updates an Nvme path
func (s *Server) UpdateNvmePath(ctx context.Context, in *pb.UpdateNvmePathRequest) (*pb.NvmePath, error) {
func (s *Server) UpdateNvmePath(_ context.Context, in *pb.UpdateNvmePathRequest) (*pb.NvmePath, error) {
// check input correctness
if err := s.validateUpdateNvmePathRequest(in); err != nil {
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions pkg/frontend/blk.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func (s *Server) DeleteVirtioBlk(ctx context.Context, in *pb.DeleteVirtioBlkRequ
}

// UpdateVirtioBlk updates a Virtio block device
func (s *Server) UpdateVirtioBlk(ctx context.Context, in *pb.UpdateVirtioBlkRequest) (*pb.VirtioBlk, error) {
func (s *Server) UpdateVirtioBlk(_ context.Context, in *pb.UpdateVirtioBlkRequest) (*pb.VirtioBlk, error) {
// check input correctness
if err := s.validateUpdateVirtioBlkRequest(in); err != nil {
return nil, err
Expand Down Expand Up @@ -212,7 +212,7 @@ func (s *Server) GetVirtioBlk(ctx context.Context, in *pb.GetVirtioBlkRequest) (
}

// StatsVirtioBlk gets a Virtio block device stats
func (s *Server) StatsVirtioBlk(ctx context.Context, in *pb.StatsVirtioBlkRequest) (*pb.StatsVirtioBlkResponse, error) {
func (s *Server) StatsVirtioBlk(_ context.Context, in *pb.StatsVirtioBlkRequest) (*pb.StatsVirtioBlkResponse, error) {
log.Printf("StatsVirtioBlk: Received from client: %v", in)
// check input correctness
if err := s.validateStatsVirtioBlkRequest(in); err != nil {
Expand Down
8 changes: 4 additions & 4 deletions pkg/frontend/nvme_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func (s *Server) DeleteNvmeController(ctx context.Context, in *pb.DeleteNvmeCont
}

// UpdateNvmeController updates an Nvme controller
func (s *Server) UpdateNvmeController(ctx context.Context, in *pb.UpdateNvmeControllerRequest) (*pb.NvmeController, error) {
func (s *Server) UpdateNvmeController(_ context.Context, in *pb.UpdateNvmeControllerRequest) (*pb.NvmeController, error) {
// check input correctness
if err := s.validateUpdateNvmeControllerRequest(in); err != nil {
return nil, err
Expand All @@ -165,7 +165,7 @@ func (s *Server) UpdateNvmeController(ctx context.Context, in *pb.UpdateNvmeCont
}

// ListNvmeControllers lists Nvme controllers
func (s *Server) ListNvmeControllers(ctx context.Context, in *pb.ListNvmeControllersRequest) (*pb.ListNvmeControllersResponse, error) {
func (s *Server) ListNvmeControllers(_ context.Context, in *pb.ListNvmeControllersRequest) (*pb.ListNvmeControllersResponse, error) {
// check required fields
if err := fieldbehavior.ValidateRequiredFields(in); err != nil {
return nil, err
Expand All @@ -182,7 +182,7 @@ func (s *Server) ListNvmeControllers(ctx context.Context, in *pb.ListNvmeControl
}

// GetNvmeController gets an Nvme controller
func (s *Server) GetNvmeController(ctx context.Context, in *pb.GetNvmeControllerRequest) (*pb.NvmeController, error) {
func (s *Server) GetNvmeController(_ context.Context, in *pb.GetNvmeControllerRequest) (*pb.NvmeController, error) {
// check input correctness
if err := s.validateGetNvmeControllerRequest(in); err != nil {
return nil, err
Expand All @@ -197,7 +197,7 @@ func (s *Server) GetNvmeController(ctx context.Context, in *pb.GetNvmeController
}

// StatsNvmeController gets an Nvme controller stats
func (s *Server) StatsNvmeController(ctx context.Context, in *pb.StatsNvmeControllerRequest) (*pb.StatsNvmeControllerResponse, error) {
func (s *Server) StatsNvmeController(_ context.Context, in *pb.StatsNvmeControllerRequest) (*pb.StatsNvmeControllerResponse, error) {
// check input correctness
if err := s.validateStatsNvmeControllerRequest(in); err != nil {
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions pkg/frontend/nvme_namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func (s *Server) DeleteNvmeNamespace(ctx context.Context, in *pb.DeleteNvmeNames
}

// UpdateNvmeNamespace updates an Nvme namespace
func (s *Server) UpdateNvmeNamespace(ctx context.Context, in *pb.UpdateNvmeNamespaceRequest) (*pb.NvmeNamespace, error) {
func (s *Server) UpdateNvmeNamespace(_ context.Context, in *pb.UpdateNvmeNamespaceRequest) (*pb.NvmeNamespace, error) {
// check input correctness
if err := s.validateUpdateNvmeNamespaceRequest(in); err != nil {
return nil, err
Expand Down Expand Up @@ -255,7 +255,7 @@ func (s *Server) GetNvmeNamespace(ctx context.Context, in *pb.GetNvmeNamespaceRe
}

// StatsNvmeNamespace gets an Nvme namespace stats
func (s *Server) StatsNvmeNamespace(ctx context.Context, in *pb.StatsNvmeNamespaceRequest) (*pb.StatsNvmeNamespaceResponse, error) {
func (s *Server) StatsNvmeNamespace(_ context.Context, in *pb.StatsNvmeNamespaceRequest) (*pb.StatsNvmeNamespaceResponse, error) {
// check input correctness
if err := s.validateStatsNvmeNamespaceRequest(in); err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion pkg/frontend/nvme_subsystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func (s *Server) DeleteNvmeSubsystem(ctx context.Context, in *pb.DeleteNvmeSubsy
}

// UpdateNvmeSubsystem updates an Nvme Subsystem
func (s *Server) UpdateNvmeSubsystem(ctx context.Context, in *pb.UpdateNvmeSubsystemRequest) (*pb.NvmeSubsystem, error) {
func (s *Server) UpdateNvmeSubsystem(_ context.Context, in *pb.UpdateNvmeSubsystemRequest) (*pb.NvmeSubsystem, error) {
// check input correctness
if err := s.validateUpdateNvmeSubsystemRequest(in); err != nil {
return nil, err
Expand Down
8 changes: 4 additions & 4 deletions pkg/frontend/scsi.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func (s *Server) DeleteVirtioScsiController(ctx context.Context, in *pb.DeleteVi
}

// UpdateVirtioScsiController updates a Virtio SCSI controller
func (s *Server) UpdateVirtioScsiController(ctx context.Context, in *pb.UpdateVirtioScsiControllerRequest) (*pb.VirtioScsiController, error) {
func (s *Server) UpdateVirtioScsiController(_ context.Context, in *pb.UpdateVirtioScsiControllerRequest) (*pb.VirtioScsiController, error) {
// check required fields
if err := fieldbehavior.ValidateRequiredFields(in); err != nil {
return nil, err
Expand Down Expand Up @@ -206,7 +206,7 @@ func (s *Server) GetVirtioScsiController(ctx context.Context, in *pb.GetVirtioSc
}

// StatsVirtioScsiController gets a Virtio SCSI controller stats
func (s *Server) StatsVirtioScsiController(ctx context.Context, in *pb.StatsVirtioScsiControllerRequest) (*pb.StatsVirtioScsiControllerResponse, error) {
func (s *Server) StatsVirtioScsiController(_ context.Context, in *pb.StatsVirtioScsiControllerRequest) (*pb.StatsVirtioScsiControllerResponse, error) {
// check required fields
if err := fieldbehavior.ValidateRequiredFields(in); err != nil {
return nil, err
Expand Down Expand Up @@ -317,7 +317,7 @@ func (s *Server) DeleteVirtioScsiLun(ctx context.Context, in *pb.DeleteVirtioScs
}

// UpdateVirtioScsiLun updates a Virtio SCSI LUN
func (s *Server) UpdateVirtioScsiLun(ctx context.Context, in *pb.UpdateVirtioScsiLunRequest) (*pb.VirtioScsiLun, error) {
func (s *Server) UpdateVirtioScsiLun(_ context.Context, in *pb.UpdateVirtioScsiLunRequest) (*pb.VirtioScsiLun, error) {
// check required fields
if err := fieldbehavior.ValidateRequiredFields(in); err != nil {
return nil, err
Expand Down Expand Up @@ -412,7 +412,7 @@ func (s *Server) GetVirtioScsiLun(ctx context.Context, in *pb.GetVirtioScsiLunRe
}

// StatsVirtioScsiLun gets a Virtio SCSI LUN stats
func (s *Server) StatsVirtioScsiLun(ctx context.Context, in *pb.StatsVirtioScsiLunRequest) (*pb.StatsVirtioScsiLunResponse, error) {
func (s *Server) StatsVirtioScsiLun(_ context.Context, in *pb.StatsVirtioScsiLunRequest) (*pb.StatsVirtioScsiLunResponse, error) {
// check required fields
if err := fieldbehavior.ValidateRequiredFields(in); err != nil {
return nil, err
Expand Down
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
4 changes: 2 additions & 2 deletions pkg/middleend/qos.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func (s *Server) UpdateQosVolume(ctx context.Context, in *pb.UpdateQosVolumeRequ
}

// ListQosVolumes lists QoS volumes
func (s *Server) ListQosVolumes(ctx context.Context, in *pb.ListQosVolumesRequest) (*pb.ListQosVolumesResponse, error) {
func (s *Server) ListQosVolumes(_ context.Context, in *pb.ListQosVolumesRequest) (*pb.ListQosVolumesResponse, error) {
// check required fields
if err := fieldbehavior.ValidateRequiredFields(in); err != nil {
return nil, err
Expand Down Expand Up @@ -145,7 +145,7 @@ func (s *Server) ListQosVolumes(ctx context.Context, in *pb.ListQosVolumesReques
}

// GetQosVolume gets a QoS volume
func (s *Server) GetQosVolume(ctx context.Context, in *pb.GetQosVolumeRequest) (*pb.QosVolume, error) {
func (s *Server) GetQosVolume(_ context.Context, in *pb.GetQosVolumeRequest) (*pb.QosVolume, error) {
// check input correctness
if err := s.validateGetQosVolumeRequest(in); err != nil {
return nil, err
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 743a9dd

Please sign in to comment.