Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE-1096] Fix lint and unit test error for resolution to atl-22498 #1098

Merged
merged 3 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
eddiepavkovic marked this conversation as resolved.
Show resolved Hide resolved
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