Skip to content

Commit 918d271

Browse files
Enable e2e tests to execute against downstream build (#823)
* 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>
1 parent 5e59569 commit 918d271

File tree

5 files changed

+20
-7
lines changed

5 files changed

+20
-7
lines changed

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
OADP_TEST_NAMESPACE ?= openshift-adp
22
CLUSTER_TYPE ?= aws
3+
OADP_STREAM ?= up
34

45
# CONFIGS FOR CLOUD
56
# bsl / blob storage cred dir
@@ -353,6 +354,7 @@ test-e2e: test-e2e-setup
353354
--ginkgo.label-filter="$(TEST_FILTER)" \
354355
-ci_cred_file=$(CI_CRED_FILE) \
355356
-provider=$(CLUSTER_TYPE) \
357+
-stream=$(OADP_STREAM) \
356358
-creds_secret_ref=$(CREDS_SECRET_REF)
357359

358360
test-e2e-cleanup:

tests/e2e/backup_restore_suite_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,11 @@ var _ = Describe("AWS backup restore tests", func() {
109109
Expect(err).NotTo(HaveOccurred())
110110

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

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

143143
// Run optional custom verification

tests/e2e/e2e_suite_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
)
1616

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

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

3233
// helps with launching debug sessions from IDE
3334
if os.Getenv("E2E_USE_ENV_FLAGS") == "true" {
@@ -37,6 +38,9 @@ func init() {
3738
if os.Getenv("VELERO_NAMESPACE") != "" {
3839
namespace = os.Getenv("VELERO_NAMESPACE")
3940
}
41+
if os.Getenv("OADP_STREAM") != "" {
42+
stream = os.Getenv("OADP_STREAM")
43+
}
4044
if os.Getenv("SETTINGS") != "" {
4145
settings = os.Getenv("SETTINGS")
4246
}

tests/e2e/lib/subscription_helpers.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,18 @@ type Subscription struct {
1616
*operators.Subscription
1717
}
1818

19-
func (d *DpaCustomResource) GetOperatorSubscription() (*Subscription, error) {
19+
func (d *DpaCustomResource) GetOperatorSubscription(stream string) (*Subscription, error) {
2020
err := d.SetClient()
2121
if err != nil {
2222
return nil, err
2323
}
2424
sl := operators.SubscriptionList{}
25-
err = d.Client.List(context.Background(), &sl, client.InNamespace(d.Namespace), client.MatchingLabels(map[string]string{"operators.coreos.com/oadp-operator." + d.Namespace: ""}))
25+
if stream == "up"{
26+
err = d.Client.List(context.Background(), &sl, client.InNamespace(d.Namespace), client.MatchingLabels(map[string]string{"operators.coreos.com/oadp-operator." + d.Namespace: ""}))
27+
}
28+
if stream == "down"{
29+
err = d.Client.List(context.Background(), &sl, client.InNamespace(d.Namespace), client.MatchingLabels(map[string]string{"operators.coreos.com/redhat-oadp-operator." + d.Namespace: ""}))
30+
}
2631
if err != nil {
2732
return nil, err
2833
}

tests/e2e/subscription_suite_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,13 @@ var _ = Describe("Subscription Config Suite Test", func() {
4444
type SubscriptionConfigTestCase struct {
4545
operators.SubscriptionConfig
4646
failureExpected *bool
47+
stream string
4748
}
4849
DescribeTable("Proxy test table",
4950
func(testCase SubscriptionConfigTestCase) {
5051
log.Printf("Getting Operator Subscription")
51-
s, err := dpaCR.GetOperatorSubscription()
52+
log.Printf(stream)
53+
s, err := dpaCR.GetOperatorSubscription(stream)
5254
Expect(err).To(BeNil())
5355
log.Printf("Setting test case subscription config")
5456
s.Spec.Config = &testCase.SubscriptionConfig

0 commit comments

Comments
 (0)