1
0
mirror of https://github.com/oceanprotocol-archive/squid-js.git synced 2024-02-02 15:31:51 +01:00

use Barge to run integration tests

This commit is contained in:
Pedro Gutiérrez 2019-01-11 11:17:42 +01:00 committed by Pedro Gutiérrez
parent 6195a6a557
commit b6713bfc81
17 changed files with 54 additions and 11 deletions

1
.gitignore vendored
View File

@ -2,6 +2,7 @@ node_modules/
dist/
.nyc_output/
coverage/
artifacts/
doc/
test/**/*.js
src/**/*.js

View File

@ -18,14 +18,19 @@ before_install:
before_script:
- greenkeeper-lockfile-update
- ganache-cli > ganache-cli.log &
- sleep 2
- ganache-cli --port 18545 > ganache-cli.log &
- git clone https://github.com/oceanprotocol/barge
- cd barge
- bash -x start_ocean.sh --latest --no-brizo --no-pleuston --local-nile-node 2>&1 > start_ocean.log &
- cd ..
script:
- npm run test:cover
- export ETH_PORT=18545; npm run test:cover
- npm run report-coverage
- npm run build
- npm run doc
# - ./scripts/wait_for_migration_and_extract_keeper_artifacts.sh
- ./src/examples/fire_lazers.sh
after_script:
- greenkeeper-lockfile-upload

View File

@ -0,0 +1,21 @@
#!/bin/bash
RETRY_COUNT=0
COMMAND_STATUS=1
mkdir -p artifacts
until [ $COMMAND_STATUS -eq 0 ] || [ $RETRY_COUNT -eq 120 ]; do
keeper_contracts_docker_id=$(docker container ls | grep keeper-contracts | awk '{print $1}')
docker cp ${keeper_contracts_docker_id}:/keeper-contracts/artifacts/ready ./artifacts/
COMMAND_STATUS=$?
sleep 5
let RETRY_COUNT=RETRY_COUNT+1
done
if [ $COMMAND_STATUS -ne 0 ]; then
echo "Waited for more than two minutes, but keeper contracts have not been migrated yet. Did you run an Ethereum RPC client and the migration script?"
exit 1
fi
docker cp ${keeper_contracts_docker_id}:/keeper-contracts/artifacts/. ./artifacts/

View File

@ -68,4 +68,6 @@ import config from "./config"
const paid = await serviceAgreement.payAsset(did.getId(), metaData.base.price, consumer)
Logger.log(`Asset paid: ${paid}`)
process.exit(0)
})()

View File

@ -6,7 +6,6 @@ import {Account, Logger, Ocean, ServiceAgreement} from "../squid"
import config from "./config"
(async () => {
const ocean: Ocean = await Ocean.getInstance(config)
const publisher: Account = (await ocean.getAccounts())[0]
@ -65,4 +64,5 @@ import config from "./config"
publisher)
Logger.log("ServiceAgreement Id:", serviceAgreement.getId())
process.exit(0)
})()

View File

@ -2,10 +2,11 @@ import {Logger, Ocean} from "../squid"
import config from "./config"
(async () => {
const ocean: Ocean = await Ocean.getInstance(config)
const accounts = await ocean.getAccounts()
Logger.log(JSON.stringify(accounts, null, 2))
process.exit(0)
})()

View File

@ -7,4 +7,6 @@ import config from "./config"
const accounts = await ocean.getAccounts()
Logger.log(await accounts[0].getBalance())
process.exit(0)
})()

View File

@ -7,4 +7,6 @@ import config from "./config"
const accounts = await ocean.getAccounts()
Logger.log(JSON.stringify(accounts, null, 2))
process.exit(0)
})()

View File

@ -71,4 +71,6 @@ import config from "./config"
const accessGranted = await serviceAgreement.grantAccess(did.getId(), did.getId(), publisher)
Logger.log(`Asset access granted: ${accessGranted}`)
process.exit(0)
})()

View File

@ -67,4 +67,5 @@ import config from "./config"
consumer,
)
process.exit(0)
})()

View File

@ -5,7 +5,6 @@ import {Account, Logger, Ocean} from "../squid"
import config from "./config"
(async () => {
const ocean: Ocean = await Ocean.getInstance(config)
const publisher: Account = (await ocean.getAccounts())[0]
@ -42,4 +41,6 @@ import config from "./config"
const ddo: DDO = await ocean.registerAsset(metaData, publisher)
Logger.log(ddo.id)
process.exit(0)
})()

View File

@ -2,7 +2,6 @@ import {Account, Logger, Ocean, ServiceAgreementTemplate, Templates} from "../sq
import config from "./config"
(async () => {
const ocean: Ocean = await Ocean.getInstance(config)
const templateOwner: Account = (await ocean.getAccounts())[0]
@ -12,4 +11,6 @@ import config from "./config"
Logger.log("ServiceAgreementTemplate registered:", serviceAgreementRegistered,
"templateId:", serviceAgreementTemplate.getId())
process.exit(0)
})()

View File

@ -14,4 +14,6 @@ import config from "./config"
})
Logger.log(names.length, names)
process.exit(0)
})()

View File

@ -77,4 +77,6 @@ import config from "./config"
Logger.log("ServiceAgreement Id:", serviceAgreementResult.serviceAgreementId)
Logger.log("ServiceAgreement Signature:", serviceAgreementResult.serviceAgreementSignature)
process.exit(0)
})()

View File

@ -2,8 +2,8 @@ import * as HDWalletProvider from "truffle-hdwallet-provider"
import Config from "../models/Config"
import * as config from "./config/config.json"
if (false) {
const seedphrase = "xxx"
if (process.env.SEED_WORDS) {
const seedphrase = process.env.SEED_WORDS
// @ts-ignore
config.web3Provider = new HDWalletProvider(

View File

@ -3,7 +3,7 @@ import Config from "../src/models/Config"
export default {
aquariusUri: "http://localhost:5000",
brizoUri: "http://localhost:3000",
nodeUri: "http://localhost:8545",
nodeUri: `http://localhost:${process.env.ETH_PORT || 8545}`,
parityUri: "http://localhost:9545",
secretStoreUri: "http://localhost:12001",
} as Config

View File

@ -3,5 +3,5 @@
--full-trace
--bail
--exit
--timeout 5000
--timeout 20000
test/**/*.test.ts