Run tests on windows, disable proxy test on ubuntu CI runner (#125)

This commit is contained in:
extremeheat 2021-08-09 23:16:17 -04:00 committed by GitHub
commit 37244db6dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 15 deletions

View file

@ -5,15 +5,20 @@ on:
branches: [ '*', '!gh-pages' ]
pull_request:
branches: [ '*', '!gh-pages' ]
workflow_dispatch:
inputs:
via:
description: 'trigger origin'
required: true
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
node-version: [14.x]
os: [ubuntu-latest, windows-latest]
node-version: [16.x]
runs-on: ${{ matrix.os }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}

View file

@ -17,12 +17,17 @@ describe('internal client/server test', function () {
})
}
for (const version in Versions) {
it('proxies ' + version, async () => {
console.debug(version)
await proxyTest(version)
await sleep(5000)
console.debug('Done', version)
})
if (process.env.CI && process.platform === 'linux') {
// Don't run the test, see :
// https://github.com/PrismarineJS/bedrock-protocol/issues/124
} else {
for (const version in Versions) {
it('proxies ' + version, async () => {
console.debug(version)
await proxyTest(version)
await sleep(5000)
console.debug('Done', version)
})
}
}
})

View file

@ -3,9 +3,11 @@ const { sleep, waitFor } = require('../src/datatypes/util')
function proxyTest (version, timeout = 1000 * 40) {
return waitFor(res => {
const SERVER_PORT = 19000 + ((Math.random() * 100) | 0)
const CLIENT_PORT = 19000 + ((Math.random() * 100) | 0)
const server = createServer({
host: '0.0.0.0', // optional
port: 19131, // optional
port: SERVER_PORT, // optional
offline: true,
version // The server version
})
@ -27,11 +29,11 @@ function proxyTest (version, timeout = 1000 * 40) {
offline: true,
/* host and port for clients to listen to */
host: '0.0.0.0',
port: 19132,
port: CLIENT_PORT,
/* Where to send upstream packets to */
destination: {
host: '127.0.0.1',
port: 19131
port: SERVER_PORT
}
})
relay.conLog = console.debug
@ -39,7 +41,7 @@ function proxyTest (version, timeout = 1000 * 40) {
console.debug('Proxy started', server.options.version)
const client = createClient({ host: '127.0.0.1', version, username: 'Boat', offline: true })
const client = createClient({ host: '127.0.0.1', port: CLIENT_PORT, version, username: 'Boat', offline: true })
console.debug('Client started')