Skip to content

Commit 6f1c911

Browse files
authored
incorporate unit and integration tests into nightly (#1192)
1 parent dde7bb8 commit 6f1c911

1 file changed

Lines changed: 46 additions & 6 deletions

File tree

.github/workflows/nightly.yaml

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
- cron: "34 23 * * *"
88

99
jobs:
10-
e2e-tests:
10+
nightly-tests:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
fail-fast: false
@@ -16,7 +16,7 @@ jobs:
1616
- main
1717
- release-1.6
1818
- release-1.5
19-
name: 'E2E Tests on ${{ matrix.branch }}'
19+
name: 'Nightly Tests on ${{ matrix.branch }}'
2020
concurrency:
2121
group: '${{ github.workflow }}-${{ matrix.branch }}'
2222
cancel-in-progress: true
@@ -111,13 +111,53 @@ jobs:
111111
env:
112112
LATEST_COMMIT_SHA: ${{ github.sha }}
113113

114-
- name: Run SeaLights scan for e2e tests
114+
- name: Run SeaLights scan for tests
115115
if: ${{ steps.operator-image-existence-checker.outputs.OPERATOR_IMAGE_EXISTS == 'true' }}
116116
run: |
117-
echo "[SeaLights] Running the SeaLights e2e tests scan"
117+
echo "[SeaLights] Running the SeaLights scan"
118118
./slcli scan --bsid buildSessionId.txt --path-to-scanner ./slgoagent --workspacepath "./" --scm git --scmBaseUrl https://github.com/redhat-developer/rhdh-operator --scmProvider github
119-
env:
120-
SEALIGHTS_TEST_STAGE: "E2E Tests Nightly"
119+
120+
# gosec needs a "build" stage so connect it to the lint step which we always do
121+
- name: Build
122+
if: ${{ steps.operator-image-existence-checker.outputs.OPERATOR_IMAGE_EXISTS == 'true' }}
123+
run: make lint
124+
125+
- name: Run Controller
126+
if: ${{ steps.operator-image-existence-checker.outputs.OPERATOR_IMAGE_EXISTS == 'true' }}
127+
# run this stage only if there are changes that match the includes and not the excludes
128+
run: |
129+
# Need to 'make install' first, so that the necessary tool binaries (like controller-gen) can be downloaded locally.
130+
# Otherwise, we might end up with a race condition where the tool binary is not yet downloaded,
131+
# but the `make test` command tries to use it.
132+
make manifests generate fmt vet install
133+
make run &
134+
135+
- name: Create a Unit Tests session
136+
if: ${{ steps.operator-image-existence-checker.outputs.OPERATOR_IMAGE_EXISTS == 'true' }}
137+
run: ./slcli test start-stage --bsid=buildSessionId.txt --testStage "Unit Tests"
138+
139+
- name: Test
140+
if: ${{ steps.operator-image-existence-checker.outputs.OPERATOR_IMAGE_EXISTS == 'true' }}
141+
# run this stage only if there are changes that match the includes and not the excludes
142+
run: make test
143+
144+
- name: Create a Integration Tests session
145+
if: ${{ steps.operator-image-existence-checker.outputs.OPERATOR_IMAGE_EXISTS == 'true' }}
146+
run: |
147+
./slcli test end-stage --bsid=buildSessionId.txt --executionId "Unit Tests"
148+
./slcli test start-stage --bsid=buildSessionId.txt --testStage "Integration Tests"
149+
150+
- name: Generic Integration test
151+
if: ${{ steps.operator-image-existence-checker.outputs.OPERATOR_IMAGE_EXISTS == 'true' }}
152+
# run this stage only if there are changes that match the includes and not the excludes
153+
# perform it on backstage.io for speed
154+
run: make integration-test PROFILE=backstage.io USE_EXISTING_CLUSTER=true USE_EXISTING_CONTROLLER=true
155+
156+
- name: Create a E2E Tests session
157+
if: ${{ steps.operator-image-existence-checker.outputs.OPERATOR_IMAGE_EXISTS == 'true' }}
158+
run: |
159+
./slcli test end-stage --bsid=buildSessionId.txt --executionId "Integration Tests"
160+
./slcli test start-stage --bsid=buildSessionId.txt --testStage "E2E Tests"
121161
122162
- name: Run E2E tests
123163
if: ${{ steps.operator-image-existence-checker.outputs.OPERATOR_IMAGE_EXISTS == 'true' }}

0 commit comments

Comments
 (0)