diff --git a/pkg/base/linuxutils/lsblk/lsblk.go b/pkg/base/linuxutils/lsblk/lsblk.go index ac49f0b94..604a60d96 100644 --- a/pkg/base/linuxutils/lsblk/lsblk.go +++ b/pkg/base/linuxutils/lsblk/lsblk.go @@ -1,5 +1,5 @@ /* -Copyright © 2020 Dell Inc. or its subsidiaries. All Rights Reserved. +Copyright © 2020-2024 Dell Inc. or its subsidiaries. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -161,7 +161,6 @@ func (l *LSBLK) GetBlockDevices(device string) ([]BlockDevice, error) { // Receives an instance of drivecrd.Drive struct // Returns drive's path based on provided drivecrd.Drive or error if something went wrong func (l *LSBLK) SearchDrivePath(drive *api.Drive) (string, error) { - device := "" // try to find it with lsblk lsblkOut, err := l.GetBlockDevices("") diff --git a/pkg/base/linuxutils/lsblk/lsblk_test.go b/pkg/base/linuxutils/lsblk/lsblk_test.go index 8af5a93d9..71f191ca1 100644 --- a/pkg/base/linuxutils/lsblk/lsblk_test.go +++ b/pkg/base/linuxutils/lsblk/lsblk_test.go @@ -84,14 +84,6 @@ func TestLSBLK_SearchDrivePath_Success(t *testing.T) { e := &mocks.GoMockExecutor{} l := NewLSBLK(testLogger) l.e = e - // path is in drive spec - dCR := testDriveCR - path := "/dev/sda" - dCR.Spec.Path = path - - res, err := l.SearchDrivePath(&dCR.Spec) - assert.Nil(t, err) - assert.Equal(t, path, res) // got from lsblk output e.On("RunCmd", allDevicesCmd).Return(mocks.LsblkTwoDevicesStr, "", nil) @@ -100,7 +92,7 @@ func TestLSBLK_SearchDrivePath_Success(t *testing.T) { d2CR := testDriveCR d2CR.Spec.SerialNumber = sn - res, err = l.SearchDrivePath(&d2CR.Spec) + res, err := l.SearchDrivePath(&d2CR.Spec) assert.Nil(t, err) assert.Equal(t, expectedDevice, res) }