Skip to content

Commit

Permalink
ci/cli: add full backup/restore test
Browse files Browse the repository at this point in the history
This test simulates migration of a Rancher Manager server.

Signed-off-by: Loic Devulder <[email protected]>
  • Loading branch information
ldevulder committed Sep 23, 2024
1 parent a9c1d57 commit da37235
Show file tree
Hide file tree
Showing 12 changed files with 696 additions and 370 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/SCHEDULING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ We try to spread the tests as best as we can to avoid SPOT issue as well as not
| CLI Multicluster | Sunday | 5am | us-central1-b |
| CLI Regression | Saturday | 11am | us-central1-c |
| CLI Rancher Manager Devel | Sunday | 8am | us-central1-c |
| UI Rancher Manager Devel | Sunday | 12pm | us-central1-a |
| CLI K3s Downgrade | Sunday | 2pm | us-central1-b |
| CLI Full backup/restore (migration) | Sunday | 4pm | us-central1-c |
| UI K3s | Monday to Saturday | 2am | us-central1-a |
| UI K3s Upgrade | Monday to Saturday | 4am | us-central1-a |
| UI RKE2 | Monday to Saturday | 2am | us-central1-b |
| UI RKE2 Upgrade | Monday to Saturday | 4am | us-central1-b |
| UI Rancher Manager Devel | Sunday | 12pm | us-central1-a |
| Update tests description | All days | 11pm | us-central1 |

**NOTE:** please note that the GitHub scheduler uses UTC and our GCP runners are deployed in `us-central1`, so UTC-5.
53 changes: 53 additions & 0 deletions .github/workflows/cli-full-backup-restore-matrix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# This workflow calls the master E2E workflow with custom variables
name: CLI-Full-Backup-Restore

on:
workflow_dispatch:
inputs:
destroy_runner:
description: Destroy the auto-generated self-hosted runner
default: true
type: boolean
k8s_downstream_version:
description: Rancher cluster downstream version to use
default: '"v1.27.13+k3s1"'
type: string
k8s_upstream_version:
description: Rancher cluster upstream version to use
default: '"v1.27.13+k3s1"'
type: string
qase_run_id:
description: Qase run ID where the results will be reported
type: string
rancher_version:
description: Rancher Manager channel/version/head_version to use
default: '"stable/latest"'
type: string
schedule:
# Every Sunday at 4pm UTC (11am in us-central1)
- cron: '0 16 * * 0'

jobs:
cli:
strategy:
fail-fast: false
max-parallel: 4
matrix:
k8s_downstream_version: ${{ fromJSON(format('[{0}]', inputs.k8s_downstream_version || '"v1.30.4+k3s1","v1.30.4+rke2r1"')) }}
k8s_upstream_version: ${{ fromJSON(format('[{0}]', inputs.k8s_upstream_version || '"v1.30.4+k3s1","v1.30.4+rke2r1"')) }}
rancher_version: ${{ fromJSON(format('[{0}]', inputs.rancher_version || '"latest/devel/2.9"')) }}
uses: ./.github/workflows/master_e2e.yaml
secrets:
credentials: ${{ secrets.GCP_CREDENTIALS }}
pat_token: ${{ secrets.SELF_HOSTED_RUNNER_PAT_TOKEN }}
qase_api_token: ${{ secrets.QASE_API_TOKEN }}
with:
destroy_runner: ${{ github.event_name == 'schedule' && true || inputs.destroy_runner }}
full_backup_restore: true
k8s_downstream_version: ${{ matrix.k8s_downstream_version }}
k8s_upstream_version: ${{ matrix.k8s_upstream_version }}
node_number: 3
qase_run_id: ${{ github.event_name == 'schedule' && 'auto' || inputs.qase_run_id }}
rancher_version: ${{ matrix.rancher_version }}
test_type: cli
zone: us-central1-c
5 changes: 5 additions & 0 deletions .github/workflows/master_e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ on:
description: Force OS downgrade
default: false
type: boolean
full_backup_restore:
description: Test migration-like backup/restore functionality
default: false
type: boolean
k8s_downstream_version:
description: Rancher cluster downstream version to use
type: string
Expand Down Expand Up @@ -228,6 +232,7 @@ jobs:
destroy_runner: ${{ inputs.destroy_runner }}
elemental_ui_version: ${{ inputs.elemental_ui_version }}
force_downgrade: ${{ inputs.force_downgrade }}
full_backup_restore: ${{ inputs.full_backup_restore }}
k8s_downstream_version: ${{ inputs.k8s_downstream_version }}
node_number: ${{ inputs.node_number }}
operator_repo: ${{ inputs.operator_repo }}
Expand Down
26 changes: 22 additions & 4 deletions .github/workflows/sub_cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ on:
force_downgrade:
required: true
type: boolean
full_backup_restore:
required: true
type: boolean
k8s_downstream_version:
required: true
type: string
Expand Down Expand Up @@ -350,10 +353,25 @@ jobs:
run: |
cd tests && make e2e-upgrade-node && make e2e-check-app
- name: Test Backup/Restore Elemental resources with Rancher Manager
- name: Test Backup/Restore Rancher Manager/Elemental resources
id: test_backup_restore
env:
CA_TYPE: ${{ inputs.ca_type }}
OPERATOR_REPO: ${{ inputs.operator_repo }}
PUBLIC_FQDN: ${{ inputs.public_fqdn }}
PUBLIC_DOMAIN: ${{ inputs.public_domain }}
run: |
cd tests && make e2e-backup-restore && make e2e-check-app
cd tests
# Run simple or full backup/restore test
if ${{ inputs.full_backup_restore == true }}; then
make e2e-full-backup-restore
else
make e2e-simple-backup-restore
fi
# Check the installed application
make e2e-check-app
- name: Extract ISO version
id: iso_version
Expand Down Expand Up @@ -426,8 +444,8 @@ jobs:
env:
OPERATOR_REPO: ${{ inputs.operator_repo }}
# Don't test Operator uninstall if we want to keep the runner for debugging purposes
if: ${{ inputs.destroy_runner == true }}
run: cd tests && make e2e-uninstall-operator
if: ${{ inputs.destroy_runner == true && inputs.full_backup_restore == false }}
run: cd tests && make e2e-uninstall-operator && make e2e-check-app

