Skip to content

Commit d4ade71

Browse files
authored
Fixing unit test
1 parent b9ed77e commit d4ade71

File tree

4 files changed

+7
-10
lines changed

4 files changed

+7
-10
lines changed

storage_drivers/ontap/ontap_asa_test.go

+2-7
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"context"
77
"encoding/json"
88
"fmt"
9-
"sort"
109
"strings"
1110
"testing"
1211
"time"
@@ -2534,7 +2533,7 @@ func TestGetStorageBackendSpecsASA(t *testing.T) {
25342533
assert.Equal(t, backend.Name(), driver.BackendName(), "Should be equal")
25352534

25362535
expectedPhysicalPoolsName := []string{"dummyPool1", "dummyPool2"}
2537-
assert.Equal(t, expectedPhysicalPoolsName, backend.GetPhysicalPoolNames(ctx))
2536+
assert.ElementsMatch(t, expectedPhysicalPoolsName, backend.GetPhysicalPoolNames(ctx), "Physical pool names do not match")
25382537
}
25392538

25402539
func TestGetStorageBackendPhysicalPoolNamesASA(t *testing.T) {
@@ -2558,13 +2557,9 @@ func TestGetStorageBackendPhysicalPoolNamesASA(t *testing.T) {
25582557
driver.physicalPools = physicalPools
25592558

25602559
expectedPhysicalPoolsName := []string{"dummyPool1", "dummyPool2"}
2561-
25622560
actualPhysicalPoolsName := driver.GetStorageBackendPhysicalPoolNames(ctx)
25632561

2564-
sort.Strings(expectedPhysicalPoolsName)
2565-
sort.Strings(actualPhysicalPoolsName)
2566-
2567-
assert.Equal(t, expectedPhysicalPoolsName, actualPhysicalPoolsName, "Should be equal")
2562+
assert.ElementsMatch(t, expectedPhysicalPoolsName, actualPhysicalPoolsName, "Should be equal")
25682563
}
25692564

25702565
func TestGetBackendStateASA(t *testing.T) {

utils/lsblk/lsblk_darwin.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ func (l *LsblkUtil) GetBlockDevices(ctx context.Context) ([]BlockDevice, error)
1414
}
1515

1616
func (l *LsblkUtil) FindParentDevice(ctx context.Context, deviceName string, devices []BlockDevice,
17-
parent *BlockDevice) (*BlockDevice, error) {
17+
parent *BlockDevice,
18+
) (*BlockDevice, error) {
1819
Logc(ctx).Debug(">>>> lsblk_darwin.FindParentDevice")
1920
defer Logc(ctx).Debug("<<<< lsblk_darwin.FindParentDevice")
2021
return nil, errors.UnsupportedError("FindParentDevice is not supported for darwin")

utils/lsblk/lsblk_darwin_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ func TestFindParentDevice(t *testing.T) {
2626
assert.Nil(t, devices)
2727
assert.Error(t, err)
2828
assert.Contains(t, err.Error(), "not supported")
29-
3029
}
30+
3131
func TestGetParentDeviceKname(t *testing.T) {
3232
ctrl := gomock.NewController(t)
3333
lsblk := NewLsblkUtilDetailed(mock_exec.NewMockCommand(ctrl))

utils/nvme/nvme_darwin.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ func (s *NVMeSubsystem) DisconnectSubsystemFromHost(ctx context.Context) error {
4747
}
4848

4949
func (nh *NVMeHandler) GetNVMeSubsystem(ctx context.Context, nqn string) (*NVMeSubsystem,
50-
error) {
50+
error,
51+
) {
5152
Logc(ctx).Debug(">>>> nvme_darwin.GetNVMeSubsystem")
5253
defer Logc(ctx).Debug("<<<< nvme_darwin.GetNVMeSubsystem")
5354
return &NVMeSubsystem{}, errors.UnsupportedError("GetNVMeSubsystem is not supported for darwin")

0 commit comments

Comments
 (0)