Skip to content

Commit 7816433

Browse files
authored
chore: enable concurrency conformance test (#470)
* chore: enable concurrency conformance test Also, refactor conformance test Action to call the client directory, similar to how one would run it locally.
1 parent 6e74318 commit 7816433

File tree

2 files changed

+52
-38
lines changed

2 files changed

+52
-38
lines changed

.github/workflows/conformance.yml

Lines changed: 48 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ jobs:
1212
- name: Checkout code
1313
uses: actions/checkout@v3
1414

15-
- name: Setup Go
16-
uses: actions/setup-go@v3
17-
1815
- name: Use Node.js ${{ matrix.node-version }}
1916
uses: actions/setup-node@v3
2017
with:
@@ -27,47 +24,60 @@ jobs:
2724
working-directory: ./test/conformance
2825
run: npm install
2926

30-
- name: Run HTTP conformance tests using legacy API
31-
uses: GoogleCloudPlatform/functions-framework-conformance/action@v1.4.1
27+
- name: Install conformance client
28+
uses: GoogleCloudPlatform/functions-framework-conformance/.github/actions/client/install@v1.7.0
3229
with:
33-
functionType: 'http'
34-
useBuildpacks: false
35-
validateMapping: false
36-
workingDirectory: 'test/conformance'
37-
cmd: "'npm start -- --target=writeHttp --signature-type=http'"
30+
client-version: v1.7.0
31+
cache-path: ~/client
32+
cache-key: conformance-client-v1.7.0
33+
34+
- name: Run HTTP conformance tests using legacy API
35+
working-directory: 'test/conformance'
36+
run: |
37+
~/client \
38+
-type=http \
39+
-buildpacks=false \
40+
-cmd="npm start -- --target=writeHttp --signature-type=http"
3841
3942
- name: Run event conformance tests using legacy API
40-
uses: GoogleCloudPlatform/functions-framework-conformance/[email protected]
41-
with:
42-
functionType: 'legacyevent'
43-
useBuildpacks: false
44-
validateMapping: true
45-
workingDirectory: 'test/conformance'
46-
cmd: "'npm start -- --target=writeLegacyEvent --signature-type=event'"
43+
working-directory: 'test/conformance'
44+
run: |
45+
~/client \
46+
-type=legacyevent \
47+
-buildpacks=false \
48+
-cmd="npm start -- --target=writeLegacyEvent --signature-type=event"
4749
4850
- name: Run cloudevent conformance tests using legacy API
49-
uses: GoogleCloudPlatform/functions-framework-conformance/[email protected]
50-
with:
51-
functionType: 'cloudevent'
52-
useBuildpacks: false
53-
validateMapping: true
54-
workingDirectory: 'test/conformance'
55-
cmd: "'npm start -- --target=writeCloudEvent --signature-type=cloudevent'"
51+
working-directory: 'test/conformance'
52+
run: |
53+
~/client \
54+
-type=cloudevent \
55+
-buildpacks=false \
56+
-cmd="npm start -- --target=writeCloudEvent --signature-type=cloudevent"
5657
5758
- name: Run HTTP conformance tests using declarative API
58-
uses: GoogleCloudPlatform/functions-framework-conformance/[email protected]
59-
with:
60-
functionType: 'http'
61-
useBuildpacks: false
62-
validateMapping: false
63-
workingDirectory: 'test/conformance'
64-
cmd: "'npm start -- --target=writeHttpDeclarative'"
59+
working-directory: 'test/conformance'
60+
run: |
61+
~/client \
62+
-type=http \
63+
-buildpacks=false \
64+
-validate-mapping=false \
65+
-cmd="npm start -- --target=writeHttpDeclarative"
6566
6667
- name: Run cloudevent conformance tests using declarative API
67-
uses: GoogleCloudPlatform/functions-framework-conformance/[email protected]
68-
with:
69-
functionType: 'cloudevent'
70-
useBuildpacks: false
71-
validateMapping: true
72-
workingDirectory: 'test/conformance'
73-
cmd: "'npm start -- --target=writeCloudEventDeclarative'"
68+
working-directory: 'test/conformance'
69+
run: |
70+
~/client \
71+
-type=cloudevent \
72+
-buildpacks=false \
73+
-validate-mapping=true \
74+
-cmd="npm start -- --target=writeCloudEventDeclarative"
75+
76+
- name: Run HTTP concurrency test
77+
working-directory: 'test/conformance'
78+
run: |
79+
~/client \
80+
-type=http \
81+
-buildpacks=false \
82+
-validate-concurrency=true \
83+
-cmd="npm start -- --target=concurrentHttp"

test/conformance/function.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ functions.cloudEvent('writeCloudEventDeclarative', cloudEvent => {
1313
writeJson(cloudEvent);
1414
});
1515

16+
functions.http('concurrentHttp', (req, res) => {
17+
setTimeout(() => res.send('done'), 1000);
18+
});
19+
1620
function writeHttp(req, res) {
1721
writeJson(req.body);
1822
res.sendStatus(200);

0 commit comments

Comments
 (0)