Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dryajov committed Jun 7, 2018
1 parent 6cd92d9 commit d37c6a6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 22 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,11 @@ Start the daemon.

Stop the daemon.

`callback` is a function with the signature `function(err)` callback - function that receives an instance of `Error` on failure. Use timeout to specify the grace period before hard stopping the daemon. Otherwise, a grace period of `10500` will be used for disposable nodes and `10500 * 3` for non disposable nodes.
`callback` is a function with the signature `function(err)` callback - function that receives an instance of `Error` on failure. Use timeout to specify the grace period in ms before hard stopping the daemon. Otherwise, a grace period of `10500` ms will be used for disposable nodes and `10500 * 3` ms for non disposable nodes.

#### `ipfsd.killProcess([timeout, callback])`

Kill the `ipfs daemon` process. Use timeout to specify the grace period before hard stopping the daemon. Otherwise, a grace period of `10500` will be used for disposable nodes and `10500 * 3` for non disposable nodes.
Kill the `ipfs daemon` process. Use timeout to specify the grace period in ms before hard stopping the daemon. Otherwise, a grace period of `10500` ms will be used for disposable nodes and `10500 * 3` ms for non disposable nodes.

Note: timeout is ignored for `proc` nodes

Expand Down
22 changes: 2 additions & 20 deletions test/start-stop.node.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,30 +211,12 @@ tests.forEach((fOpts) => {
expect(api.id).to.exist()
})

it('.stop', function (done) {
this.timeout(20 * 1000)

ipfsd.stop((err) => {
expect(err).to.not.exist()
let tries = 5

const interval = setInterval(() => {
const running = isrunning(pid)
if (!running || tries-- <= 0) {
clearInterval(interval)
expect(running).to.not.be.ok()
stopped = true
done()
}
}, 200)
})
})

it('.stop with timeout', function (done) {
this.timeout(15000 + 10) // should not take longer than timeout
ipfsd.stop(15000, (err) => {
expect(err).to.not.exist()
expect(isrunning(pid)).to.not.be.ok()
stopped = !isrunning(pid)
expect(stopped).to.be.ok()
done()
})
})
Expand Down

0 comments on commit d37c6a6

Please sign in to comment.