e2e: Add helper to run encryption tests on block and file

Add a `By` wrapper to parameterize encryption related test functions
and run them on both block and file encryption

Signed-off-by: Marcel Lauhoff <marcel.lauhoff@suse.com>
This commit is contained in:
Marcel Lauhoff 2022-07-13 17:59:10 +02:00 committed by mergify[bot]
parent cec88a7bff
commit 0f626b705a
2 changed files with 11 additions and 0 deletions

View File

@ -232,6 +232,15 @@ func checkClusternameInMetadata(f *framework.Framework, ns, pool, image string)
}
}
// ByFileAndBlockEncryption wraps ginkgo's By to run the test body using file and block encryption specific validators.
func ByFileAndBlockEncryption(
text string,
callback func(validator encryptionValidateFunc, encryptionType string),
) {
By(text+" (block)", func() { callback(validateEncryptedPVCAndAppBinding, "block") })
By(text+" (file)", func() { callback(validateEncryptedFilesystemAndAppBinding, "file") })
}
var _ = Describe("RBD", func() {
f := framework.NewDefaultFramework(rbdType)
var c clientset.Interface

View File

@ -482,6 +482,8 @@ func validateCloneInDifferentPool(f *framework.Framework, snapshotPool, cloneSc,
return nil
}
type encryptionValidateFunc func(pvcPath, appPath string, kms kmsConfig, f *framework.Framework) error
func validateEncryptedPVCAndAppBinding(pvcPath, appPath string, kms kmsConfig, f *framework.Framework) error {
pvc, app, err := createPVCAndAppBinding(pvcPath, appPath, f, deployTimeout)
if err != nil {