# This step must be called in each worklow that wants a summary!
- name: Get logs and add summary
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/sub_test_choice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ on:
force_downgrade:
required: true
type: boolean
full_backup_restore:
required: true
type: boolean
k8s_downstream_version:
required: true
type: string
Expand Down Expand Up @@ -171,6 +174,7 @@ jobs:
cluster_type: ${{ inputs.cluster_type }}
destroy_runner: ${{ inputs.destroy_runner }}
force_downgrade: ${{ inputs.force_downgrade }}
full_backup_restore: ${{ inputs.full_backup_restore }}
k8s_downstream_version: ${{ inputs.k8s_downstream_version }}
node_number: ${{ inputs.node_number }}
operator_repo: ${{ inputs.operator_repo }}
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
[![CLI-K3s-Downgrade](https://github.com/rancher/elemental/actions/workflows/cli-k3s-downgrade-matrix.yaml/badge.svg)](https://github.com/rancher/elemental/actions/workflows/cli-k3s-downgrade-matrix.yaml)
[![CLI-K3s-Scalability](https://github.com/rancher/elemental/actions/workflows/cli-k3s-scalability-matrix.yaml/badge.svg)](https://github.com/rancher/elemental/actions/workflows/cli-k3s-scalability-matrix.yaml)
[![CLI-K3s-SELinux](https://github.com/rancher/elemental/actions/workflows/cli-k3s-selinux-matrix.yaml/badge.svg)](https://github.com/rancher/elemental/actions/workflows/cli-k3s-selinux-matrix.yaml)
[![CLI-Full-Backup-Restore](https://github.com/rancher/elemental/actions/workflows/cli-full-backup-restore-matrix.yaml/badge.svg)](https://github.com/rancher/elemental/actions/workflows/cli-full-backup-restore-matrix.yaml)
[![CLI-Multicluster](https://github.com/rancher/elemental/actions/workflows/cli-multicluster-matrix.yaml/badge.svg)](https://github.com/rancher/elemental/actions/workflows/cli-multicluster-matrix.yaml)
[![CLI-Rancher-Manager-Head-2.7](https://github.com/rancher/elemental/actions/workflows/cli-rm-head-2.7-matrix.yaml/badge.svg)](https://github.com/rancher/elemental/actions/workflows/cli-rm-head-2.7-matrix.yaml)
[![CLI-Regression](https://github.com/rancher/elemental/actions/workflows/cli-regression-matrix.yaml/badge.svg)](https://github.com/rancher/elemental/actions/workflows/cli-regression-matrix.yaml)
Expand Down
13 changes: 8 additions & 5 deletions tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ e2e-airgap-rancher: deps
e2e-bootstrap-node: deps
ginkgo --timeout $(GINKGO_TIMEOUT)s --label-filter bootstrap -r -v ./e2e

e2e-backup-restore: deps
ginkgo --label-filter test-backup-restore -r -v ./e2e

e2e-check-app: deps
ginkgo --label-filter check-app -r -v ./e2e

e2e-configure-rancher: deps
ginkgo --label-filter configure -r -v ./e2e

e2e-full-backup-restore: deps
ginkgo --label-filter test-full-backup-restore -r -v ./e2e

e2e-get-logs: deps
ginkgo --label-filter logs -r -v ./e2e

Expand All @@ -91,11 +91,14 @@ e2e-iso-image: deps
e2e-multi-cluster: deps
ginkgo --timeout $(GINKGO_TIMEOUT)s --label-filter multi-cluster -r -v ./e2e

e2e-prepare-archive: deps
ginkgo --label-filter prepare-archive -r -v ./e2e

e2e-reset: deps
ginkgo --label-filter reset -r -v ./e2e

e2e-prepare-archive: deps
ginkgo --label-filter prepare-archive -r -v ./e2e
e2e-simple-backup-restore: deps
ginkgo --label-filter test-simple-backup-restore -r -v ./e2e

e2e-ui-rancher: deps
ginkgo --label-filter ui -r -v ./e2e
Expand Down
2 changes: 1 addition & 1 deletion tests/assets/restore.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ metadata:
spec:
backupFilename: %BACKUP_FILE%
deleteTimeoutSeconds: 10
prune: true
prune: %PRUNE%
Loading

0 comments on commit da37235

Please sign in to comment.