Skip to content

Commit

Permalink
Updating latest goiscsi and nvme (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
boyamurthy authored Sep 4, 2023
1 parent c576480 commit 2d80085
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 23 deletions.
2 changes: 1 addition & 1 deletion fc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -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=
Expand Down
4 changes: 2 additions & 2 deletions internal/mockhelper/mockhelper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions internal/wrappers/wrappers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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{}

Expand Down
2 changes: 1 addition & 1 deletion inttests/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ package inttests

import (
"encoding/json"
"os"
"log"
"os"
"path/filepath"
"strconv"
"strings"
Expand Down
4 changes: 2 additions & 2 deletions nvme.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -149,7 +149,7 @@ type NVMeConnector struct {

// wrappers
filePath wrp.LimitedFilepath
os wrp.LimitedOS
os wrp.LimitedOS
}

// NVMeTargetInfo - Placeholder for NVMe targets
Expand Down
14 changes: 7 additions & 7 deletions pkg/scsi/scsi.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}

Expand Down Expand Up @@ -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
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/scsi/scsi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 2d80085

Please sign in to comment.