mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-17 20:00:23 +00:00
cleanup: No use of variable validateEncryption
In the function validatePVCSnapshot(...), we don't need validateEncryption variable as we are passing kms value which can help us check the value of validateEncryption. Hence, we can avoid using that. Signed-off-by: Yati Padia <ypadia@redhat.com>
This commit is contained in:
parent
7b5c78ec7c
commit
21a400839f
@ -753,7 +753,7 @@ var _ = Describe("RBD", func() {
|
||||
By("create a PVC clone and bind it to an app", func() {
|
||||
// snapshot beta is only supported from v1.17+
|
||||
if k8sVersionGreaterEquals(f.ClientSet, 1, 17) {
|
||||
validatePVCSnapshot(defaultCloneCount, pvcPath, appPath, snapshotPath, pvcClonePath, appClonePath, "", false, f)
|
||||
validatePVCSnapshot(defaultCloneCount, pvcPath, appPath, snapshotPath, pvcClonePath, appClonePath, "", f)
|
||||
}
|
||||
})
|
||||
|
||||
@ -782,7 +782,7 @@ var _ = Describe("RBD", func() {
|
||||
e2elog.Failf("failed to create storageclass with error %v", err)
|
||||
}
|
||||
|
||||
validatePVCSnapshot(1, pvcPath, appPath, snapshotPath, pvcClonePath, appClonePath, "vault", true, f)
|
||||
validatePVCSnapshot(1, pvcPath, appPath, snapshotPath, pvcClonePath, appClonePath, "vault", f)
|
||||
|
||||
err = deleteResource(rbdExamplePath + "storageclass.yaml")
|
||||
if err != nil {
|
||||
|
10
e2e/utils.go
10
e2e/utils.go
@ -668,7 +668,7 @@ func validatePVCClone(totalCount int, sourcePvcPath, sourceAppPath, clonePvcPath
|
||||
}
|
||||
|
||||
// nolint:gocyclo,gocognit,nestif // reduce complexity
|
||||
func validatePVCSnapshot(totalCount int, pvcPath, appPath, snapshotPath, pvcClonePath, appClonePath, kms string, validateEncryption bool, f *framework.Framework) {
|
||||
func validatePVCSnapshot(totalCount int, pvcPath, appPath, snapshotPath, pvcClonePath, appClonePath, kms string, f *framework.Framework) {
|
||||
var wg sync.WaitGroup
|
||||
wgErrs := make([]error, totalCount)
|
||||
chErrs := make([]error, totalCount)
|
||||
@ -720,7 +720,7 @@ func validatePVCSnapshot(totalCount int, pvcPath, appPath, snapshotPath, pvcClon
|
||||
go func(w *sync.WaitGroup, n int, s v1beta1.VolumeSnapshot) {
|
||||
s.Name = fmt.Sprintf("%s%d", f.UniqueName, n)
|
||||
wgErrs[n] = createSnapshot(&s, deployTimeout)
|
||||
if wgErrs[n] == nil && validateEncryption {
|
||||
if wgErrs[n] == nil && kms != "" {
|
||||
if kmsIsVault(kms) || kms == vaultTokens {
|
||||
content, sErr := getVolumeSnapshotContent(s.Namespace, s.Name)
|
||||
if sErr != nil {
|
||||
@ -790,7 +790,7 @@ func validatePVCSnapshot(totalCount int, pvcPath, appPath, snapshotPath, pvcClon
|
||||
e2elog.Logf("checksum value didn't match. checksum=%s and checksumclone=%s", checkSum, checkSumClone)
|
||||
}
|
||||
}
|
||||
if wgErrs[n] == nil && validateEncryption {
|
||||
if wgErrs[n] == nil && kms != "" {
|
||||
wgErrs[n] = validateEncryptedPVC(f, &p, &a)
|
||||
}
|
||||
w.Done()
|
||||
@ -893,7 +893,7 @@ func validatePVCSnapshot(totalCount int, pvcPath, appPath, snapshotPath, pvcClon
|
||||
s.Name = fmt.Sprintf("%s%d", f.UniqueName, n)
|
||||
content := &v1beta1.VolumeSnapshotContent{}
|
||||
var err error
|
||||
if validateEncryption {
|
||||
if kms != "" {
|
||||
if kmsIsVault(kms) || kms == vaultTokens {
|
||||
content, err = getVolumeSnapshotContent(s.Namespace, s.Name)
|
||||
if err != nil {
|
||||
@ -903,7 +903,7 @@ func validatePVCSnapshot(totalCount int, pvcPath, appPath, snapshotPath, pvcClon
|
||||
}
|
||||
if wgErrs[n] == nil {
|
||||
wgErrs[n] = deleteSnapshot(&s, deployTimeout)
|
||||
if wgErrs[n] == nil && validateEncryption {
|
||||
if wgErrs[n] == nil && kms != "" {
|
||||
if kmsIsVault(kms) || kms == vaultTokens {
|
||||
// check passphrase deleted
|
||||
stdOut, _ := readVaultSecret(*content.Status.SnapshotHandle, kmsIsVault(kms), f)
|
||||
|
Loading…
Reference in New Issue
Block a user