Skip to content

Commit 6807e96

Browse files
Merge pull request #135 from XavierGeerinck/master
ci: add e2e testing to ci system
2 parents 3e412b2 + f9780cf commit 6807e96

File tree

4 files changed

+67
-11
lines changed

4 files changed

+67
-11
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ jobs:
3636
env:
3737
CI: true
3838

39-
- run: npm run test:unit
39+
- run: npm run test:unit:main
40+
- run: npm run test:unit:actors
4041

4142
- name: Is Release?
4243
if: startswith(github.ref, 'refs/tags/v')

.github/workflows/test-e2e.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Test - E2E
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- release-*
8+
tags:
9+
- v*
10+
pull_request:
11+
branches:
12+
- master
13+
- release-*
14+
15+
jobs:
16+
test-e2e:
17+
runs-on: ubuntu-latest
18+
env:
19+
NODE_VER: 14.17.6
20+
DAPR_INSTALL_URL: https://raw.githubusercontent.com/dapr/cli/master/install/install.sh
21+
services:
22+
emqx:
23+
image: emqx/emqx
24+
ports:
25+
- 1883:1883
26+
- 8081:8081
27+
- 8083:8083
28+
- 8883:8883
29+
# - 8084:8084 // this port is already used?
30+
- 18083:18083
31+
steps:
32+
- uses: actions/checkout@v2
33+
34+
# Setup .npmrc file to publish to npm
35+
# https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
36+
- name: NodeJS - Install
37+
uses: actions/setup-node@v2
38+
with:
39+
node-version: ${{ env.NODE_VER }}
40+
registry-url: 'https://registry.npmjs.org'
41+
42+
- name: Dapr - Install CLI
43+
run: wget -q ${{ env.DAPR_INSTALL_URL }} -O - | /bin/bash -s ${{ env.DAPR_CLI_VER }}
44+
45+
- name: Dapr - Initialize
46+
run: dapr init
47+
48+
- name: Install Dependencies
49+
run: npm i
50+
51+
- run: npm run test:unit:main
52+
- run: npm run test:unit:actors
53+
- run: npm run test:e2e:grpc:main
54+
- run: npm run test:e2e:http:main
55+
- run: npm run test:e2e:http:actors

documentation/development.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ Run the following commands to configure the library
1010
1111
```bash
1212
npm install
13-
npm run test
1413
```
1514

1615
## Running the Library
@@ -38,7 +37,8 @@ Tests are written per protocol layer: http or grpc. This is done because Dapr re
3837
docker run -d --rm --name emqx -p 1883:1883 -p 8081:8081 -p 8083:8083 -p 8883:8883 -p 8084:8084 -p 18083:18083 emqx/emqx
3938

4039
# Run Unit Tests
41-
npm run test:unit
40+
npm run test:unit:main
41+
npm run test:unit:actors
4242

4343
# Start gRPC tests
4444
npm run test:e2e:grpc:main

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"description": "The official Dapr (https://dapr.io) SDK for Node.js",
55
"types": "http/index.d.ts",
66
"scripts": {
7-
"test": "jest --runInBand --detectOpenHandles",
8-
"test:e2e:grpc:main": "TEST_SECRET_1=secret_val_1 TEST_SECRET_2=secret_val_2 dapr run --app-id test-suite --app-protocol grpc --app-port 50001 --dapr-grpc-port 50000 --components-path ./test/components npm run test 'test/e2e/main.grpc.test.ts'",
9-
"test:e2e:http:main": "TEST_SECRET_1=secret_val_1 TEST_SECRET_2=secret_val_2 dapr run --app-id test-suite --app-protocol http --app-port 50001 --dapr-http-port 50000 --components-path ./test/components npm run test 'test/e2e/main.http.test.ts'",
10-
"test:e2e:http:actors": "dapr run --app-id test-suite --app-protocol http --app-port 50001 --dapr-http-port 50000 --components-path ./test/components npm run test 'test/e2e/actors.http.test.ts'",
11-
"test:unit": "NODE_ENV=test npm run test 'test/unit/.*\\.test\\.ts'",
12-
"test:unit:main": "NODE_ENV=test npm run test 'test/unit/main/.*\\.test\\.ts'",
13-
"test:unit:actors": "NODE_ENV=test npm run test 'test/unit/actor/.*\\.test\\.ts'",
7+
"test:e2e": "jest --runInBand --detectOpenHandles --forceExit",
8+
"test:e2e:grpc:main": "TEST_SECRET_1=secret_val_1 TEST_SECRET_2=secret_val_2 dapr run --app-id test-suite --app-protocol grpc --app-port 50001 --dapr-grpc-port 50000 --components-path ./test/components npm run test:e2e 'test/e2e/main.grpc.test.ts'",
9+
"test:e2e:http:main": "TEST_SECRET_1=secret_val_1 TEST_SECRET_2=secret_val_2 dapr run --app-id test-suite --app-protocol http --app-port 50001 --dapr-http-port 50000 --components-path ./test/components npm run test:e2e 'test/e2e/main.http.test.ts'",
10+
"test:e2e:http:actors": "dapr run --app-id test-suite --app-protocol http --app-port 50001 --dapr-http-port 50000 --components-path ./test/components npm run test:e2e 'test/e2e/actors.http.test.ts'",
11+
"test:unit": "jest --runInBand --detectOpenHandles",
12+
"test:unit:main": "NODE_ENV=test npm run test:unit 'test/unit/main/.*\\.test\\.ts'",
13+
"test:unit:actors": "NODE_ENV=test npm run test:unit 'test/unit/actor/.*\\.test\\.ts'",
1414
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
1515
"build": "./scripts/build.sh",
1616
"start:dev": "npm run build && nodemon --ext \".ts,.js\" --watch \"./src\" --exec \"npm run build\""
@@ -51,4 +51,4 @@
5151
"url": "https://github.com/dapr/js-sdk.git",
5252
"directory": ""
5353
}
54-
}
54+
}

0 commit comments

Comments
 (0)