Skip to content

Commit

Permalink
Update goscaleio version (#164)
Browse files Browse the repository at this point in the history
* update version

* fix linting

* fix linting

* fix lint

* add back copyright

* add back copyright

* add back copyright
  • Loading branch information
xuluna authored Mar 4, 2024
1 parent c9c181f commit e1e876f
Show file tree
Hide file tree
Showing 18 changed files with 53 additions and 133 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/linters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
name: golangci-lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22"
cache: false
Expand All @@ -24,7 +24,7 @@ jobs:
run: |
go mod vendor
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v4
with:
version: v1.53
version: latest
skip-cache: true
4 changes: 2 additions & 2 deletions cmd/metrics-powerflex/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func main() {
updateService(pflexSvc, logger)

viper.WatchConfig()
viper.OnConfigChange(func(e fsnotify.Event) {
viper.OnConfigChange(func(_ fsnotify.Event) {
updateLoggingSettings(logger)
updateCollectorAddress(config, exporter, logger)
updateProvisionerNames(sdcFinder, storageClassFinder, volumeFinder, logger)
Expand All @@ -143,7 +143,7 @@ func main() {
})

configFileListener.WatchConfig()
configFileListener.OnConfigChange(func(e fsnotify.Event) {
configFileListener.OnConfigChange(func(_ fsnotify.Event) {
updatePowerFlexConnection(config, sdcFinder, storageClassFinder, volumeFinder, logger)
})

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/dell/karavi-metrics-powerflex
go 1.22

require (
github.com/dell/goscaleio v1.13.0
github.com/dell/goscaleio v1.14.0
github.com/fsnotify/fsnotify v1.6.0
github.com/golang/mock v1.6.0
github.com/sirupsen/logrus v1.9.3
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dell/goscaleio v1.13.0 h1:L9hXj+teAE/nLZyN02OMHYSJkAkVAlngy7QYEB5aOT4=
github.com/dell/goscaleio v1.13.0/go.mod h1:dt4Xy5Pnx8MEBza+ODOKiwNFBipcnzEXWgTnFy0+jTw=
github.com/dell/goscaleio v1.14.0 h1:oMfxKQRKLntaDJxWEz/si2CzqVbYOv1fFQ39bTb/VpQ=
github.com/dell/goscaleio v1.14.0/go.mod h1:h7SCmReARG/szFWBMQGETGkZObknhS45lQipQbtdmJ8=
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE=
github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc=
github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
Expand Down
34 changes: 17 additions & 17 deletions internal/k8s/k8sapi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,19 @@ func Test_GetCSINodes(t *testing.T) {
type configFn func() (*rest.Config, error)
check := func(fns ...checkFn) []checkFn { return fns }

hasNoError := func(t *testing.T, nodes *v1.CSINodeList, err error) {
hasNoError := func(t *testing.T, _ *v1.CSINodeList, err error) {
if err != nil {
t.Fatalf("expected no error")
}
}

checkExpectedOutput := func(expectedOutput *v1.CSINodeList) func(t *testing.T, nodes *v1.CSINodeList, err error) {
return func(t *testing.T, nodes *v1.CSINodeList, err error) {
return func(t *testing.T, nodes *v1.CSINodeList, _ error) {
assert.Equal(t, expectedOutput, nodes)
}
}

hasError := func(t *testing.T, nodes *v1.CSINodeList, err error) {
hasError := func(t *testing.T, _ *v1.CSINodeList, err error) {
if err == nil {
t.Fatalf("expected error")
}
Expand Down Expand Up @@ -84,7 +84,7 @@ func Test_GetCSINodes(t *testing.T) {
return connect, nil, check(hasNoError, checkExpectedOutput(nodes))
},
"error connecting": func(*testing.T) (connectFn, configFn, []checkFn) {
connect := func(api *k8s.API) error {
connect := func(_ *k8s.API) error {
return errors.New("error")
}
return connect, nil, check(hasError)
Expand Down Expand Up @@ -125,19 +125,19 @@ func Test_GetPersistentVolumes(t *testing.T) {
type configFn func() (*rest.Config, error)
check := func(fns ...checkFn) []checkFn { return fns }

hasNoError := func(t *testing.T, volumes *corev1.PersistentVolumeList, err error) {
hasNoError := func(t *testing.T, _ *corev1.PersistentVolumeList, err error) {
if err != nil {
t.Fatalf("expected no error")
}
}

checkExpectedOutput := func(expectedOutput *corev1.PersistentVolumeList) func(t *testing.T, volumes *corev1.PersistentVolumeList, err error) {
return func(t *testing.T, volumes *corev1.PersistentVolumeList, err error) {
return func(t *testing.T, volumes *corev1.PersistentVolumeList, _ error) {
assert.Equal(t, expectedOutput, volumes)
}
}

hasError := func(t *testing.T, volumes *corev1.PersistentVolumeList, err error) {
hasError := func(t *testing.T, _ *corev1.PersistentVolumeList, err error) {
if err == nil {
t.Fatalf("expected error")
}
Expand All @@ -161,7 +161,7 @@ func Test_GetPersistentVolumes(t *testing.T) {
return connect, nil, check(hasNoError, checkExpectedOutput(volumes))
},
"error connecting": func(*testing.T) (connectFn, configFn, []checkFn) {
connect := func(api *k8s.API) error {
connect := func(_ *k8s.API) error {
return errors.New("error")
}
return connect, nil, check(hasError)
Expand Down Expand Up @@ -201,19 +201,19 @@ func Test_GetStorageClasses(t *testing.T) {
type configFn func() (*rest.Config, error)
check := func(fns ...checkFn) []checkFn { return fns }

hasNoError := func(t *testing.T, volumes *v1.StorageClassList, err error) {
hasNoError := func(t *testing.T, _ *v1.StorageClassList, err error) {
if err != nil {
t.Fatalf("expected no error")
}
}

checkExpectedOutput := func(expectedOutput *v1.StorageClassList) func(t *testing.T, volumes *v1.StorageClassList, err error) {
return func(t *testing.T, volumes *v1.StorageClassList, err error) {
return func(t *testing.T, volumes *v1.StorageClassList, _ error) {
assert.Equal(t, expectedOutput, volumes)
}
}

hasError := func(t *testing.T, volumes *v1.StorageClassList, err error) {
hasError := func(t *testing.T, _ *v1.StorageClassList, err error) {
if err == nil {
t.Fatalf("expected error")
}
Expand Down Expand Up @@ -242,7 +242,7 @@ func Test_GetStorageClasses(t *testing.T) {
return connect, nil, check(hasNoError, checkExpectedOutput(storageClasses))
},
"error connecting": func(*testing.T) (connectFn, configFn, []checkFn) {
connect := func(api *k8s.API) error {
connect := func(_ *k8s.API) error {
return errors.New("error")
}
return connect, nil, check(hasError)
Expand Down Expand Up @@ -282,19 +282,19 @@ func Test_GetNodes(t *testing.T) {
type configFn func() (*rest.Config, error)
check := func(fns ...checkFn) []checkFn { return fns }

hasNoError := func(t *testing.T, nodes *corev1.NodeList, err error) {
hasNoError := func(t *testing.T, _ *corev1.NodeList, err error) {
if err != nil {
t.Fatalf("expected no error")
}
}

checkExpectedOutput := func(expectedOutput *corev1.NodeList) func(t *testing.T, nodes *corev1.NodeList, err error) {
return func(t *testing.T, nodes *corev1.NodeList, err error) {
return func(t *testing.T, nodes *corev1.NodeList, _ error) {
assert.Equal(t, expectedOutput, nodes)
}
}

hasError := func(t *testing.T, nodes *corev1.NodeList, err error) {
hasError := func(t *testing.T, _ *corev1.NodeList, err error) {
if err == nil {
t.Fatalf("expected error")
}
Expand All @@ -319,7 +319,7 @@ func Test_GetNodes(t *testing.T) {
return connect, nil, check(hasNoError, checkExpectedOutput(nodes))
},
"error connecting": func(*testing.T) (connectFn, configFn, []checkFn) {
connect := func(api *k8s.API) error {
connect := func(_ *k8s.API) error {
return errors.New("error")
}
return connect, nil, check(hasError)
Expand Down Expand Up @@ -372,7 +372,7 @@ func Test_NewForConfigError(t *testing.T) {
oldNewConfigFn := k8s.NewConfigFn
defer func() { k8s.NewConfigFn = oldNewConfigFn }()
expected := "could not create Clientset from KubeConfig"
k8s.NewConfigFn = func(config *rest.Config) (*kubernetes.Clientset, error) {
k8s.NewConfigFn = func(_ *rest.Config) (*kubernetes.Clientset, error) {
return nil, fmt.Errorf(expected)
}

Expand Down
2 changes: 1 addition & 1 deletion internal/k8s/leader_elector.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (elect *LeaderElector) InitLeaderElection(endpoint string, namespace string
Callbacks: leaderelection.LeaderCallbacks{
OnStartedLeading: func(context.Context) {},
OnStoppedLeading: func() {},
OnNewLeader: func(identity string) {},
OnNewLeader: func(_ string) {},
},
Lock: &resourcelock.EndpointsLock{
EndpointsMeta: metav1.ObjectMeta{
Expand Down
6 changes: 3 additions & 3 deletions internal/k8s/leader_elector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func Test_InitLeaderElection(t *testing.T) {
return nil, nil
}

clientset := func(config *rest.Config) (*kubernetes.Clientset, error) {
clientset := func(_ *rest.Config) (*kubernetes.Clientset, error) {
return nil, errors.New("error")
}

Expand All @@ -64,11 +64,11 @@ func Test_InitLeaderElection(t *testing.T) {
return nil, nil
}

clientset := func(config *rest.Config) (*kubernetes.Clientset, error) {
clientset := func(_ *rest.Config) (*kubernetes.Clientset, error) {
mockClientset := &kubernetes.Clientset{}
return mockClientset, nil
}
leaderelection := func(lec leaderelection.LeaderElectionConfig) (*leaderelection.LeaderElector, error) {
leaderelection := func(_ leaderelection.LeaderElectionConfig) (*leaderelection.LeaderElector, error) {
return nil, errors.New("error")
}
return configFn, clientset, leaderelection, check(hasError)
Expand Down
16 changes: 0 additions & 16 deletions internal/k8s/mocks/kubernetes_api_mocks.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 0 additions & 16 deletions internal/k8s/mocks/leader_elector_getter_mocks.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 0 additions & 16 deletions internal/k8s/mocks/node_getter_mocks.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 0 additions & 16 deletions internal/k8s/mocks/storage_class_getter_mocks.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 0 additions & 16 deletions internal/k8s/mocks/volume_getter_mocks.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions internal/k8s/node_finder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@ func Test_K8sNodeFinder(t *testing.T) {
type checkFn func(*testing.T, []corev1.Node, error)
check := func(fns ...checkFn) []checkFn { return fns }

hasNoError := func(t *testing.T, nodes []corev1.Node, err error) {
hasNoError := func(t *testing.T, _ []corev1.Node, err error) {
if err != nil {
t.Fatalf("expected no error")
}
}

checkExpectedOutput := func(expectedOutput []corev1.Node) func(t *testing.T, nodes []corev1.Node, err error) {
return func(t *testing.T, nodes []corev1.Node, err error) {
return func(t *testing.T, nodes []corev1.Node, _ error) {
assert.Equal(t, expectedOutput, nodes)
}
}

hasError := func(t *testing.T, nodes []corev1.Node, err error) {
hasError := func(t *testing.T, _ []corev1.Node, err error) {
if err == nil {
t.Fatalf("expected error")
}
Expand Down
6 changes: 3 additions & 3 deletions internal/k8s/sdc_finder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@ func Test_K8sSDCFinder(t *testing.T) {
type checkFn func(*testing.T, []string, error)
check := func(fns ...checkFn) []checkFn { return fns }

hasNoError := func(t *testing.T, sdcGuids []string, err error) {
hasNoError := func(t *testing.T, _ []string, err error) {
if err != nil {
t.Fatalf("expected no error")
}
}

checkExpectedOutput := func(expectedOutput []string) func(t *testing.T, sdcGuids []string, err error) {
return func(t *testing.T, sdcGuids []string, err error) {
return func(t *testing.T, sdcGuids []string, _ error) {
assert.Equal(t, expectedOutput, sdcGuids)
}
}

hasError := func(t *testing.T, sdcGuids []string, err error) {
hasError := func(t *testing.T, _ []string, err error) {
if err == nil {
t.Fatalf("expected error")
}
Expand Down
6 changes: 3 additions & 3 deletions internal/k8s/storageclass_finder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@ func Test_K8sStorageClassFinder(t *testing.T) {
type checkFn func(*testing.T, []v1.StorageClass, error)
check := func(fns ...checkFn) []checkFn { return fns }

hasNoError := func(t *testing.T, storageClasses []v1.StorageClass, err error) {
hasNoError := func(t *testing.T, _ []v1.StorageClass, err error) {
if err != nil {
t.Fatalf("expected no error")
}
}

checkExpectedOutput := func(expectedOutput []v1.StorageClass) func(t *testing.T, storageClasses []v1.StorageClass, err error) {
return func(t *testing.T, storageClasses []v1.StorageClass, err error) {
return func(t *testing.T, storageClasses []v1.StorageClass, _ error) {
assert.Equal(t, expectedOutput, storageClasses)
}
}

hasError := func(t *testing.T, volumes []v1.StorageClass, err error) {
hasError := func(t *testing.T, _ []v1.StorageClass, err error) {
if err == nil {
t.Fatalf("expected error")
}
Expand Down
Loading

0 comments on commit e1e876f

Please sign in to comment.