Skip to content

Commit

Permalink
[ISSUE-1096] Fix lint and unit test error for resolution to atl-22498 (
Browse files Browse the repository at this point in the history
…#1098)

* [Issue #1096] - Fix lint error for bug atl-22498

Signed-off-by: Eddie Pavkovic <[email protected]>

* [Issue #1096] - Put code back that returned device if path set
- to fix unit test

Signed-off-by: Eddie Pavkovic <[email protected]>

* [ISSUE-1096] - Put back code from previous PR and removed invalid test case

Signed-off-by: Eddie Pavkovic <[email protected]>

---------

Signed-off-by: Eddie Pavkovic <[email protected]>
  • Loading branch information
eddiepavkovic authored Feb 26, 2024
1 parent b201abe commit c0ea32c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
3 changes: 1 addition & 2 deletions pkg/base/linuxutils/lsblk/lsblk.go
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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("")
Expand Down
10 changes: 1 addition & 9 deletions pkg/base/linuxutils/lsblk/lsblk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
}
Expand Down

0 comments on commit c0ea32c

Please sign in to comment.