Skip to content

Commit

Permalink
test: programatically wait
Browse files Browse the repository at this point in the history
Signed-off-by: Aaron Sutula <[email protected]>
  • Loading branch information
asutula committed Jun 9, 2020
1 parent d7fc65c commit 057105d
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 3 deletions.
4 changes: 4 additions & 0 deletions docker-compose-devnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@ services:

lotus:
image: textile/lotus-devnet:sha-a364621
ports:
- 7777:7777
environment:
- TEXLOTUSDEVNET_SPEED=500
- TEXLOTUSDEVNET_IPFSADDR=/dns4/ipfs/tcp/5001

ipfs:
image: ipfs/go-ipfs:v0.5.1
ports:
- 5001:5001
environment:
- IPFS_PROFILE=local-discovery
103 changes: 103 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"@types/dirty-chai": "^2.0.2",
"@types/mocha": "^7.0.2",
"@types/node": "^14.0.4",
"@types/wait-on": "^4.0.0",
"@typescript-eslint/eslint-plugin": "^2.26.0",
"@typescript-eslint/parser": "^2.26.0",
"chai": "^4.2.0",
Expand All @@ -51,7 +52,8 @@
"ts-loader": "^7.0.4",
"ts-node": "^8.8.1",
"typedoc": "^0.17.3",
"typescript": "^3.8.3"
"typescript": "^3.8.3",
"wait-on": "^5.0.1"
},
"husky": {
"hooks": {
Expand Down
9 changes: 7 additions & 2 deletions src/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
import { expect } from "chai"
import cp from "child_process"
import path from "path"
import wait from "wait-on"

import { createPow } from "."
import { host } from "./util"

const p = path.join(__dirname, "../docker-compose-devnet.yml")

before(async function () {
this.timeout(60000)
this.timeout(130000)
cp.exec(`docker-compose -p devnet -f ${p} up --build -V --detach`, (err) => {
if (err) {
throw err
}
})
await new Promise((r) => setTimeout(r, 50000))
await wait({
resources: ["tcp:6002", "tcp:7777", "tcp:5001"],
timeout: 120000,
})
await new Promise((r) => setTimeout(r, 10000))
})

after(() => {
Expand Down

0 comments on commit 057105d

Please sign in to comment.