Merge pull request #7493 from BlaineEXE/codespell-tidy

test: document or clean up codespell flags
This commit is contained in:
Blaine Gardner authored and GitHub committed 2021-03-29 10:07:53 -06:00
commit 660d2fe442
6 files changed
+41 -55

No files matched your search

+10 -1
View File
@@ -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
+5 -9
View File
@@ -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))
}
+2 -2
View File
@@ -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
+20 -39
View File
@@ -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) {
+1 -1
View File
@@ -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
}
+3 -3
View File
@@ -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) {