Skip to content

Commit 5b06bf4

Browse files
CON-3225: Fix the new lint failures seen in csi-driver (#434)
Signed-off-by: Rohit Balakrishna <rohit.balakrishna@hpe.com>
1 parent 9f4b7d4 commit 5b06bf4

File tree

3 files changed

+39
-39
lines changed

3 files changed

+39
-39
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
NAME = csi-driver
22
COVER_PROFILE := $(NAME).cov
33

4-
CI_MINIMUM_TEST_COVERAGE := 8
4+
CI_MINIMUM_TEST_COVERAGE := 29
55
TEST_MODULES := ./...
66

77
GO := go

pkg/driver/driver_test.go

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
package driver
33

44
import (
5-
// "os"
5+
"os"
66
"strconv"
77
"sync"
88
"testing"
@@ -13,12 +13,12 @@ import (
1313

1414
"github.com/container-storage-interface/spec/lib/go/csi"
1515
"github.com/hpe-storage/common-host-libs/chapi"
16-
// log "github.com/hpe-storage/common-host-libs/logger"
16+
log "github.com/hpe-storage/common-host-libs/logger"
1717
"github.com/hpe-storage/common-host-libs/storageprovider"
1818
"github.com/hpe-storage/common-host-libs/storageprovider/fake"
1919
"github.com/hpe-storage/csi-driver/pkg/flavor"
2020
"github.com/hpe-storage/csi-driver/pkg/flavor/vanilla"
21-
// "github.com/kubernetes-csi/csi-test/pkg/sanity"
21+
"github.com/kubernetes-csi/csi-test/pkg/sanity"
2222
)
2323

2424
const (
@@ -28,40 +28,39 @@ const (
2828
testCount int = 500
2929
)
3030

31-
/*
32-
func TestPluginSuite(t *testing.T) {
33-
endpoint := "unix://" + testsocket
34-
if err := os.Remove(testsocket); err != nil && !os.IsNotExist(err) {
35-
t.Fatalf("failed to remove unix domain socket file %s, error: %s", testsocket, err)
36-
}
37-
38-
log.InitLogging("csi-test.log", &log.LogParams{Level: "trace"}, false)
39-
40-
// driver := realDriver(t, endpoint)
41-
// secretsFile := "csi-secrets.yaml"
42-
driver := fakeDriver(endpoint)
43-
secretsFile := "fake-csi-secrets.yaml"
44-
driver.grpc = NewNonBlockingGRPCServer()
45-
// start node, controller and identity servers on same endpoint for tests
46-
go driver.grpc.Start(driver.endpoint, driver, driver, driver)
47-
defer driver.Stop(true)
48-
49-
stagingPath := "./csi-mnt"
50-
targetPath := "./csi-mnt-stage"
51-
os.RemoveAll(stagingPath)
52-
os.RemoveAll(targetPath)
53-
54-
config := &sanity.Config{
55-
StagingPath: stagingPath,
56-
TargetPath: targetPath,
57-
Address: endpoint,
58-
SecretsFile: secretsFile,
59-
CreateTargetDir: createTarget,
60-
}
61-
62-
sanity.Test(t, config)
31+
func TestPluginSuite(t *testing.T) {
32+
endpoint := "unix://" + testsocket
33+
if err := os.Remove(testsocket); err != nil && !os.IsNotExist(err) {
34+
t.Fatalf("failed to remove unix domain socket file %s, error: %s", testsocket, err)
6335
}
64-
*/
36+
37+
log.InitLogging("csi-test.log", &log.LogParams{Level: "trace"}, false)
38+
39+
//driver := realDriver(t, endpoint)
40+
//secretsFile := "csi-secrets.yaml"
41+
driver := fakeDriver(endpoint)
42+
secretsFile := "fake-csi-secrets.yaml"
43+
driver.grpc = NewNonBlockingGRPCServer()
44+
// start node, controller and identity servers on same endpoint for tests
45+
go driver.grpc.Start(driver.endpoint, driver, driver, driver)
46+
defer driver.Stop(true)
47+
48+
stagingPath := "./csi-mnt"
49+
targetPath := "./csi-mnt-stage"
50+
os.RemoveAll(stagingPath)
51+
os.RemoveAll(targetPath)
52+
53+
config := &sanity.Config{
54+
StagingPath: stagingPath,
55+
TargetPath: targetPath,
56+
Address: endpoint,
57+
SecretsFile: secretsFile,
58+
CreateTargetDir: createTarget,
59+
}
60+
61+
sanity.Test(t, config)
62+
}
63+
6564
func createTarget(_ string) (string, error) {
6665
return "./csi-mnt-stage", nil
6766
}

pkg/flavor/vanilla/flavor.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import (
1010
"github.com/hpe-storage/common-host-libs/model"
1111
"google.golang.org/grpc/codes"
1212
"google.golang.org/grpc/status"
13-
storage_v1 "k8s.io/api/storage/v1"
1413
v1 "k8s.io/api/core/v1"
14+
storage_v1 "k8s.io/api/storage/v1"
1515
"k8s.io/apimachinery/pkg/version"
1616
)
1717

@@ -150,6 +150,7 @@ func (flavor *Flavor) CheckConnection() bool {
150150
return false
151151
}
152152

153-
func (flavor *Flavor) GetPVCByName(name string, namespace string) (*v1.PersistentVolumeClaim , error) {
153+
//nolint:revive
154+
func (flavor *Flavor) GetPVCByName(name string, namespace string) (*v1.PersistentVolumeClaim, error) {
154155
return nil, nil
155156
}

0 commit comments

Comments
 (0)