update capability_controller.go, make sure that annotations is generated correctly.StorageClass without csiDriver will no longer generate false annotations.

Signed-off-by: f10atin9 <f10atin9@kubesphere.io>
This commit is contained in:
f10atin9
2021-09-27 16:42:19 +08:00
parent 15205cbc40
commit be5421f00b
2 changed files with 37 additions and 9 deletions

View File

@@ -270,3 +270,22 @@ func TestStorageClassHadOneAnnotation(t *testing.T) {
// Run test
fixture.run(getKey(storageClass, t))
}
func TestStorageClassHadNoCSIDriver(t *testing.T) {
fixture := newFixture(t, true)
storageClass := newStorageClass("csi-example", "csi.example.com")
storageClass.Annotations = map[string]string{}
storageClassUpdate := storageClass.DeepCopy()
storageClass.Annotations = map[string]string{annotationAllowSnapshot: "false"}
storageClass.Annotations = map[string]string{annotationAllowClone: "false"}
// Object exist
fixture.storageObjects = append(fixture.storageObjects, storageClass)
fixture.storageClassLister = append(fixture.storageClassLister, storageClass)
// Action expected
fixture.expectUpdateStorageClassAction(storageClassUpdate)
// Run test
fixture.run(getKey(storageClass, t))
}