Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix e2e with new yamls and support restic again #328

Merged
merged 20 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 11 additions & 25 deletions pkg/modules/application_mobility.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ const (
InitContainerImage = "<INIT_CONTAINER_IMAGE>"
//AccessContents - contents of the object store secret
AccessContents = "<CRED_CONTENTS>"
//AccessKeyID - contains the aws access key id
AccessKeyID = "<KEY_ID>"
//AccessKey - contains the aws access key
AccessKey = "<KEY>"
//AKeyID - contains the aws access key id
kumarkgosa marked this conversation as resolved.
Show resolved Hide resolved
AKeyID = "<KEY_ID>"
//AKey - contains the aws access key
AKey = "<KEY>"

// AppMobCtrlMgrComponent - component name in cr for app-mobility controller-manager
AppMobCtrlMgrComponent = "application-mobility-controller-manager"
Expand Down Expand Up @@ -142,11 +142,10 @@ func VeleroCrdDeploy(ctx context.Context, isDeleting bool, op utils.OperatorConf
if err != nil {
return err
}
err = applyDeleteObjects(ctx, ctrlClient, yamlString, isDeleting)
if err != nil {
return err
er := applyDeleteObjects(ctx, ctrlClient, yamlString, isDeleting)
kumarkgosa marked this conversation as resolved.
Show resolved Hide resolved
if er != nil {
return er
}

return nil
}

Expand Down Expand Up @@ -437,8 +436,8 @@ func getCreateVeleroAccess(op utils.OperatorConfig, cr csmv1.ContainerStorageMod

yamlString = strings.ReplaceAll(yamlString, VeleroNamespace, veleroNS)
yamlString = strings.ReplaceAll(yamlString, VeleroAccess, credName)
yamlString = strings.ReplaceAll(yamlString, AccessKeyID, accessID)
yamlString = strings.ReplaceAll(yamlString, AccessKey, access)
yamlString = strings.ReplaceAll(yamlString, AKeyID, accessID)
yamlString = strings.ReplaceAll(yamlString, AKey, access)

return yamlString, nil
}
Expand Down Expand Up @@ -746,19 +745,8 @@ func getRestic(op utils.OperatorConfig, cr csmv1.ContainerStorageModule) (string
veleroNS := ""
veleroImgPullPolicy := ""
veleroImg := ""
credName := ""
objectSecretName := ""

for _, component := range appMob.Components {
if component.Name == AppMobCtrlMgrComponent {
for _, env := range component.Envs {
if strings.Contains(AppMobObjStoreSecretName, env.Name) {
objectSecretName = env.Value
}
}
}
}

for _, component := range appMob.Components {
if component.Name == AppMobVeleroComponent {
if component.Image != "" {
Expand All @@ -771,8 +759,8 @@ func getRestic(op utils.OperatorConfig, cr csmv1.ContainerStorageModule) (string
if strings.Contains(VeleroNamespace, env.Name) {
veleroNS = env.Value
}
if strings.Contains(VeleroAccess, env.Name) {
credName = env.Value
if strings.Contains(AppMobObjStoreSecretName, env.Name) {
objectSecretName = env.Value
}

}
Expand All @@ -788,9 +776,7 @@ func getRestic(op utils.OperatorConfig, cr csmv1.ContainerStorageModule) (string

yamlString = strings.ReplaceAll(yamlString, VeleroImage, veleroImg)
yamlString = strings.ReplaceAll(yamlString, VeleroNamespace, veleroNS)
yamlString = strings.ReplaceAll(yamlString, VeleroAccess, credName)
yamlString = strings.ReplaceAll(yamlString, VeleroImagePullPolicy, veleroImgPullPolicy)
yamlString = strings.ReplaceAll(yamlString, AppMobObjStoreSecretName, objectSecretName)
return yamlString, nil
}

Expand Down
2 changes: 0 additions & 2 deletions tests/e2e/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,6 @@ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWb
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
github.com/onsi/ginkgo/v2 v2.11.0 h1:WgqUCUt/lT6yXoQ8Wef0fsNn5cAuMK7+KT9UFRz2tcU=
github.com/onsi/ginkgo/v2 v2.11.0/go.mod h1:ZhrRA5XmEE3x3rhlzamx/JJvujdZoJ2uvgI7kR0iZvM=
github.com/onsi/ginkgo/v2 v2.12.0 h1:UIVDowFPwpg6yMUpPjGkYvf06K3RAiJXUhCxEwQVHRI=
github.com/onsi/ginkgo/v2 v2.12.0/go.mod h1:ZNEzXISYlqpb8S36iN71ifqLi3vVD1rVJGvWRCJOUpQ=
github.com/onsi/gomega v1.27.8 h1:gegWiwZjBsf2DgiSbf5hpokZ98JVDMcWkUiigk6/KXc=
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/steps/step_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ func checkApplicationMobilityPods(namespace string, k8sClient kubernetes.Interfa

for _, pod := range allPods {
podMsg, podRunning := arePodsRunning(pod)
if podRunning == false {
if podRunning == false && pod.Status.Phase != "Succeeded" {
return fmt.Errorf("pod %s not running: %+v", pod.Name, podMsg)
}
}
Expand Down
8 changes: 3 additions & 5 deletions tests/e2e/steps/steps_def.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,6 @@ func (step *Step) validateModuleNotInstalled(res Resource, module string, crNumS

case csmv1.Resiliency:
return step.validateResiliencyNotInstalled(cr)

//case csmv1.ApplicationMobility:
// return step.validateAppMobNotInstalled(cr)
}
}
}
Expand Down Expand Up @@ -863,7 +860,8 @@ func (step *Step) validateAuthorizationProxyServerNotInstalled(cr csmv1.Containe
}

func (step *Step) validateAppMobInstalled(cr csmv1.ContainerStorageModule) error {
time.Sleep(5 * time.Second)
//providing additional time to get appmob pods up to running
time.Sleep(10 * time.Second)
instance := new(csmv1.ContainerStorageModule)
if err := step.ctrlClient.Get(context.TODO(), client.ObjectKey{
Namespace: cr.Namespace,
Expand All @@ -890,7 +888,7 @@ func (step *Step) validateAppMobInstalled(cr csmv1.ContainerStorageModule) error
}

// provide few seconds for cluster to settle down
time.Sleep(20 * time.Second)
time.Sleep(10 * time.Second)
return nil
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ stringData:
cloud: |
[default]
aws_access_key_id=access_key
aws_secret_access_key=secret_access_key
aws_secret_access_key=access_key123
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
kind: Secret
metadata:
name: cloud-creds
name: existing-cred
namespace: application-mobility
labels:
app.kubernetes.io/name: application-mobility-velero
Expand All @@ -11,4 +11,4 @@ stringData:
cloud: |
[default]
aws_access_key_id=access_key
aws_secret_access_key=secret_access_key
aws_secret_access_key=secret_access_key123
56 changes: 17 additions & 39 deletions tests/e2e/testfiles/appmob-values.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- scenario: "Install App Mobility with Velero and Cert-Manager already installed"
- scenario: "Install App Mobility with all features enabled while Velero and Cert-Manager already installed"
paths:
- "testfiles/csm_application_mobility_vanilla.yaml"
modules:
Expand All @@ -20,19 +20,17 @@
run:
- sh verify-app-mobility.sh

- scenario: "Install App Mobility Controller with different env variables than default"
- scenario: "Install App Mobility Controller manager with different env variables along with velero"
paths:
- "testfiles/csm_application_mobility_controller_diff_env.yaml"
modules:
steps:
- "Given an environment with k8s or openshift, and CSM operator installed"
- "Install [velero]"
- "Install [cert-manager]"
- "Apply custom resource [1]"
- "Validate [application-mobility] module from CR [1] is installed"
#- "Run custom test"
# Last two steps perform Clean Up
- "Uninstall [velero]"
- "Uninstall [cert-manager]"
- "Enable forceRemoveModule on CR [1]"
- "Delete custom resource [1]"
Expand All @@ -44,63 +42,50 @@

- scenario: "Install App Mobility Velero with different env variables than default"
paths:
- "testfiles/application-mobility-templates/alt-velero-secret.yaml"
- "testfiles/csm_application_mobility_velero_diff_env.yaml"
modules:
steps:
- "Given an environment with k8s or openshift, and CSM operator installed"

- "Install [cert-manager]"
- "Apply custom resource [1]"
- "Validate [application-mobility] module from CR [1] is installed"
- "Apply custom resource [2]"
- "Validate [application-mobility] module from CR [2] is installed"
#- "Run custom test"
# Last two steps perform Clean Up
- "Uninstall [cert-manager]"
- "Enable forceRemoveModule on CR [1]"
- "Enable forceRemoveModule on CR [2]"
- "Delete custom resource [1]"
- "Delete custom resource [2]"
customTest:
# name of custom test to run
name: verify app-mobility
run:
- sh verify-app-mobility.sh

- scenario: "Install App Mobility with Cert-Manager"
paths:
- "testfiles/csm_application_mobility_cert_manager.yaml"
- scenario: "Install App Mobility with velero when cert-manager is already installed"
paths:
- "testfiles/csm_application_mobility_test_velero.yaml"
modules:
steps:
- "Given an environment with k8s or openshift, and CSM operator installed"
- "Install [velero]"
- "Apply custom resource [1]"
- "Validate [application-mobility] module from CR [1] is installed"
#- "Run custom test"
# Last two steps perform Clean Up
- "Uninstall [velero]"
- "Enable forceRemoveModule on CR [1]"
- "Delete custom resource [1]"
customTest:
# name of custom test to run
name: verify app-mobility
run:
- sh verify-app-mobility.sh

- scenario: "Install App Mobility with Cert-Manager and Velero"
paths:
- "testfiles/csm_application_mobility_velero_with_cert.yaml"
modules:
steps:
- "Given an environment with k8s or openshift, and CSM operator installed"
- "Install [cert-manager]"
- "Apply custom resource [1]"
- "Validate [application-mobility] module from CR [1] is installed"
#- "Run custom test"
# Last two steps perform Clean Up
# Last two steps perform Clean UP
- "Uninstall [cert-manager]"
- "Enable forceRemoveModule on CR [1]"
- "Delete custom resource [1]"
customTest:
# name of custom test to run
name: verify app-mobility
# ./hello_world.sh
run:
- sh verify-app-mobility.sh

- scenario: "Install App Mobility with velero when cert-manager is already installed"
- scenario: "Install App Mobility with velero not installed and cert-manager already installed on machine"
paths:
- "testfiles/csm_application_mobility_test_velero.yaml"
modules:
Expand All @@ -117,16 +102,13 @@
customTest:
# name of custom test to run
name: verify app-mobility
# Provide command-line argument to run. Ginkgo will run the command and return output
# The command should be accessible from e2e_test repo. The cert-csi path is supplied in the values file.
# Example:
# ./hello_world.sh
run:
- sh verify-app-mobility.sh

- scenario: "Install App Mobility with powerflex driver"
paths:
- "testfiles/csm_application_mobility_velero_with_cert.yaml"
- "testfiles/csm_application_mobility_vanilla.yaml"
- "testfiles/storage_csm_powerflex.yaml"
modules:
steps:
Expand All @@ -146,10 +128,6 @@
customTest:
# name of the custom test to run
name: verify app-mobility
# Provide command-line argument to run. Ginkgo will run the command and return output
# The command should be accessible from e2e_test repo. The cert-csi path is supplied in the values file.
# Example:
# ./hello_world.sh
run:
- sh verify-app-mobility.sh

Loading
Loading