Skip to content

Commit ea8f786

Browse files
authored
Move multi-app-backup-and-restore test to Playwright (#4923)
* Move multi-app-backup-and-restore test to Playwright
1 parent ff0adfa commit ea8f786

File tree

25 files changed

+147
-62
lines changed

25 files changed

+147
-62
lines changed

.github/actions/kots-e2e/action.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name: 'KOTS E2E'
22
description: 'Composite action for running KOTS e2e test'
33
inputs:
4-
test-focus:
5-
description: 'Name of the test for FOCUS'
4+
test-id:
5+
description: 'ID of the test to run'
66
required: true
77
kots-namespace:
88
description: 'KOTS namespace'
@@ -92,14 +92,14 @@ runs:
9292
instance-type: ${{ inputs.k8s-instance-type }}
9393
export-kubeconfig: true
9494

95-
- name: execute suite "${{ inputs.test-focus }}"
95+
- name: execute suite "${{ inputs.test-id }}"
9696
env:
9797
TESTIM_ACCESS_TOKEN: ${{ inputs.testim-access-token }}
9898
REPLICATED_API_TOKEN: ${{ inputs.replicated-api-token }}
9999
KOTS_NAMESPACE: ${{ inputs.kots-namespace }}
100100
run: |
101101
make -C e2e test \
102-
FOCUS="${{ inputs.test-focus }}" \
102+
FOCUS="${{ inputs.test-id }}" \
103103
EXISTING_KUBECONFIG=$KUBECONFIG \
104104
TESTIM_BRANCH=${{ inputs.testim-branch }} \
105105
KOTSADM_IMAGE_REGISTRY=${{ inputs.kotsadm-image-registry }} \

.github/workflows/build-test.yaml

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ jobs:
592592
- uses: ./.github/actions/kots-e2e
593593
with:
594594
kots-namespace: 'qakotsregression'
595-
test-focus: 'Regression'
595+
test-id: '@regression'
596596
k8s-distribution: k3s
597597
k8s-version: v1.26
598598
testim-branch: ${{ github.head_ref == 'main' && 'master' || github.head_ref }}
@@ -628,7 +628,7 @@ jobs:
628628
- run: chmod +x bin/*
629629
- uses: ./.github/actions/kots-e2e
630630
with:
631-
test-focus: 'Smoke Test'
631+
test-id: '@smoke-test'
632632
kots-namespace: 'smoke-test'
633633
k8s-distribution: ${{ matrix.cluster.distribution }}
634634
k8s-version: ${{ matrix.cluster.version }}
@@ -846,7 +846,7 @@ jobs:
846846
- run: chmod +x bin/*
847847
- uses: ./.github/actions/kots-e2e
848848
with:
849-
test-focus: 'Backup and Restore'
849+
test-id: '@backup-and-restore'
850850
kots-namespace: 'backup-and-restore'
851851
k8s-distribution: ${{ matrix.cluster.distribution }}
852852
k8s-version: ${{ matrix.cluster.version }}
@@ -883,7 +883,7 @@ jobs:
883883
- run: chmod +x bin/*
884884
- uses: ./.github/actions/kots-e2e
885885
with:
886-
test-focus: 'No Required Config'
886+
test-id: '@no-required-config'
887887
kots-namespace: 'no-required-config'
888888
k8s-distribution: ${{ matrix.cluster.distribution }}
889889
k8s-version: ${{ matrix.cluster.version }}
@@ -1073,7 +1073,7 @@ jobs:
10731073
- run: chmod +x bin/*
10741074
- uses: ./.github/actions/kots-e2e
10751075
with:
1076-
test-focus: 'Config Validation'
1076+
test-id: '@config-validation'
10771077
kots-namespace: 'config-validation'
10781078
k8s-distribution: ${{ matrix.cluster.distribution }}
10791079
k8s-version: ${{ matrix.cluster.version }}
@@ -1109,7 +1109,7 @@ jobs:
11091109
- run: chmod +x bin/*
11101110
- uses: ./.github/actions/kots-e2e
11111111
with:
1112-
test-focus: 'Version History Pagination'
1112+
test-id: '@version-history-pagination'
11131113
kots-namespace: 'version-history-pagination'
11141114
k8s-distribution: ${{ matrix.cluster.distribution }}
11151115
k8s-version: ${{ matrix.cluster.version }}
@@ -1146,7 +1146,7 @@ jobs:
11461146
- run: chmod +x bin/*
11471147
- uses: ./.github/actions/kots-e2e
11481148
with:
1149-
test-focus: 'Change License'
1149+
test-id: '@change-license'
11501150
kots-namespace: 'change-license'
11511151
k8s-distribution: ${{ matrix.cluster.distribution }}
11521152
k8s-version: ${{ matrix.cluster.version }}
@@ -1183,7 +1183,7 @@ jobs:
11831183
- run: chmod +x bin/*
11841184
- uses: ./.github/actions/kots-e2e
11851185
with:
1186-
test-focus: 'Change Channel'
1186+
test-id: '@change-channel'
11871187
kots-namespace: 'change-channel'
11881188
k8s-distribution: ${{ matrix.cluster.distribution }}
11891189
k8s-version: ${{ matrix.cluster.version }}
@@ -2338,7 +2338,7 @@ jobs:
23382338
- uses: ./.github/actions/kots-e2e
23392339
id: kots-e2e
23402340
with:
2341-
test-focus: 'Min KOTS Version'
2341+
test-id: '@min-kots-version'
23422342
kots-namespace: 'min-kots-version'
23432343
k8s-distribution: ${{ matrix.cluster.distribution }}
23442344
k8s-version: ${{ matrix.cluster.version }}
@@ -2404,7 +2404,7 @@ jobs:
24042404
- uses: ./.github/actions/kots-e2e
24052405
id: kots-e2e
24062406
with:
2407-
test-focus: 'Target KOTS Version'
2407+
test-id: '@target-kots-version'
24082408
kots-namespace: 'target-kots-version'
24092409
k8s-distribution: ${{ matrix.cluster.distribution }}
24102410
k8s-version: ${{ matrix.cluster.version }}
@@ -2469,7 +2469,7 @@ jobs:
24692469
- uses: ./.github/actions/kots-e2e
24702470
id: kots-e2e
24712471
with:
2472-
test-focus: 'Range KOTS Version'
2472+
test-id: '@range-kots-version'
24732473
kots-namespace: 'range-kots-version'
24742474
k8s-distribution: ${{ matrix.cluster.distribution }}
24752475
k8s-version: ${{ matrix.cluster.version }}
@@ -2857,12 +2857,10 @@ jobs:
28572857
- run: chmod +x bin/*
28582858
- uses: ./.github/actions/kots-e2e
28592859
with:
2860-
test-focus: 'multi-app-backup-and-restore'
2860+
test-id: '@multi-app-backup-and-restore'
28612861
kots-namespace: 'multi-app-backup-and-restore'
28622862
k8s-distribution: ${{ matrix.cluster.distribution }}
28632863
k8s-version: ${{ matrix.cluster.version }}
2864-
testim-access-token: '${{ secrets.TESTIM_ACCESS_TOKEN }}'
2865-
testim-branch: ${{ github.head_ref == 'main' && 'master' || github.head_ref }}
28662864
replicated-api-token: '${{ secrets.C11Y_MATRIX_TOKEN }}'
28672865
kots-dockerhub-username: '${{ secrets.E2E_DOCKERHUB_USERNAME }}'
28682866
kots-dockerhub-password: '${{ secrets.E2E_DOCKERHUB_PASSWORD }}'
@@ -2895,7 +2893,7 @@ jobs:
28952893
- run: chmod +x bin/*
28962894
- uses: ./.github/actions/kots-e2e
28972895
with:
2898-
test-focus: 'Multi App Install'
2896+
test-id: '@multi-app-install'
28992897
kots-namespace: 'multi-app-install'
29002898
k8s-distribution: ${{ matrix.cluster.distribution }}
29012899
k8s-version: ${{ matrix.cluster.version }}
@@ -2931,7 +2929,7 @@ jobs:
29312929
- run: chmod +x bin/*
29322930
- uses: ./.github/actions/kots-e2e
29332931
with:
2934-
test-focus: 'airgap-smoke-test'
2932+
test-id: '@airgap-smoke-test'
29352933
kots-namespace: 'airgap-smoke-test'
29362934
k8s-distribution: ${{ matrix.cluster.distribution }}
29372935
k8s-version: ${{ matrix.cluster.version }}
@@ -3944,7 +3942,7 @@ jobs:
39443942
- run: chmod +x bin/*
39453943
- uses: ./.github/actions/kots-e2e
39463944
with:
3947-
test-focus: 'Support Bundle'
3945+
test-id: '@support-bundle'
39483946
kots-namespace: 'support-bundle'
39493947
k8s-distribution: ${{ matrix.cluster.distribution }}
39503948
k8s-version: ${{ matrix.cluster.version }}
@@ -3982,7 +3980,7 @@ jobs:
39823980
- run: chmod +x bin/*
39833981
- uses: ./.github/actions/kots-e2e
39843982
with:
3985-
test-focus: 'GitOps'
3983+
test-id: '@gitops'
39863984
kots-namespace: 'gitops'
39873985
k8s-distribution: ${{ matrix.cluster.distribution }}
39883986
k8s-version: ${{ matrix.cluster.version }}
@@ -4337,7 +4335,6 @@ jobs:
43374335
- validate-min-kots-version
43384336
- validate-target-kots-version
43394337
- validate-range-kots-version
4340-
- validate-multi-app-backup-and-restore
43414338
- validate-airgap-smoke-test
43424339
- validate-support-bundle
43434340
- validate-gitops
@@ -4347,6 +4344,7 @@ jobs:
43474344
- validate-no-required-config
43484345
- validate-config
43494346
- validate-change-channel
4347+
- validate-multi-app-backup-and-restore
43504348
- validate-multi-app-install
43514349
# non-testim tests
43524350
- validate-minimal-rbac

e2e/README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ E2E tests are run in build-test workflow on pull_request event.
44

55
e2e_test.go uses Ginkgo to build a test suite from inventory.go and runs each test using testim/client.go or playwright/playwright.go
66

7-
Tests are parallelized using Gingko's test focus. Each workflow definition in .github/workflows/build-test.yaml must define a `test-focus` parameter that matches the `Test Name` property defined in inventory.go. Each e2e test workflow skips all tests but what is defined in `test-focus`. Please colocate new Playwright tests under the Playwright comment with the other pw tests.
7+
Tests are parallelized using Gingko's test focus. Each workflow definition in .github/workflows/build-test.yaml must define a `test-id` parameter that matches the `Test ID` property defined in inventory.go. Each e2e test workflow skips all tests but what is defined in `test-id`. Please colocate new Playwright tests under the Playwright comment with the other pw tests.
88

99
New tests should be written with Playwright.
1010

@@ -28,14 +28,13 @@ code --install-extension ms-playwright.playwright
2828

2929
To add a new test that you've already added in the [kots-tests-app repo](https://github.com/replicatedhq/kots-test-apps) - do the following:
3030

31-
- Update `.github/workflows/build-test.yaml` to include the new test. You can copy an existing pw entry like `validate-change-channel` and update the test-focus, kots-namespace, and any other parameters needed for the test.
31+
- Update `.github/workflows/build-test.yaml` to include the new test. You can copy an existing pw entry like `validate-change-channel` and update the `test-id`, kots-namespace, and any other parameters needed for the test.
3232
- Add the test to `e2e/inventory.go` , making sure the naming matches your kots-test-app and conforms to the naming convention of the other tests in the file:
3333

3434
```go
3535
func NewChangeChannel() Test {
3636
return Test{
37-
ID: "change-channel",
38-
Name: "Change Channel",
37+
ID: "@change-channel",
3938
Namespace: "change-channel",
4039
AppSlug: "change-channel",
4140
UpstreamURI: "change-channel/automated",
@@ -52,8 +51,8 @@ Entry(nil, inventory.NewChangeChannel()),
5251
- Create a new test directory in `e2e/playwright/tests` matching your test ID, with the corresponding test file:
5352

5453
```
55-
$ tree e2e/playwright/tests/change-channel
56-
e2e/playwright/tests/change-channel
54+
$ tree e2e/playwright/tests/@change-channel
55+
e2e/playwright/tests/@change-channel
5756
├── license.yaml // a test specific license if needed
5857
└── test.spec.ts // the actual test file
5958
```
@@ -77,7 +76,7 @@ To run an individual test run:
7776

7877
```bash
7978
make e2e \
80-
FOCUS="Change License"
79+
FOCUS="@change-license"
8180
```
8281

8382
To build and run with ttl.sh images:
@@ -103,7 +102,7 @@ To run against the okteto dev environment run:
103102
```bash
104103
okteto context use https://replicated.okteto.dev
105104
make e2e \
106-
FOCUS="Change License" \
105+
FOCUS="@change-license" \
107106
EXISTING_KUBECONFIG=${KUBECONFIG:-$HOME/.kube/config}
108107
```
109108

@@ -113,7 +112,7 @@ To skip cluster teardown in order to debug issues:
113112

114113
```bash
115114
$ make e2e \
116-
FOCUS="Change License" \
115+
FOCUS="@change-license" \
117116
SKIP_TEARDOWN=1
118117
...
119118
To set kubecontext run:

e2e/e2e_test.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,13 @@ var _ = BeforeSuite(func() {
101101
kotsInstaller = kots.NewInstaller(kotsadmImageRegistry, kotsadmImageNamespace, kotsadmImageTag, airgap, kotsDockerhubUsername, kotsDockerhubPassword, isEKS)
102102
})
103103

104+
var _ = ReportBeforeSuite(func(report Report) {
105+
count := report.PreRunStats.SpecsThatWillRun
106+
if count == 0 {
107+
Fail("Did not match any tests")
108+
}
109+
})
110+
104111
var _ = AfterSuite(func() {
105112
gexec.KillAndWait()
106113
})
@@ -204,7 +211,7 @@ var _ = Describe("E2E", func() {
204211
testimRun.ShouldSucceed()
205212
},
206213
func(test inventory.Test) string {
207-
return test.Name
214+
return test.ID
208215
},
209216
Entry(nil, inventory.NewRegressionTest()),
210217
Entry(nil, inventory.NewSmokeTest()),
@@ -223,7 +230,5 @@ var _ = Describe("E2E", func() {
223230
Entry(nil, inventory.NewGitOps()),
224231
Entry(nil, inventory.NewChangeChannel()),
225232
)
226-
227233
})
228-
229234
})

0 commit comments

Comments
 (0)