diff --git a/.github/workflows/codespell.yaml b/.github/workflows/codespell.yaml index 62b99fe72..2fbd8cc7f 100644 --- a/.github/workflows/codespell.yaml +++ b/.github/workflows/codespell.yaml @@ -18,6 +18,15 @@ jobs: uses: codespell-project/actions-codespell@master with: skip: .git,*.png,*.jpg,*.svg,*.sum - ignore_words_list: aks,keyserver,atleast,dne,ser,ist,files',ba,dum,iam,te,parm,assigment + # aks: Amazon Kubernetes Service + # keyserver: flag to apt-key + # atleast: codespell wants to flag any 'AtLeast' method + # ser, ist: MIME types in pkg/operator/ceph/object/mime.go + # ba: daemon ID test in pkg/operator/k8sutil/name_test.go + # iam: Identity and Access Management, e.g., AWS IAM + # te: udev persistent naming test in pkg/daemon/ceph/osd/daemon_test.go + # parm: modinfo parameter + # assigment: inherited from K8s TopologySpreadConstraints dependency + ignore_words_list: aks,keyserver,atleast,ser,ist,ba,iam,te,parm,assigment check_filenames: true check_hidden: true diff --git a/pkg/operator/ceph/cluster/predicate_test.go b/pkg/operator/ceph/cluster/predicate_test.go index 8575ade35..aaec26afa 100644 --- a/pkg/operator/ceph/cluster/predicate_test.go +++ b/pkg/operator/ceph/cluster/predicate_test.go @@ -25,22 +25,18 @@ import ( ) func TestIsHotPlugCM(t *testing.T) { - dum := &cephv1.CephBlockPool{} + blockPool := &cephv1.CephBlockPool{} - b := isHotPlugCM(dum) - assert.False(t, b) + assert.False(t, isHotPlugCM(blockPool)) cm := &corev1.ConfigMap{} - b = isHotPlugCM(cm) - assert.False(t, b) + assert.False(t, isHotPlugCM(cm)) cm.Labels = map[string]string{ "foo": "bar", } - b = isHotPlugCM(cm) - assert.False(t, b) + assert.False(t, isHotPlugCM(cm)) cm.Labels["app"] = "rook-discover" - b = isHotPlugCM(cm) - assert.True(t, b) + assert.True(t, isHotPlugCM(cm)) } diff --git a/pkg/operator/ceph/cluster/watcher_test.go b/pkg/operator/ceph/cluster/watcher_test.go index e6b76615e..5bcb49210 100644 --- a/pkg/operator/ceph/cluster/watcher_test.go +++ b/pkg/operator/ceph/cluster/watcher_test.go @@ -37,7 +37,7 @@ func TestOnDeviceCMUpdate(t *testing.T) { capnslog.SetGlobalLogLevel(capnslog.DEBUG) os.Setenv("ROOK_LOG_LEVEL", "DEBUG") - dum := &corev1.Service{} + service := &corev1.Service{} ns := "rook-ceph" // Register operator types with the runtime scheme. s := scheme.Scheme @@ -63,7 +63,7 @@ func TestOnDeviceCMUpdate(t *testing.T) { clientCluster := newClientCluster(cl, ns, &clusterd.Context{}) // Dummy object - b := clientCluster.onDeviceCMUpdate(dum, dum) + b := clientCluster.onDeviceCMUpdate(service, service) assert.False(t, b) // No Data in the cm diff --git a/pkg/operator/ceph/controller/predicate_test.go b/pkg/operator/ceph/controller/predicate_test.go index 491e16d29..8609d6c41 100644 --- a/pkg/operator/ceph/controller/predicate_test.go +++ b/pkg/operator/ceph/controller/predicate_test.go @@ -138,81 +138,62 @@ func TestIsValidEvent(t *testing.T) { } func TestIsCanary(t *testing.T) { - dum := &cephv1.CephBlockPool{} + blockPool := &cephv1.CephBlockPool{} - b := isCanary(dum) - assert.False(t, b) + assert.False(t, isCanary(blockPool)) d := &appsv1.Deployment{} - b = isCanary(d) - assert.False(t, b) + assert.False(t, isCanary(d)) d.Labels = map[string]string{ "foo": "bar", } - b = isCanary(d) - assert.False(t, b) + assert.False(t, isCanary(d)) d.Labels["mon_canary"] = "true" - b = isCanary(d) - assert.True(t, b) + assert.True(t, isCanary(d)) } func TestIsCMToIgnoreOnUpdate(t *testing.T) { - dum := &cephv1.CephBlockPool{} - - b := isCMTConfigOverride(dum) - assert.False(t, b) + blockPool := &cephv1.CephBlockPool{} + assert.False(t, isCMTConfigOverride(blockPool)) cm := &corev1.ConfigMap{} - b = isCMTConfigOverride(cm) - assert.False(t, b) + assert.False(t, isCMTConfigOverride(cm)) cm.Name = "rook-ceph-mon-endpoints" - b = isCMTConfigOverride(cm) - assert.False(t, b) + assert.False(t, isCMTConfigOverride(cm)) cm.Name = "rook-config-override" - b = isCMTConfigOverride(cm) - assert.True(t, b) + assert.True(t, isCMTConfigOverride(cm)) } func TestIsCMToIgnoreOnDelete(t *testing.T) { - dum := &cephv1.CephBlockPool{} - - b := isCMToIgnoreOnDelete(dum) - assert.False(t, b) + blockPool := &cephv1.CephBlockPool{} + assert.False(t, isCMToIgnoreOnDelete(blockPool)) cm := &corev1.ConfigMap{} - b = isCMToIgnoreOnDelete(cm) - assert.False(t, b) + assert.False(t, isCMToIgnoreOnDelete(cm)) cm.Name = "rook-ceph-mon-endpoints" - b = isCMToIgnoreOnDelete(cm) - assert.False(t, b) + assert.False(t, isCMToIgnoreOnDelete(cm)) cm.Name = "rook-ceph-osd-minikube-status" - b = isCMToIgnoreOnDelete(cm) - assert.True(t, b) + assert.True(t, isCMToIgnoreOnDelete(cm)) } func TestIsSecretToIgnoreOnUpdate(t *testing.T) { - dum := &cephv1.CephBlockPool{} - - b := isSecretToIgnoreOnUpdate(dum) - assert.False(t, b) + blockPool := &cephv1.CephBlockPool{} + assert.False(t, isSecretToIgnoreOnUpdate(blockPool)) s := &corev1.Secret{} - b = isSecretToIgnoreOnUpdate(s) - assert.False(t, b) + assert.False(t, isSecretToIgnoreOnUpdate(s)) s.Name = "foo" - b = isSecretToIgnoreOnUpdate(s) - assert.False(t, b) + assert.False(t, isSecretToIgnoreOnUpdate(s)) s.Name = config.StoreName - b = isSecretToIgnoreOnUpdate(s) - assert.True(t, b) + assert.True(t, isSecretToIgnoreOnUpdate(s)) } func TestIsDoNotReconcile(t *testing.T) { diff --git a/pkg/operator/nfs/server.go b/pkg/operator/nfs/server.go index c25c8ec77..a61785c13 100644 --- a/pkg/operator/nfs/server.go +++ b/pkg/operator/nfs/server.go @@ -53,7 +53,7 @@ func Setup(ganeshaConfig string) error { err := setRlimitNOFILE() if err != nil { - logger.Warningf("Error setting RLIMIT_NOFILE, there may be 'Too many open files' errors later: %v", err) + logger.Warningf("Error setting RLIMIT_NOFILE, there may be \"Too many open files\" errors later: %v", err) } return nil } diff --git a/pkg/operator/test/volumes_test.go b/pkg/operator/test/volumes_test.go index 1b6eeb6ce..4680e8cb8 100644 --- a/pkg/operator/test/volumes_test.go +++ b/pkg/operator/test/volumes_test.go @@ -19,7 +19,7 @@ package test import ( "testing" - "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" ) func TestVolumeExists(t *testing.T) { @@ -34,7 +34,7 @@ func TestVolumeExists(t *testing.T) { wantErr bool }{ {"exists", args{"d", vols}, false}, - {"dne", args{"c", vols}, true}, + {"does-not-exist", args{"c", vols}, true}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { @@ -122,7 +122,7 @@ func TestVolumeMountExists(t *testing.T) { wantErr bool }{ {"exists", args{"d", mounts}, false}, - {"dne", args{"c", mounts}, true}, + {"does-not-exist", args{"c", mounts}, true}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) {