Skip to content

Commit 969cb86

Browse files
nandajavarmaroboquat
authored andcommitted
Splitting the test executions
1 parent 61b3df2 commit 969cb86

File tree

4 files changed

+93
-34
lines changed

4 files changed

+93
-34
lines changed

.werft/installer-tests.ts

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,50 @@ const INFRA_PHASES: { [name: string]: InfraConfig } = {
186186

187187

188188
const TESTS: { [name: string]: InfraConfig } = {
189-
// TODO(nvn): make this more atomic
190-
INTEGRATION_TESTS: {
191-
phase: "run-tests",
192-
makeTarget: "run-tests",
193-
description: "Run the integration tests",
189+
WORKSPACE_TEST: {
190+
phase: "run-workspace-tests",
191+
makeTarget: "run-workspace-tests",
192+
description: "Run the test for workspaces",
193+
},
194+
VSCODE_IDE_TEST: {
195+
phase: "run-vscode-ide-tests",
196+
makeTarget: "run-vscode-ide-tests",
197+
description: "Run the test for vscode IDE",
198+
},
199+
JB_IDE_TEST: {
200+
phase: "run-jb-ide-tests",
201+
makeTarget: "run-jb-ide-tests",
202+
description: "Run the test for jetbrains IDE",
203+
},
204+
CONTENTSERVICE_TEST: {
205+
phase: "run-cs-component-tests",
206+
makeTarget: "run-cs-component-tests",
207+
description: "Run the test for content-service component",
208+
},
209+
DB_TEST: {
210+
phase: "run-db-component-tests",
211+
makeTarget: "run-db-component-tests",
212+
description: "Run the test for database component",
213+
},
214+
IMAGEBUILDER_TEST: {
215+
phase: "run-ib-component-tests",
216+
makeTarget: "run-ib-component-tests",
217+
description: "Run the test for image-builder component",
218+
},
219+
SERVER_TEST: {
220+
phase: "run-server-component-tests",
221+
makeTarget: "run-server-component-tests",
222+
description: "Run the test for server component",
223+
},
224+
WS_DAEMON_TEST: {
225+
phase: "run-wsd-component-tests",
226+
makeTarget: "run-wsd-component-tests",
227+
description: "Run the test for ws-daemon component",
228+
},
229+
WS_MNGR_TEST: {
230+
phase: "run-wsm-component-tests",
231+
makeTarget: "run-wsm-component-tests",
232+
description: "Run the test for ws-manager component",
194233
},
195234
}
196235

@@ -250,6 +289,8 @@ if (upgrade === "true") {
250289
`werft log result -d "self-hosted preview url" url "https://${process.env["TF_VAR_TEST_ID"]}.tests.gitpod-self-hosted.com"`,
251290
);
252291

292+
exec(`werft log result -d "Terraform state" url "Terraform state file name is ${process.env["TF_VAR_TEST_ID"]}"`);
293+
253294
werft.done("print-output");
254295
} else {
255296
// if we are not doing preview, we delete the infrastructure
@@ -261,7 +302,7 @@ function runIntegrationTests() {
261302
werft.phase("run-integration-tests", "Run all existing integration tests");
262303
for (let test in TESTS) {
263304
const testPhase = TESTS[test];
264-
// we just let tests fail
305+
// todo(nvn): handle the test failures by alerting teams
265306
const ret = callMakeTargets(testPhase.phase, testPhase.description, testPhase.makeTarget);
266307
if (ret) {
267308
exec(

install/tests/Makefile

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,36 @@ check-gitpod-installation: delete-cm-setup check-kots-app check-env-sub-domain
221221
@echo "Curling http://${TF_VAR_TEST_ID}.tests.gitpod-self-hosted.com/api/version"
222222
curl -i -X GET http://${TF_VAR_TEST_ID}.tests.gitpod-self-hosted.com/api/version || { echo "Curling Gitpod endpoint failed"; exit 1; }
223223

224-
run-tests:
225-
./tests.sh ${KUBECONFIG}
224+
define runtests
225+
./tests.sh ${KUBECONFIG} $(1)
226+
endef
227+
228+
run-workspace-tests:
229+
$(call runtests,"test/tests/workspace/")
230+
231+
run-vscode-ide-tests:
232+
$(call runtests,"test/tests/ide/vscode/")
233+
234+
run-jb-ide-tests:
235+
$(call runtests,"test/tests/ide/jetbrains/")
236+
237+
run-cs-component-tests:
238+
$(call runtests,"test/tests/components/content-service/")
239+
240+
run-db-component-tests:
241+
$(call runtests,"test/tests/components/database/")
242+
243+
run-ib-component-tests:
244+
$(call runtests,"test/tests/components/image-builder/")
245+
246+
run-server-component-tests:
247+
$(call runtests,"test/tests/components/content-service/")
248+
249+
run-wsd-component-tests:
250+
$(call runtests,"test/tests/components/ws-daemon/")
251+
252+
run-wsm-component-tests:
253+
$(call runtests,"test/tests/components/ws-manager/")
226254

227255
kots-upgrade:
228256
@echo "Upgrade gitpod KOTS app to latest"

install/tests/install/infra/terraform/eks/providers.tf

Whitespace-only changes.

install/tests/tests.sh

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,25 @@
33
# Licensed under the GNU Affero General Public License (AGPL).
44
# See License-AGPL.txt in the project root for license information.
55

6-
# exclude 'e' (exit on any error)
7-
# there are many test binaries, each can have failures
8-
9-
TEST_DIR="../../test/tests"
10-
11-
# shellcheck disable=SC2045
12-
FAILURE_COUNT=0
136
CURRENT=$(pwd)
14-
for i in $(find ${TEST_DIR} -type d -links 2 ! -empty | sort); do
15-
# Will print */ if no directories are available
16-
TEST_NAME=$(basename "${i}")
17-
echo "running integration for ${TEST_NAME}"
7+
TESTPATH="../../$2"
8+
DATE_BIN=$(command -v date)
9+
DATE=$(${DATE_BIN} +%y-%m-%d--%H:%M:%S)
10+
11+
echo "Starting test on ${DATE} for ${TESTPATH}"
1812

19-
cd "${i}" || echo "Path invalid for ${TEST_NAME}"
20-
go test -v ./... "-kubeconfig=$1" -namespace=gitpod -username=gitpod-integration-test 2>&0
21-
TEST_STATUS=$?
22-
if [ "$TEST_STATUS" -ne "0" ]; then
23-
FAILURE_COUNT=$((FAILURE_COUNT+1))
24-
echo "Test failed at $(date)"
25-
else
26-
echo "Test succeeded at $(date)"
27-
fi;
13+
cd "${TESTPATH}" || echo "Path invalid ${TESTPATH}"
2814

29-
cd "${CURRENT}" || echo "Couldn't move back to test dir"
30-
done
15+
go test -v ./... "-kubeconfig=$1" -namespace=gitpod -username=gitpod-integration-test 2>&0 -coverprofile=coverage.out
3116

32-
if [ "$FAILURE_COUNT" -ne "0" ]; then
33-
echo "Test suite ended with failure at $(date)"
34-
exit $FAILURE_COUNT
17+
TEST_STATUS=$?
18+
echo ${TEST_STATUS}
19+
if [ "$TEST_STATUS" -ne "0" ]; then
20+
echo "Test failed for ${TESTPATH} at ${DATE}"
21+
exit 1
22+
else
23+
echo "Test succeeded for ${TESTPATH} at ${DATE}"
24+
exit 0
3525
fi;
3626

37-
echo "Test suite ended with success at $(date)"
27+
cd "${CURRENT}" || echo "Couldn't move back to test dir"

0 commit comments

Comments
 (0)