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

SubscriptionSuiteTest check deployment/deamonset ENV instead of pods in namespace. #697

Merged
merged 1 commit into from
May 13, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
26 changes: 17 additions & 9 deletions tests/e2e/lib/registry_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,10 @@ import (
func AreRegistryDeploymentsAvailable(namespace string) wait.ConditionFunc {
log.Printf("Checking for available registry deployments")
return func() (bool, error) {
client, err := setUpClient()
deploymentList, err := GetRegistryDeploymentList(namespace)
if err != nil {
return false, err
}
registryListOptions := metav1.ListOptions{
LabelSelector: "app.kubernetes.io/component=Registry",
}
// get pods in the oadp-operator-e2e namespace with label selector
deploymentList, err := client.AppsV1().Deployments(namespace).List(context.TODO(), registryListOptions)
if err != nil {
return false, nil
}
if len(deploymentList.Items) == 0 {
return false, fmt.Errorf("registry deployment is not yet created")
}
Expand All @@ -40,3 +32,19 @@ func AreRegistryDeploymentsAvailable(namespace string) wait.ConditionFunc {
return true, nil
}
}

func GetRegistryDeploymentList(namespace string) (*appsv1.DeploymentList, error) {
client, err := setUpClient()
if err != nil {
return nil, err
}
registryListOptions := metav1.ListOptions{
LabelSelector: "app.kubernetes.io/component=Registry",
}
// get pods in the oadp-operator-e2e namespace with label selector
deploymentList, err := client.AppsV1().Deployments(namespace).List(context.TODO(), registryListOptions)
if err != nil {
return nil, err
}
return deploymentList, nil
}
17 changes: 17 additions & 0 deletions tests/e2e/lib/restic_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"time"

oadpv1alpha1 "github.com/openshift/oadp-operator/api/v1alpha1"
appsv1 "k8s.io/api/apps/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/wait"
Expand Down Expand Up @@ -177,3 +178,19 @@ func ResticDaemonSetHasNodeSelector(namespace, key, value string) wait.Condition
return false, err
}
}

func GetResticDaemonsetList(namespace string) (*appsv1.DaemonSetList, error) {
client, err := setUpClient()
if err != nil {
return nil, err
}
registryListOptions := metav1.ListOptions{
LabelSelector: "component=velero",
}
// get pods in the oadp-operator-e2e namespace with label selector
deploymentList, err := client.AppsV1().DaemonSets(namespace).List(context.TODO(), registryListOptions)
if err != nil {
return nil, err
}
return deploymentList, nil
}
18 changes: 18 additions & 0 deletions tests/e2e/lib/velero_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import (
veleroClientset "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned"
"github.com/vmware-tanzu/velero/pkg/label"
"github.com/vmware-tanzu/velero/pkg/restic"
appsv1 "k8s.io/api/apps/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
)

Expand Down Expand Up @@ -155,3 +157,19 @@ func RestoreErrorLogs(ocClient client.Client, restore velero.Restore) []string {
}
return logLines
}

func GetVeleroDeploymentList(namespace string) (*appsv1.DeploymentList, error) {
client, err := setUpClient()
if err != nil {
return nil, err
}
registryListOptions := metav1.ListOptions{
LabelSelector: "component=velero",
}
// get pods in the oadp-operator-e2e namespace with label selector
deploymentList, err := client.AppsV1().Deployments(namespace).List(context.TODO(), registryListOptions)
if err != nil {
return nil, err
}
return deploymentList, nil
}
34 changes: 19 additions & 15 deletions tests/e2e/subscription_suite_test.go