Skip to content

Commit 5a814a0

Browse files
authored
allow user to skip must-gather (#1769)
* allow user to skip must-gather If using amd64 via laptop, and arm64 cluster the must-gather will panic and fail. * add doc
1 parent e1b17f7 commit 5a814a0

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,13 +568,15 @@ test-e2e-setup: login-required build-must-gather
568568
VSL_REGION="$(VSL_REGION)" \
569569
BSL_REGION="$(BSL_REGION)" \
570570
BSL_AWS_PROFILE="$(BSL_AWS_PROFILE)" \
571+
SKIP_MUST_GATHER="$(SKIP_MUST_GATHER)" \
571572
/bin/bash "tests/e2e/scripts/$(CLUSTER_TYPE)_settings.sh"
572573

573574
VELERO_INSTANCE_NAME ?= velero-test
574575
ARTIFACT_DIR ?= /tmp
575576
HCO_UPSTREAM ?= false
576577
TEST_VIRT ?= false
577578
TEST_HCP ?= false
579+
SKIP_MUST_GATHER ?= false
578580
TEST_UPGRADE ?= false
579581
TEST_FILTER = (($(shell echo '! aws && ! gcp && ! azure && ! ibmcloud' | \
580582
$(SED) -r "s/[&]* [!] $(CLUSTER_TYPE)|[!] $(CLUSTER_TYPE) [&]*//")) || $(CLUSTER_TYPE))
@@ -607,6 +609,7 @@ test-e2e: test-e2e-setup install-ginkgo ## Run E2E tests against OADP operator i
607609
-artifact_dir=$(ARTIFACT_DIR) \
608610
-kvm_emulation=$(KVM_EMULATION) \
609611
-hco_upstream=$(HCO_UPSTREAM) \
612+
-skipMustGather=$(SKIP_MUST_GATHER) \
610613
--ginkgo.vv \
611614
--ginkgo.no-color=$(OPENSHIFT_CI) \
612615
--ginkgo.label-filter="$(TEST_FILTER)" \

docs/developer/testing/TESTING.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ To get started, you need to provide the following **required** environment varia
2323
| `OPENSHIFT_CI` | Disable colored output from tests suite run | `true` | false |
2424
| `TEST_VIRT` | Exclusively run Virtual Machine backup/restore testing | `false` | false |
2525
| `TEST_UPGRADE` | Exclusively run upgrade tests. Need to first run `make catalog-test-upgrade`, if testing non production operator | `false` | false |
26+
| `SKIP_MUST_GATHER` | must-gather is compiled locally in the Makefile, may cause issue if local and cluster arch do not match| `false` | false |
27+
28+
> **Note:**
2629
2730
The expected format for `OADP_CRED_FILE` and `CI_CRED_FILE` files is:
2831
```
@@ -42,6 +45,7 @@ export VSL_REGION=<snapshotLocations_region>
4245
export BSL_REGION=<backupLocations_region>
4346
export OADP_TEST_NAMESPACE=<test_namespace>
4447
export OPENSHIFT_CI=false
48+
export SKIP_MUST_GATHER=true
4549
```
4650

4751
It is also possible to set the environment variables during make command call. Example

tests/e2e/backup_restore_suite_test.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,9 +303,12 @@ var _ = ginkgo.Describe("Backup and restore tests", ginkgo.Ordered, func() {
303303
err = lib.CreateUploadTestOnlyDPT(dpaCR.Client, dpaCR.Namespace, bslName)
304304
gomega.Expect(err).ToNot(gomega.HaveOccurred())
305305

306-
log.Printf("Running OADP must-gather")
307-
err = lib.RunMustGather(artifact_dir, dpaCR.Client)
308-
gomega.Expect(err).ToNot(gomega.HaveOccurred())
306+
log.Printf("skipMustGather: %v", skipMustGather)
307+
if !skipMustGather {
308+
log.Printf("Running OADP must-gather")
309+
err = lib.RunMustGather(artifact_dir, dpaCR.Client)
310+
gomega.Expect(err).ToNot(gomega.HaveOccurred())
311+
}
309312

310313
err = dpaCR.Delete()
311314
gomega.Expect(err).ToNot(gomega.HaveOccurred())

tests/e2e/e2e_suite_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ var (
4242

4343
kvmEmulation bool
4444
useUpstreamHco bool
45+
skipMustGather bool
4546
)
4647

4748
func init() {
@@ -57,6 +58,7 @@ func init() {
5758
flag.Int64Var(&flakeAttempts, "flakeAttempts", 3, "Customize the number of flake retries (3)")
5859
flag.BoolVar(&kvmEmulation, "kvm_emulation", true, "Enable or disable KVM emulation for virtualization testing")
5960
flag.BoolVar(&useUpstreamHco, "hco_upstream", false, "Force use of upstream virtualization operator")
61+
flag.BoolVar(&skipMustGather, "skipMustGather", false, "avoid errors with local execution and cluster architecture")
6062

6163
// helps with launching debug sessions from IDE
6264
if os.Getenv("E2E_USE_ENV_FLAGS") == "true" {
@@ -106,6 +108,13 @@ func init() {
106108
log.Println("Error parsing HCO_UPSTREAM, it will be disabled by default: ", err)
107109
}
108110
}
111+
if envValue := os.Getenv("SKIP_MUST_GATHER"); envValue != "" {
112+
if parsedValue, err := strconv.ParseBool(envValue); err == nil {
113+
skipMustGather = parsedValue
114+
} else {
115+
log.Println("Error parsing SKIP_MUST_GATHER, must-gather will be enabled by default: ", err)
116+
}
117+
}
109118
}
110119

111120
}

0 commit comments

Comments
 (0)