shorten sleeps and return errors for node processes properly
TODO: make sure that nodejs processes stops properly @staltz shared a nice page to debug this better: https://devdocs.io/node~8_lts/process#process_event_uncaughtexception
This commit is contained in:
parent
ca0835bb34
commit
48d7e92667
|
@ -60,7 +60,8 @@ func TestLegacyJSEndToEnd(t *testing.T) {
|
|||
)
|
||||
t.Log("this is claire:", claire.Ref())
|
||||
|
||||
time.Sleep(20 * time.Second)
|
||||
t.Log("waiting for process exits")
|
||||
time.Sleep(45 * time.Second)
|
||||
|
||||
ts.wait()
|
||||
}
|
||||
|
|
|
@ -37,14 +37,14 @@ function bufFromEnv(evname) {
|
|||
|
||||
tape.createStream().pipe(process.stderr)
|
||||
tape(testName, function (t) {
|
||||
let timeoutLength = 15000
|
||||
let timeoutLength = 30000
|
||||
var tapeTimeout = null
|
||||
function ready() { // needs to be called by the before block when it's done
|
||||
t.timeoutAfter(timeoutLength) // doesn't exit the process
|
||||
tapeTimeout = setTimeout(() => {
|
||||
t.comment('test timeout')
|
||||
process.exit(1)
|
||||
}, timeoutLength*1.25)
|
||||
}, timeoutLength)
|
||||
const to = `net:${testPeerAddr}~shs:${testPeerRef.substr(1).replace('.ed25519', '')}`
|
||||
t.comment('dialing:' + to)
|
||||
sbot.conn.connect(to, (err, rpc) => {
|
||||
|
@ -56,7 +56,7 @@ tape(testName, function (t) {
|
|||
|
||||
function exit() { // call this when you're done
|
||||
sbot.close()
|
||||
t.comment('closed sbot')
|
||||
t.comment('closed client: '+testName)
|
||||
clearTimeout(tapeTimeout)
|
||||
t.end()
|
||||
process.exit(0)
|
||||
|
|
|
@ -34,9 +34,10 @@ tape(testName, function (t) {
|
|||
|
||||
function exit() { // call this when you're done
|
||||
sbot.close()
|
||||
t.comment('closed jsbot')
|
||||
t.comment('closed server: '+testName)
|
||||
// clearTimeout(tapeTimeout)
|
||||
t.end()
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
const tempRepo = process.env['TEST_REPO']
|
||||
|
|
|
@ -171,9 +171,9 @@ func (ts *testSession) startJSClient(name, testScript string, peerAddr net.Addr,
|
|||
ts.done.Go(func() error {
|
||||
err := cmd.Wait()
|
||||
if err != nil {
|
||||
ts.t.Logf("node server %s: exited with %s", name, err)
|
||||
ts.t.Logf("node client %s: exited with %s", name, err)
|
||||
}
|
||||
return nil
|
||||
return err
|
||||
})
|
||||
ts.t.Cleanup(func() {
|
||||
cmd.Process.Kill()
|
||||
|
@ -227,7 +227,7 @@ func (ts *testSession) startJSBotAsServer(name, testScriptFileName string) (*ref
|
|||
if err != nil {
|
||||
ts.t.Logf("node server %s: exited with %s", name, err)
|
||||
}
|
||||
return nil
|
||||
return err
|
||||
})
|
||||
ts.t.Cleanup(func() {
|
||||
cmd.Process.Kill()
|
||||
|
|
|
@ -22,7 +22,7 @@ module.exports = {
|
|||
console.warn('left failed')
|
||||
throw err
|
||||
})
|
||||
}, 5000)
|
||||
}, 3000)
|
||||
})
|
||||
|
||||
// announce ourselves to the room/tunnel
|
||||
|
|
|
@ -10,13 +10,6 @@ module.exports = {
|
|||
before: (client, ready) => {
|
||||
// nothing to prepare (like publishes messages, or...)
|
||||
ready()
|
||||
|
||||
// let msg = {
|
||||
// type: 'test',
|
||||
// }
|
||||
// client.publish(msg, (err) => {
|
||||
// if (err) throw err
|
||||
// })
|
||||
},
|
||||
|
||||
after: (client, roomSrvRpc, exit) => {
|
||||
|
@ -58,7 +51,7 @@ module.exports = {
|
|||
if (err) throw err
|
||||
console.warn("ping:", id)
|
||||
|
||||
// start leaving after 2s
|
||||
// start leaving after 1s
|
||||
setTimeout(() => {
|
||||
roomSrvRpc.tunnel.leave().then((ret) => {
|
||||
console.warn('left room... exiting in 3s')
|
||||
|
@ -67,7 +60,7 @@ module.exports = {
|
|||
console.warn('left failed')
|
||||
throw err
|
||||
})
|
||||
}, 2000)
|
||||
}, 1000)
|
||||
})
|
||||
})
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
const pull = require('pull-stream')
|
||||
|
||||
let connections = 0
|
||||
|
||||
module.exports = {
|
||||
secretStackPlugins: ['ssb-conn', 'ssb-room/tunnel/server'],
|
||||
|
||||
|
@ -14,8 +16,12 @@ module.exports = {
|
|||
},
|
||||
|
||||
after: (sbot, client, exit) => {
|
||||
// hrm.. this runs twice (for each connection)
|
||||
console.warn('server new connection:', client.id)
|
||||
setTimeout(exit, 30000)
|
||||
// this runs twice (for each connection)
|
||||
connections++
|
||||
console.warn('server new connection:', client.id, connections)
|
||||
|
||||
if (connections == 2) {
|
||||
setTimeout(exit, 15000)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -10,13 +10,6 @@ module.exports = {
|
|||
before: (client, ready) => {
|
||||
// nothing to prepare (like publishes messages, or...)
|
||||
ready()
|
||||
|
||||
// let msg = {
|
||||
// type: 'test',
|
||||
// }
|
||||
// client.publish(msg, (err) => {
|
||||
// if (err) throw err
|
||||
// })
|
||||
},
|
||||
|
||||
after: (client, roomSrvRpc, exit) => {
|
||||
|
|
Loading…
Reference in New Issue