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