mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-18 11:00:25 +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() {
|
By("create a PVC clone and bind it to an app", func() {
|
||||||
// snapshot beta is only supported from v1.17+
|
// snapshot beta is only supported from v1.17+
|
||||||
if k8sVersionGreaterEquals(f.ClientSet, 1, 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)
|
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")
|
err = deleteResource(rbdExamplePath + "storageclass.yaml")
|
||||||
if err != nil {
|
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
|
// 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
|
var wg sync.WaitGroup
|
||||||
wgErrs := make([]error, totalCount)
|
wgErrs := make([]error, totalCount)
|
||||||
chErrs := 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) {
|
go func(w *sync.WaitGroup, n int, s v1beta1.VolumeSnapshot) {
|
||||||
s.Name = fmt.Sprintf("%s%d", f.UniqueName, n)
|
s.Name = fmt.Sprintf("%s%d", f.UniqueName, n)
|
||||||
wgErrs[n] = createSnapshot(&s, deployTimeout)
|
wgErrs[n] = createSnapshot(&s, deployTimeout)
|
||||||
if wgErrs[n] == nil && validateEncryption {
|
if wgErrs[n] == nil && kms != "" {
|
||||||
if kmsIsVault(kms) || kms == vaultTokens {
|
if kmsIsVault(kms) || kms == vaultTokens {
|
||||||
content, sErr := getVolumeSnapshotContent(s.Namespace, s.Name)
|
content, sErr := getVolumeSnapshotContent(s.Namespace, s.Name)
|
||||||
if sErr != nil {
|
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)
|
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)
|
wgErrs[n] = validateEncryptedPVC(f, &p, &a)
|
||||||
}
|
}
|
||||||
w.Done()
|
w.Done()
|
||||||
@ -893,7 +893,7 @@ func validatePVCSnapshot(totalCount int, pvcPath, appPath, snapshotPath, pvcClon
|
|||||||
s.Name = fmt.Sprintf("%s%d", f.UniqueName, n)
|
s.Name = fmt.Sprintf("%s%d", f.UniqueName, n)
|
||||||
content := &v1beta1.VolumeSnapshotContent{}
|
content := &v1beta1.VolumeSnapshotContent{}
|
||||||
var err error
|
var err error
|
||||||
if validateEncryption {
|
if kms != "" {
|
||||||
if kmsIsVault(kms) || kms == vaultTokens {
|
if kmsIsVault(kms) || kms == vaultTokens {
|
||||||
content, err = getVolumeSnapshotContent(s.Namespace, s.Name)
|
content, err = getVolumeSnapshotContent(s.Namespace, s.Name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -903,7 +903,7 @@ func validatePVCSnapshot(totalCount int, pvcPath, appPath, snapshotPath, pvcClon
|
|||||||
}
|
}
|
||||||
if wgErrs[n] == nil {
|
if wgErrs[n] == nil {
|
||||||
wgErrs[n] = deleteSnapshot(&s, deployTimeout)
|
wgErrs[n] = deleteSnapshot(&s, deployTimeout)
|
||||||
if wgErrs[n] == nil && validateEncryption {
|
if wgErrs[n] == nil && kms != "" {
|
||||||
if kmsIsVault(kms) || kms == vaultTokens {
|
if kmsIsVault(kms) || kms == vaultTokens {
|
||||||
// check passphrase deleted
|
// check passphrase deleted
|
||||||
stdOut, _ := readVaultSecret(*content.Status.SnapshotHandle, kmsIsVault(kms), f)
|
stdOut, _ := readVaultSecret(*content.Status.SnapshotHandle, kmsIsVault(kms), f)
|
||||||
|
Loading…
Reference in New Issue
Block a user