e2e: Apply formatting to rbd suite and helper

Apply formatting for previous changes separately to make the commit
diffs easier to read.

Signed-off-by: Marcel Lauhoff <marcel.lauhoff@suse.com>
This commit is contained in:
Marcel Lauhoff 2022-08-24 10:35:49 +02:00 committed by mergify[bot]
parent 9ad4bb1de5
commit eae5b80298
2 changed files with 62 additions and 44 deletions

View File

@ -1882,7 +1882,8 @@ var _ = Describe("RBD", func() {
}) })
ByFileAndBlockEncryption("create a PVC and bind it to an app using rbd-nbd mounter with encryption", func( ByFileAndBlockEncryption("create a PVC and bind it to an app using rbd-nbd mounter with encryption", func(
validator encryptionValidateFunc, _ validateFunc, encType string) { validator encryptionValidateFunc, _ validateFunc, encType string,
) {
if !testNBD { if !testNBD {
e2elog.Logf("skipping NBD test") e2elog.Logf("skipping NBD test")
@ -1961,7 +1962,8 @@ var _ = Describe("RBD", func() {
}) })
ByFileAndBlockEncryption("Resize Encrypted Block PVC and check Device size", func( ByFileAndBlockEncryption("Resize Encrypted Block PVC and check Device size", func(
validator encryptionValidateFunc, _ validateFunc, encType string) { validator encryptionValidateFunc, _ validateFunc, encType string,
) {
err := deleteResource(rbdExamplePath + "storageclass.yaml") err := deleteResource(rbdExamplePath + "storageclass.yaml")
if err != nil { if err != nil {
e2elog.Failf("failed to delete storageclass: %v", err) e2elog.Failf("failed to delete storageclass: %v", err)
@ -2007,7 +2009,8 @@ var _ = Describe("RBD", func() {
}) })
ByFileAndBlockEncryption("create a PVC and bind it to an app with encrypted RBD volume with VaultKMS", func( ByFileAndBlockEncryption("create a PVC and bind it to an app with encrypted RBD volume with VaultKMS", func(
validator encryptionValidateFunc, _ validateFunc, encType string) { validator encryptionValidateFunc, _ validateFunc, encType string,
) {
err := deleteResource(rbdExamplePath + "storageclass.yaml") err := deleteResource(rbdExamplePath + "storageclass.yaml")
if err != nil { if err != nil {
e2elog.Failf("failed to delete storageclass: %v", err) e2elog.Failf("failed to delete storageclass: %v", err)
@ -2039,7 +2042,8 @@ var _ = Describe("RBD", func() {
}) })
ByFileAndBlockEncryption("create a PVC and bind it to an app with encrypted RBD volume with VaultTokensKMS", func( ByFileAndBlockEncryption("create a PVC and bind it to an app with encrypted RBD volume with VaultTokensKMS", func(
validator encryptionValidateFunc, _ validateFunc, encType string) { validator encryptionValidateFunc, _ validateFunc, encType string,
) {
err := deleteResource(rbdExamplePath + "storageclass.yaml") err := deleteResource(rbdExamplePath + "storageclass.yaml")
if err != nil { if err != nil {
e2elog.Failf("failed to delete storageclass: %v", err) e2elog.Failf("failed to delete storageclass: %v", err)
@ -2092,7 +2096,8 @@ var _ = Describe("RBD", func() {
}) })
ByFileAndBlockEncryption("create a PVC and bind it to an app with encrypted RBD volume with VaultTenantSA KMS", func( ByFileAndBlockEncryption("create a PVC and bind it to an app with encrypted RBD volume with VaultTenantSA KMS", func(
validator encryptionValidateFunc, _ validateFunc, encType string) { validator encryptionValidateFunc, _ validateFunc, encType string,
) {
err := deleteResource(rbdExamplePath + "storageclass.yaml") err := deleteResource(rbdExamplePath + "storageclass.yaml")
if err != nil { if err != nil {
e2elog.Failf("failed to delete storageclass: %v", err) e2elog.Failf("failed to delete storageclass: %v", err)
@ -2130,8 +2135,8 @@ var _ = Describe("RBD", func() {
} }
}) })
ByFileAndBlockEncryption("create a PVC and bind it to an app with encrypted RBD volume with SecretsMetadataKMS", func( ByFileAndBlockEncryption("create a PVC and bind it to an app with encrypted RBD volume with SecretsMetadataKMS",
validator encryptionValidateFunc, _ validateFunc, encType string) { func(validator encryptionValidateFunc, _ validateFunc, encType string) {
err := deleteResource(rbdExamplePath + "storageclass.yaml") err := deleteResource(rbdExamplePath + "storageclass.yaml")
if err != nil { if err != nil {
e2elog.Failf("failed to delete storageclass: %v", err) e2elog.Failf("failed to delete storageclass: %v", err)
@ -2163,7 +2168,8 @@ var _ = Describe("RBD", func() {
}) })
ByFileAndBlockEncryption("test RBD volume encryption with user secrets based SecretsMetadataKMS", func( ByFileAndBlockEncryption("test RBD volume encryption with user secrets based SecretsMetadataKMS", func(
validator encryptionValidateFunc, _ validateFunc, encType string) { validator encryptionValidateFunc, _ validateFunc, encType string,
) {
err := deleteResource(rbdExamplePath + "storageclass.yaml") err := deleteResource(rbdExamplePath + "storageclass.yaml")
if err != nil { if err != nil {
e2elog.Failf("failed to delete storageclass: %v", err) e2elog.Failf("failed to delete storageclass: %v", err)
@ -2343,7 +2349,8 @@ var _ = Describe("RBD", func() {
}) })
ByFileAndBlockEncryption("create an encrypted PVC snapshot and restore it for an app with VaultKMS", func( ByFileAndBlockEncryption("create an encrypted PVC snapshot and restore it for an app with VaultKMS", func(
validator encryptionValidateFunc, isEncryptedPVC validateFunc, encType string) { validator encryptionValidateFunc, isEncryptedPVC validateFunc, encType string,
) {
err := deleteResource(rbdExamplePath + "storageclass.yaml") err := deleteResource(rbdExamplePath + "storageclass.yaml")
if err != nil { if err != nil {
e2elog.Failf("failed to delete storageclass: %v", err) e2elog.Failf("failed to delete storageclass: %v", err)
@ -2375,7 +2382,8 @@ var _ = Describe("RBD", func() {
}) })
ByFileAndBlockEncryption("Validate PVC restore from vaultKMS to vaultTenantSAKMS", func( ByFileAndBlockEncryption("Validate PVC restore from vaultKMS to vaultTenantSAKMS", func(
validator encryptionValidateFunc, isEncryptedPVC validateFunc, encType string) { validator encryptionValidateFunc, isEncryptedPVC validateFunc, encType string,
) {
restoreSCName := "restore-sc" restoreSCName := "restore-sc"
err := deleteResource(rbdExamplePath + "storageclass.yaml") err := deleteResource(rbdExamplePath + "storageclass.yaml")
if err != nil { if err != nil {
@ -2434,7 +2442,8 @@ var _ = Describe("RBD", func() {
}) })
ByFileAndBlockEncryption("Validate PVC-PVC clone with different SC from vaultKMS to vaultTenantSAKMS", func( ByFileAndBlockEncryption("Validate PVC-PVC clone with different SC from vaultKMS to vaultTenantSAKMS", func(
validator encryptionValidateFunc, isValidPVC validateFunc, encType string) { validator encryptionValidateFunc, isValidPVC validateFunc, encType string,
) {
restoreSCName := "restore-sc" restoreSCName := "restore-sc"
err := deleteResource(rbdExamplePath + "storageclass.yaml") err := deleteResource(rbdExamplePath + "storageclass.yaml")
if err != nil { if err != nil {
@ -2497,7 +2506,8 @@ var _ = Describe("RBD", func() {
}) })
ByFileAndBlockEncryption("create an encrypted PVC-PVC clone and bind it to an app", func( ByFileAndBlockEncryption("create an encrypted PVC-PVC clone and bind it to an app", func(
validator encryptionValidateFunc, isValidPVC validateFunc, encType string) { validator encryptionValidateFunc, isValidPVC validateFunc, encType string,
) {
err := deleteResource(rbdExamplePath + "storageclass.yaml") err := deleteResource(rbdExamplePath + "storageclass.yaml")
if err != nil { if err != nil {
e2elog.Failf("failed to delete storageclass: %v", err) e2elog.Failf("failed to delete storageclass: %v", err)
@ -2534,7 +2544,8 @@ var _ = Describe("RBD", func() {
}) })
ByFileAndBlockEncryption("create an encrypted PVC-PVC clone and bind it to an app with VaultKMS", func( ByFileAndBlockEncryption("create an encrypted PVC-PVC clone and bind it to an app with VaultKMS", func(
validator encryptionValidateFunc, isValidPVC validateFunc, encType string) { validator encryptionValidateFunc, isValidPVC validateFunc, encType string,
) {
err := deleteResource(rbdExamplePath + "storageclass.yaml") err := deleteResource(rbdExamplePath + "storageclass.yaml")
if err != nil { if err != nil {
e2elog.Failf("failed to delete storageclass: %v", err) e2elog.Failf("failed to delete storageclass: %v", err)
@ -4096,7 +4107,8 @@ var _ = Describe("RBD", func() {
By("clone PVC to a bigger size PVC", func() { By("clone PVC to a bigger size PVC", func() {
ByFileAndBlockEncryption("clone PVC to bigger size encrypted PVC with VaultKMS", func( ByFileAndBlockEncryption("clone PVC to bigger size encrypted PVC with VaultKMS", func(
validator encryptionValidateFunc, _ validateFunc, encType string) { validator encryptionValidateFunc, _ validateFunc, encType string,
) {
scOpts := map[string]string{ scOpts := map[string]string{
"encrypted": "true", "encrypted": "true",
"encryptionType": encType, "encryptionType": encType,

View File

@ -590,7 +590,12 @@ var noPVCValidation validateFunc
type imageValidateFunc func(f *framework.Framework, rbdImageSpec, pvName, appName string) error type imageValidateFunc func(f *framework.Framework, rbdImageSpec, pvName, appName string) error
func isEncryptedPVC(f *framework.Framework, pvc *v1.PersistentVolumeClaim, app *v1.Pod, validateFunc imageValidateFunc) error { func isEncryptedPVC(
f *framework.Framework,
pvc *v1.PersistentVolumeClaim,
app *v1.Pod,
validateFunc imageValidateFunc,
) error {
imageData, err := getImageInfoFromPVC(pvc.Namespace, pvc.Name, f) imageData, err := getImageInfoFromPVC(pvc.Namespace, pvc.Name, f)
if err != nil { if err != nil {
return err return err
@ -670,6 +675,7 @@ func validateEncryptedFilesystem(f *framework.Framework, rbdImageSpec, pvName, a
return fmt.Errorf("error checking file encrypted attribute of %q. listing filesystem+attrs: %s %s", return fmt.Errorf("error checking file encrypted attribute of %q. listing filesystem+attrs: %s %s",
volumeMountPath, stdOut, stdErr) volumeMountPath, stdOut, stdErr)
} }
return fmt.Errorf("error checking file encrypted attribute: %w", err) return fmt.Errorf("error checking file encrypted attribute: %w", err)
} }