From 2d8008560f38ac64ef725625cb4b46af38738f5d Mon Sep 17 00:00:00 2001 From: boyamurthy <92081029+boyamurthy@users.noreply.github.com> Date: Mon, 4 Sep 2023 18:00:15 +0530 Subject: [PATCH] Updating latest goiscsi and nvme (#44) --- fc_test.go | 2 +- go.mod | 4 ++-- go.sum | 8 ++++---- internal/mockhelper/mockhelper.go | 4 ++-- internal/wrappers/wrappers.go | 2 ++ inttests/common.go | 2 +- nvme.go | 4 ++-- pkg/scsi/scsi.go | 14 +++++++------- pkg/scsi/scsi_test.go | 8 ++++---- 9 files changed, 25 insertions(+), 23 deletions(-) diff --git a/fc_test.go b/fc_test.go index d85bbe8..b6ddf5a 100644 --- a/fc_test.go +++ b/fc_test.go @@ -297,7 +297,7 @@ func TestFCConnector_ConnectVolume(t *testing.T) { name: "connection error", fields: getDefaultFCFields(ctrl), stateSetter: func(fields fcFields) { - getFCHBASInfoMock(&mock, fields.os,fields.filePath) + getFCHBASInfoMock(&mock, fields.os, fields.filePath) waitForDeviceWWNMock(&mock, fields.filePath, fields.os, fields.scsi) mock.SCSIGetDevicesByWWNCallWWN = mockhelper.ValidWWID mock.SCSIGetDevicesByWWNOKReturn = mockhelper.ValidDevices diff --git a/go.mod b/go.mod index 65e1e29..4dcbad7 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,8 @@ module github.com/dell/gobrick go 1.21 require ( - github.com/dell/goiscsi v1.7.0 - github.com/dell/gonvme v1.4.0 + github.com/dell/goiscsi v1.8.0 + github.com/dell/gonvme v1.5.0 github.com/golang/mock v1.3.1 github.com/sirupsen/logrus v1.9.0 github.com/stretchr/testify v1.7.0 diff --git a/go.sum b/go.sum index 7ba2c51..9d68cb7 100644 --- a/go.sum +++ b/go.sum @@ -1,10 +1,10 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dell/goiscsi v1.7.0 h1:LL/6v7uaN48Lc8d3G8t/tLZI+EuJGBRQ7NZLgJrg3RQ= -github.com/dell/goiscsi v1.7.0/go.mod h1:l3PNZbHbYKDg50e5kdJWrf5+lOxcM5+8PjMr9HibvLs= -github.com/dell/gonvme v1.4.0 h1:SK94ETt0pYZbaKkRJOcq81TbrzC38ufBX+w4uKwJnks= -github.com/dell/gonvme v1.4.0/go.mod h1:fIu54BDTyIu8JOTXo6Q0BqMF1tOjpO+wKXVXjLReR2o= +github.com/dell/goiscsi v1.8.0 h1:kocGVOdgnufc6eGpfmwP66hyhY7OVgIafaS/+uM6ogU= +github.com/dell/goiscsi v1.8.0/go.mod h1:PTlQGJaGKYgia95mGwwHSBgvfOr3BfLIjGNh1HT6p+s= +github.com/dell/gonvme v1.5.0 h1:n73WeQSFaVOlAqjhtk5T3pbu7eZgMTLpPo8/8JymOJ8= +github.com/dell/gonvme v1.5.0/go.mod h1:7MFbd7lWSaQwR5pf9ZnVZqhkAKkveSwQEO67jDBZuX0= github.com/golang/mock v1.3.1 h1:qGJ6qTW+x6xX/my+8YUVl4WNpX9B7+/l2tRsHGZ7f2s= github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= diff --git a/internal/mockhelper/mockhelper.go b/internal/mockhelper/mockhelper.go index bdeee9c..dbba22e 100644 --- a/internal/mockhelper/mockhelper.go +++ b/internal/mockhelper/mockhelper.go @@ -61,8 +61,8 @@ type MockHelper struct { OSEXECCommandContextArgs []string OSEXECCmdOKReturn string OSIsNotExistOKReturn bool - OSReadFileCallPath string - OSReadFileOKReturn string + OSReadFileCallPath string + OSReadFileOKReturn string FileWriteStringCallData string FilePathGlobCallPattern string FilePathGlobOKReturn []string diff --git a/internal/wrappers/wrappers.go b/internal/wrappers/wrappers.go index e24bd34..fa51181 100644 --- a/internal/wrappers/wrappers.go +++ b/internal/wrappers/wrappers.go @@ -45,6 +45,7 @@ type LimitedOSExec interface { type LimitedOSExecCmd interface { CombinedOutput() ([]byte, error) } + // LimitedFilepath defines limited file path interface type LimitedFilepath interface { Glob(pattern string) (matches []string, err error) @@ -91,6 +92,7 @@ type OSExecWrapper struct{} func (w *OSExecWrapper) CommandContext(ctx context.Context, name string, arg ...string) LimitedOSExecCmd { return exec.CommandContext(ctx, name, arg...) } + // FilepathWrapper contains implementation of LimitedFilePath interface type FilepathWrapper struct{} diff --git a/inttests/common.go b/inttests/common.go index 4d6b701..ba26566 100644 --- a/inttests/common.go +++ b/inttests/common.go @@ -20,8 +20,8 @@ package inttests import ( "encoding/json" - "os" "log" + "os" "path/filepath" "strconv" "strings" diff --git a/nvme.go b/nvme.go index f83c5b9..d1c1a9c 100644 --- a/nvme.go +++ b/nvme.go @@ -96,7 +96,7 @@ func NewNVMeConnector(params NVMeConnectorParams) *NVMeConnector { powerpath: pp, scsi: s, filePath: &wrp.FilepathWrapper{}, - os: &wrp.OSWrapper{}, + os: &wrp.OSWrapper{}, baseConnector: newBaseConnector(mp, pp, s, baseConnectorParams{ MultipathFlushTimeout: params.MultipathFlushTimeout, @@ -149,7 +149,7 @@ type NVMeConnector struct { // wrappers filePath wrp.LimitedFilepath - os wrp.LimitedOS + os wrp.LimitedOS } // NVMeTargetInfo - Placeholder for NVMe targets diff --git a/pkg/scsi/scsi.go b/pkg/scsi/scsi.go index 9118f5c..b48273b 100644 --- a/pkg/scsi/scsi.go +++ b/pkg/scsi/scsi.go @@ -54,10 +54,10 @@ const ( // NewSCSI initializes scsi struct func NewSCSI(chroot string) *Scsi { scsi := &Scsi{ - chroot: chroot, - filePath: &wrp.FilepathWrapper{}, - os: &wrp.OSWrapper{}, - osexec: &wrp.OSExecWrapper{}, + chroot: chroot, + filePath: &wrp.FilepathWrapper{}, + os: &wrp.OSWrapper{}, + osexec: &wrp.OSExecWrapper{}, } scsi.singleCall = &singleflight.Group{} @@ -92,9 +92,9 @@ func (dperr *DevicesHaveDifferentParentsErr) Error() string { type Scsi struct { chroot string - filePath wrp.LimitedFilepath - os wrp.LimitedOS - osexec wrp.LimitedOSExec + filePath wrp.LimitedFilepath + os wrp.LimitedOS + osexec wrp.LimitedOSExec singleCall *singleflight.Group } diff --git a/pkg/scsi/scsi_test.go b/pkg/scsi/scsi_test.go index 9ca7830..c7d5224 100644 --- a/pkg/scsi/scsi_test.go +++ b/pkg/scsi/scsi_test.go @@ -403,7 +403,7 @@ func Test_scsi_DeleteSCSIDeviceByHCTL(t *testing.T) { Ctrl: ctrl, OSOpenFileCallPath: sysPath + "delete", FileWriteStringCallData: "1", - OSReadFileCallPath: sysPath + "state", + OSReadFileCallPath: sysPath + "state", } tests := getDeleteSCSIDeviceTestCases(mock, defaultArgs, ctrl) @@ -482,7 +482,7 @@ func Test_scsi_DeleteSCSIDeviceByPath(t *testing.T) { Ctrl: ctrl, OSOpenFileCallPath: sysPath + "delete", FileWriteStringCallData: "1", - OSReadFileCallPath: sysPath + "state", + OSReadFileCallPath: sysPath + "state", } tests := getDeleteSCSIDeviceTestCases(mock, defaultArgs, ctrl) for _, tt := range tests { @@ -627,8 +627,8 @@ func Test_scsi_GetDevicesByWWN(t *testing.T) { Ctrl: ctrl, FilePathGlobCallPattern: "/sys/block/sd*", FilePathGlobOKReturn: []string{devicePath}, - OSReadFileCallPath: deviceWWIDPath, - OSReadFileOKReturn: mh.ValidSYSFCWWID, + OSReadFileCallPath: deviceWWIDPath, + OSReadFileOKReturn: mh.ValidSYSFCWWID, } tests := []struct {