-
Notifications
You must be signed in to change notification settings - Fork 525
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix error message in websocket * add autobahn suite * fix opcode tests * fix: rsv bits must be clear * add autobahn workflow * run autobahn on pull_request event * fix case 5.18 * add commenting of status into PR * add permission --------- Co-authored-by: uzlopak <aras.abbasi@googlemail.com>
- Loading branch information
Showing
11 changed files
with
341 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: Autobahn | ||
on: | ||
workflow_dispatch: | ||
|
||
pull_request: | ||
paths: | ||
- '.github/workflows/autobahn.yml' | ||
- 'lib/web/websocket/**' | ||
- 'test/autobahn/**' | ||
|
||
permissions: | ||
contents: read | ||
pull-requests: write | ||
|
||
jobs: | ||
autobahn: | ||
name: Autobahn Test Suite | ||
runs-on: ubuntu-latest | ||
container: node:22 | ||
services: | ||
fuzzingserver: | ||
image: crossbario/autobahn-testsuite:latest | ||
ports: | ||
- '9001:9001' | ||
options: --name fuzzingserver | ||
volumes: | ||
- ${{ github.workspace }}/test/autobahn/config:/config | ||
- ${{ github.workspace }}/test/autobahn/reports:/reports | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 | ||
with: | ||
persist-credentials: false | ||
clean: false | ||
|
||
- name: Restart Autobahn Server | ||
# Restart service after volumes have been checked out | ||
uses: docker://docker | ||
with: | ||
args: docker restart --time 0 --signal=SIGKILL fuzzingserver | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 | ||
with: | ||
node-version: 22 | ||
|
||
- name: Run Autobahn Test Suite | ||
run: npm run test:websocket:autobahn | ||
env: | ||
FUZZING_SERVER_URL: ws://fuzzingserver:9001 | ||
|
||
- name: Report into CI | ||
id: report-ci | ||
run: npm run test:websocket:autobahn:report | ||
|
||
- name: Generate Report for PR Comment | ||
if: github.event_name == 'pull_request' | ||
id: report-markdown | ||
run: | | ||
echo "comment<<nEOFn" >> $GITHUB_OUTPUT | ||
node test/autobahn/report.js >> $GITHUB_OUTPUT | ||
echo "nEOFn" >> $GITHUB_OUTPUT | ||
env: | ||
REPORTER: markdown | ||
|
||
- name: Comment PR | ||
if: github.event_name == 'pull_request' | ||
uses: thollander/actions-comment-pull-request@v2 | ||
with: | ||
message: ${{ steps.report-markdown.outputs.comment }} | ||
comment_tag: autobahn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
reports/clients |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
'use strict' | ||
|
||
const { WebSocket } = require('../..') | ||
|
||
let currentTest = 1 | ||
let testCount | ||
|
||
const autobahnFuzzingserverUrl = process.env.FUZZING_SERVER_URL || 'ws://localhost:9001' | ||
|
||
function nextTest () { | ||
let ws | ||
|
||
if (currentTest > testCount) { | ||
ws = new WebSocket(`${autobahnFuzzingserverUrl}/updateReports?agent=undici`) | ||
return | ||
} | ||
|
||
console.log(`Running test case ${currentTest}/${testCount}`) | ||
|
||
ws = new WebSocket( | ||
`${autobahnFuzzingserverUrl}/runCase?case=${currentTest}&agent=undici` | ||
) | ||
ws.addEventListener('message', (data) => { | ||
ws.send(data.data) | ||
}) | ||
ws.addEventListener('close', () => { | ||
currentTest++ | ||
process.nextTick(nextTest) | ||
}) | ||
ws.addEventListener('error', (e) => { | ||
console.error(e.error) | ||
}) | ||
} | ||
|
||
const ws = new WebSocket(`${autobahnFuzzingserverUrl}/getCaseCount`) | ||
ws.addEventListener('message', (data) => { | ||
testCount = parseInt(data.data) | ||
}) | ||
ws.addEventListener('close', () => { | ||
if (testCount > 0) { | ||
nextTest() | ||
} | ||
}) | ||
ws.addEventListener('error', (e) => { | ||
console.error(e.error) | ||
process.exit(1) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"url": "ws://127.0.0.1:9001", | ||
"outdir": "./reports/clients", | ||
"cases": ["*"], | ||
"exclude-cases": [], | ||
"exclude-agent-cases": {} | ||
} |
Oops, something went wrong.