ci: make vweb and websocket tests more robust to transient errors
parent
28088cc494
commit
746dfe6317
|
@ -7,7 +7,7 @@ import io
|
||||||
|
|
||||||
const (
|
const (
|
||||||
sport = 12380
|
sport = 12380
|
||||||
exit_after_time = 7000 // milliseconds
|
exit_after_time = 9000 // milliseconds
|
||||||
vexe = os.getenv('VEXE')
|
vexe = os.getenv('VEXE')
|
||||||
vweb_logfile = os.getenv('VWEB_LOGFILE')
|
vweb_logfile = os.getenv('VWEB_LOGFILE')
|
||||||
vroot = os.dir(vexe)
|
vroot = os.dir(vexe)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import x.websocket
|
import x.websocket
|
||||||
import time
|
import time
|
||||||
|
import rand
|
||||||
|
|
||||||
struct WebsocketTestResults {
|
struct WebsocketTestResults {
|
||||||
pub mut:
|
pub mut:
|
||||||
|
@ -9,13 +10,14 @@ pub mut:
|
||||||
|
|
||||||
// tests with internal ws servers
|
// tests with internal ws servers
|
||||||
fn test_ws() {
|
fn test_ws() {
|
||||||
go start_server()
|
port := 30000 + rand.intn(1024)
|
||||||
time.sleep_ms(100)
|
go start_server(port)
|
||||||
ws_test('ws://localhost:30000') or { assert false }
|
time.sleep_ms(500)
|
||||||
|
ws_test('ws://localhost:$port') or { assert false }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn start_server() ? {
|
fn start_server(listen_port int) ? {
|
||||||
mut s := websocket.new_server(30000, '')
|
mut s := websocket.new_server(listen_port, '')
|
||||||
// make that in execution test time give time to execute at least one time
|
// make that in execution test time give time to execute at least one time
|
||||||
s.ping_interval = 1
|
s.ping_interval = 1
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue