Skip to content

Commit cd16e03

Browse files
authored
Add e2e backup and restore test suite for oadp-cli (#1835)
* start cli e2e work * First pass done * Install oadp-cli in CI image * Fix linting * Refactor code * Add kubectl * Add TEST_CLI option to Makefile and update testing documentation - Introduced TEST_CLI variable to control CLI-based backup/restore testing in the Makefile. - Updated TESTING.md to include information about the new TEST_CLI environment variable. - Added 'cli' label to the CLI test suite for better categorization. * Manual oadp-cli build and mv * Fail cli e2e if oadp not found * Add logging before cli commands execute * fix * Tabs not spaces
1 parent d681482 commit cd16e03

File tree

7 files changed

+979
-0
lines changed

7 files changed

+979
-0
lines changed

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,7 @@ ARTIFACT_DIR ?= /tmp
731731
HCO_UPSTREAM ?= false
732732
TEST_VIRT ?= false
733733
TEST_HCP ?= false
734+
TEST_CLI ?= false
734735
SKIP_MUST_GATHER ?= false
735736
TEST_UPGRADE ?= false
736737
TEST_FILTER = (($(shell echo '! aws && ! gcp && ! azure && ! ibmcloud' | \
@@ -751,6 +752,11 @@ ifeq ($(TEST_HCP),true)
751752
else
752753
TEST_FILTER += && (! hcp)
753754
endif
755+
ifeq ($(TEST_CLI),true)
756+
TEST_FILTER += && (cli)
757+
else
758+
TEST_FILTER += && (! cli)
759+
endif
754760

755761
.PHONY: test-e2e
756762
test-e2e: test-e2e-setup install-ginkgo ## Run E2E tests against OADP operator installed in cluster. For more information, check docs/developer/testing/TESTING.md

build/ci-Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,19 @@ WORKDIR /go/src/github.com/openshift/oadp-operator
55

66
COPY ./ .
77

8+
# Clone and install oadp-cli
9+
RUN git clone https://github.com/migtools/oadp-cli.git /tmp/oadp-cli && \
10+
cd /tmp/oadp-cli && \
11+
make build && \
12+
cp kubectl-oadp /usr/local/bin/ && \
13+
chmod +x /usr/local/bin/kubectl-oadp; \
14+
rm -rf /tmp/oadp-cli
15+
16+
# Install kubectl
17+
RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" && \
18+
chmod +x kubectl && \
19+
mv kubectl /usr/local/bin/
20+
821
RUN go mod download && \
922
mkdir -p $(go env GOCACHE) && \
1023
chmod -R 777 ./ $(go env GOCACHE) $(go env GOPATH)

docs/developer/testing/TESTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ 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+
| `TEST_CLI` | Exclusively run CLI-based backup/restore testing | `false` | false |
2627
| `SKIP_MUST_GATHER` | must-gather is compiled locally in the Makefile, may cause issue if local and cluster arch do not match| `false` | false |
2728

2829
> **Note:**

0 commit comments

Comments
 (0)