Skip to content

Commit

Permalink
Add timeout in test
Browse files Browse the repository at this point in the history
  • Loading branch information
Powersource committed Nov 7, 2023
1 parent bf6a4f9 commit ad16847
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions test/from-old-versions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,18 @@ test('can continue from old keyring from ssb-tribes 3.1.3', async t => {
// we have to do it this way because we have no normal way of killing a bot that's crashed and therefore releasing its DB locks.
const throwChild = childProcess.fork(join(__dirname, 'helpers/throw-bot.js'))

await new Promise((res) => {
throwChild.on("message", (msg) => {
await new Promise((resolve) => {
throwChild.on('message', (msg) => {
t.match(msg, /found an old keystore/, "error when there's an old keystore but we don't use it")

throwChild.kill()

res()
resolve()
})
})

await p(setTimeout)(500)

const newOpts = {
name: 'alice',
startUnclean: true
Expand Down
4 changes: 2 additions & 2 deletions test/helpers/test-bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = function TestBot (opts = {}) {
.use(require('ssb-classic'))
.use(require('ssb-db2/compat'))
.use(require('ssb-db2/compat/feedstate'))
.use(require("ssb-db2/compat/post"))
.use(require('ssb-db2/compat/post'))
.use(require('ssb-box2'))
.use(require('../..'))

Expand All @@ -31,7 +31,7 @@ module.exports = function TestBot (opts = {}) {
...opts.box2
},
// we don't want testbot to import db1 or db2 for us, we want to control what db2 plugins get imported
noDefaultUse: true,
noDefaultUse: true
})

if (opts.debug) {
Expand Down

0 comments on commit ad16847

Please sign in to comment.