Skip to content

Commit

Permalink
Enable e2e tests to execute against downstream build (#823)
Browse files Browse the repository at this point in the history
* Enable e2e tests to execute against downstream build (#811)

* Enable e2e tests to execute against downstream build

Reusing the e2e tests across upstream and downstream builds
will benefit the engineering teams by increasing the coverage
across teams.  Additionally this should enable QE to execute
the dev teams e2e tests against a build.

* New Variable = "stream" ( ok name? )
  * allow cli -stream or env var OADP_STREAM to set value [up,down]
* Only change required was the subscription label

Tested and passed on internal build

* remove var from Entry

* OADP: cherry-pick:811 enable e2e tests to execute against downstream build

* update Time

Co-authored-by: Wesley Hayutin <weshayutin@gmail.com>
  • Loading branch information
hhpatel14 and weshayutin committed Oct 17, 2022
1 parent 5e59569 commit 918d271
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
OADP_TEST_NAMESPACE ?= openshift-adp
CLUSTER_TYPE ?= aws
OADP_STREAM ?= up

# CONFIGS FOR CLOUD
# bsl / blob storage cred dir
Expand Down Expand Up @@ -353,6 +354,7 @@ test-e2e: test-e2e-setup
--ginkgo.label-filter="$(TEST_FILTER)" \
-ci_cred_file=$(CI_CRED_FILE) \
-provider=$(CLUSTER_TYPE) \
-stream=$(OADP_STREAM) \
-creds_secret_ref=$(CREDS_SECRET_REF)

test-e2e-cleanup:
Expand Down
6 changes: 3 additions & 3 deletions tests/e2e/backup_restore_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ var _ = Describe("AWS backup restore tests", func() {
Expect(err).NotTo(HaveOccurred())

log.Printf("Waiting for velero pod to be running")
Eventually(AreVeleroPodsRunning(namespace), timeoutMultiplier*time.Minute*3, time.Second*5).Should(BeTrue())
Eventually(AreVeleroPodsRunning(namespace), timeoutMultiplier*time.Minute*4, time.Second*5).Should(BeTrue())

if brCase.BackupRestoreType == RESTIC {
log.Printf("Waiting for restic pods to be running")
Eventually(AreResticPodsRunning(namespace), timeoutMultiplier*time.Minute*3, time.Second*5).Should(BeTrue())
Eventually(AreResticPodsRunning(namespace), timeoutMultiplier*time.Minute*4, time.Second*5).Should(BeTrue())
}
if brCase.BackupRestoreType == CSI {
log.Printf("Creating VolumeSnapshotClass for CSI backuprestore of %s", brCase.Name)
Expand All @@ -137,7 +137,7 @@ var _ = Describe("AWS backup restore tests", func() {
err = InstallApplication(dpaCR.Client, brCase.ApplicationTemplate)
Expect(err).ToNot(HaveOccurred())
// wait for pods to be running
Eventually(AreAppBuildsReady(dpaCR.Client, brCase.ApplicationNamespace), timeoutMultiplier*time.Minute*3, time.Second*5).Should(BeTrue())
Eventually(AreAppBuildsReady(dpaCR.Client, brCase.ApplicationNamespace), timeoutMultiplier*time.Minute*5, time.Second*5).Should(BeTrue())
Eventually(AreApplicationPodsRunning(brCase.ApplicationNamespace), timeoutMultiplier*time.Minute*9, time.Second*5).Should(BeTrue())

// Run optional custom verification
Expand Down
6 changes: 5 additions & 1 deletion tests/e2e/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
)

// Common vars obtained from flags passed in ginkgo.
var credFile, namespace, credSecretRef, instanceName, provider, ci_cred_file, settings, artifact_dir, oc_cli string
var credFile, namespace, credSecretRef, instanceName, provider, ci_cred_file, settings, artifact_dir, oc_cli, stream string
var timeoutMultiplier time.Duration

func init() {
Expand All @@ -28,6 +28,7 @@ func init() {
flag.StringVar(&ci_cred_file, "ci_cred_file", credFile, "CI Cloud Cred File")
flag.StringVar(&artifact_dir, "artifact_dir", "/tmp", "Directory for storing must gather")
flag.StringVar(&oc_cli, "oc_cli", "oc", "OC CLI Client")
flag.StringVar(&stream, "stream", "up", "[up, down] upstream or downstream")

// helps with launching debug sessions from IDE
if os.Getenv("E2E_USE_ENV_FLAGS") == "true" {
Expand All @@ -37,6 +38,9 @@ func init() {
if os.Getenv("VELERO_NAMESPACE") != "" {
namespace = os.Getenv("VELERO_NAMESPACE")
}
if os.Getenv("OADP_STREAM") != "" {
stream = os.Getenv("OADP_STREAM")
}
if os.Getenv("SETTINGS") != "" {
settings = os.Getenv("SETTINGS")
}
Expand Down
9 changes: 7 additions & 2 deletions tests/e2e/lib/subscription_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,18 @@ type Subscription struct {
*operators.Subscription
}

func (d *DpaCustomResource) GetOperatorSubscription() (*Subscription, error) {
func (d *DpaCustomResource) GetOperatorSubscription(stream string) (*Subscription, error) {
err := d.SetClient()
if err != nil {
return nil, err
}
sl := operators.SubscriptionList{}
err = d.Client.List(context.Background(), &sl, client.InNamespace(d.Namespace), client.MatchingLabels(map[string]string{"operators.coreos.com/oadp-operator." + d.Namespace: ""}))
if stream == "up"{
err = d.Client.List(context.Background(), &sl, client.InNamespace(d.Namespace), client.MatchingLabels(map[string]string{"operators.coreos.com/oadp-operator." + d.Namespace: ""}))
}
if stream == "down"{
err = d.Client.List(context.Background(), &sl, client.InNamespace(d.Namespace), client.MatchingLabels(map[string]string{"operators.coreos.com/redhat-oadp-operator." + d.Namespace: ""}))
}
if err != nil {
return nil, err
}
Expand Down
4 changes: 3 additions & 1 deletion tests/e2e/subscription_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,13 @@ var _ = Describe("Subscription Config Suite Test", func() {
type SubscriptionConfigTestCase struct {
operators.SubscriptionConfig
failureExpected *bool
stream string
}
DescribeTable("Proxy test table",
func(testCase SubscriptionConfigTestCase) {
log.Printf("Getting Operator Subscription")
s, err := dpaCR.GetOperatorSubscription()
log.Printf(stream)
s, err := dpaCR.GetOperatorSubscription(stream)
Expect(err).To(BeNil())
log.Printf("Setting test case subscription config")
s.Spec.Config = &testCase.SubscriptionConfig
Expand Down

0 comments on commit 918d271

Please sign in to comment.