Skip to content

Commit 52f5b52

Browse files
committed
refactor: s/ test:standalone with test:integration
This replaces our integration approach to use Jest instead of a single bash script. By doing this, we will be able to easily maintain and add to our integration test suite.
1 parent 62d8361 commit 52f5b52

File tree

5 files changed

+52
-11
lines changed

5 files changed

+52
-11
lines changed

.github/workflows/ci.yaml

+10-4
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,11 @@ jobs:
288288
- name: Build standalone release
289289
run: source scl_source enable devtoolset-9 && yarn release:standalone
290290

291-
- name: Sanity test standalone release
292-
run: yarn test:standalone-release
291+
- name: Install test dependencies
292+
run: yarn install --ignore-scripts && cd test && yarn install
293+
294+
- name: Run integration tests on standalone release
295+
run: yarn test:integration
293296

294297
- name: Build packages with nfpm
295298
run: yarn package
@@ -421,8 +424,11 @@ jobs:
421424
- name: Build standalone release
422425
run: yarn release:standalone
423426

424-
- name: Sanity test standalone release
425-
run: yarn test:standalone-release
427+
- name: Install test dependencies
428+
run: yarn install --ignore-scripts && cd test && yarn install
429+
430+
- name: Run integration tests on standalone release
431+
run: yarn test:integration
426432

427433
- name: Build packages with nfpm
428434
run: yarn package

.github/workflows/installer.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
run: ./install.sh
3535

3636
- name: Test code-server
37-
run: yarn test:standalone-release code-server
37+
run: CODE_SERVER_PATH="code-server" yarn test:integration
3838

3939
alpine:
4040
name: Test installer on Alpine
@@ -66,4 +66,4 @@ jobs:
6666
run: ./install.sh
6767

6868
- name: Test code-server
69-
run: yarn test:standalone-release code-server
69+
run: CODE_SERVER_PATH="code-server" yarn test:integration

ci/dev/test-integration.sh

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
help() {
5+
echo >&2 " You can build the standalone release with 'yarn release:standalone'"
6+
echo >&2 " Or you can pass in a custom path."
7+
echo >&2 " CODE_SERVER_PATH='/var/tmp/coder/code-server/bin/code-server' yarn test:integration"
8+
}
9+
10+
# Make sure a code-server release works. You can pass in the path otherwise it
11+
# will look for release-standalone in the current directory.
12+
#
13+
# This is to make sure we don't have Node version errors or any other
14+
# compilation-related errors.
15+
main() {
16+
cd "$(dirname "$0")/../.."
17+
18+
local path="./release-standalone/bin/code-server"
19+
if [[ ! ${CODE_SERVER_PATH-} ]]; then
20+
echo "Set CODE_SERVER_PATH to test another build of code-server"
21+
else
22+
path="$CODE_SERVER_PATH"
23+
fi
24+
25+
echo "Running tests with code-server binary: '$path'"
26+
27+
if [[ ! -f $path ]]; then
28+
echo >&2 "No code-server build detected"
29+
echo >&2 "Looked in $path"
30+
help
31+
exit 1
32+
fi
33+
34+
CODE_SERVER_PATH="$path" CS_DISABLE_PLUGINS=true ./test/node_modules/.bin/jest "$@" --coverage=false --testRegex "./test/integration"
35+
}
36+
37+
main "$@"

docs/CONTRIBUTING.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ Build the release packages (make sure that you run `yarn release` first):
147147

148148
```shell
149149
yarn release:standalone
150-
yarn test:standalone-release
150+
yarn test:integration
151151
yarn package
152152
```
153153

@@ -188,9 +188,7 @@ We use these to test anything related to our scripts (most of which live under `
188188

189189
### Integration tests
190190

191-
These are a work in progress. We build code-server and run a script called
192-
[test-standalone-release.sh](../ci/build/test-standalone-release.sh), which
193-
ensures that code-server's CLI is working.
191+
These are a work in progress. We build code-server and run tests with `yarn test:integration`, which ensures that code-server's binary works.
194192

195193
Our integration tests look at components that rely on one another. For example,
196194
testing the CLI requires us to build and package code-server.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
"release:github-assets": "./ci/build/release-github-assets.sh",
1919
"release:prep": "./ci/build/release-prep.sh",
2020
"test:e2e": "VSCODE_IPC_HOOK_CLI= ./ci/dev/test-e2e.sh",
21-
"test:standalone-release": "./ci/build/test-standalone-release.sh",
2221
"test:unit": "./ci/dev/test-unit.sh --forceExit --detectOpenHandles",
22+
"test:integration": "./ci/dev/test-integration.sh",
2323
"test:scripts": "./ci/dev/test-scripts.sh",
2424
"package": "./ci/build/build-packages.sh",
2525
"postinstall": "./ci/dev/postinstall.sh",

0 commit comments

Comments
 (0)