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:
parent
6195a6a557
commit
b6713bfc81
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,6 +2,7 @@ node_modules/
|
|||||||
dist/
|
dist/
|
||||||
.nyc_output/
|
.nyc_output/
|
||||||
coverage/
|
coverage/
|
||||||
|
artifacts/
|
||||||
doc/
|
doc/
|
||||||
test/**/*.js
|
test/**/*.js
|
||||||
src/**/*.js
|
src/**/*.js
|
||||||
|
11
.travis.yml
11
.travis.yml
@ -18,14 +18,19 @@ before_install:
|
|||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- greenkeeper-lockfile-update
|
- greenkeeper-lockfile-update
|
||||||
- ganache-cli > ganache-cli.log &
|
- ganache-cli --port 18545 > ganache-cli.log &
|
||||||
- sleep 2
|
- 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:
|
script:
|
||||||
- npm run test:cover
|
- export ETH_PORT=18545; npm run test:cover
|
||||||
- npm run report-coverage
|
- npm run report-coverage
|
||||||
- npm run build
|
- npm run build
|
||||||
- npm run doc
|
- npm run doc
|
||||||
|
# - ./scripts/wait_for_migration_and_extract_keeper_artifacts.sh
|
||||||
|
- ./src/examples/fire_lazers.sh
|
||||||
|
|
||||||
after_script:
|
after_script:
|
||||||
- greenkeeper-lockfile-upload
|
- greenkeeper-lockfile-upload
|
||||||
|
21
scripts/wait_for_migration_and_extract_keeper_artifacts.sh
Executable file
21
scripts/wait_for_migration_and_extract_keeper_artifacts.sh
Executable 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/
|
@ -68,4 +68,6 @@ import config from "./config"
|
|||||||
|
|
||||||
const paid = await serviceAgreement.payAsset(did.getId(), metaData.base.price, consumer)
|
const paid = await serviceAgreement.payAsset(did.getId(), metaData.base.price, consumer)
|
||||||
Logger.log(`Asset paid: ${paid}`)
|
Logger.log(`Asset paid: ${paid}`)
|
||||||
|
|
||||||
|
process.exit(0)
|
||||||
})()
|
})()
|
||||||
|
@ -6,7 +6,6 @@ import {Account, Logger, Ocean, ServiceAgreement} from "../squid"
|
|||||||
import config from "./config"
|
import config from "./config"
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
|
|
||||||
const ocean: Ocean = await Ocean.getInstance(config)
|
const ocean: Ocean = await Ocean.getInstance(config)
|
||||||
|
|
||||||
const publisher: Account = (await ocean.getAccounts())[0]
|
const publisher: Account = (await ocean.getAccounts())[0]
|
||||||
@ -65,4 +64,5 @@ import config from "./config"
|
|||||||
publisher)
|
publisher)
|
||||||
Logger.log("ServiceAgreement Id:", serviceAgreement.getId())
|
Logger.log("ServiceAgreement Id:", serviceAgreement.getId())
|
||||||
|
|
||||||
|
process.exit(0)
|
||||||
})()
|
})()
|
||||||
|
@ -2,10 +2,11 @@ import {Logger, Ocean} from "../squid"
|
|||||||
import config from "./config"
|
import config from "./config"
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
|
|
||||||
const ocean: Ocean = await Ocean.getInstance(config)
|
const ocean: Ocean = await Ocean.getInstance(config)
|
||||||
|
|
||||||
const accounts = await ocean.getAccounts()
|
const accounts = await ocean.getAccounts()
|
||||||
|
|
||||||
Logger.log(JSON.stringify(accounts, null, 2))
|
Logger.log(JSON.stringify(accounts, null, 2))
|
||||||
|
|
||||||
|
process.exit(0)
|
||||||
})()
|
})()
|
||||||
|
@ -7,4 +7,6 @@ import config from "./config"
|
|||||||
const accounts = await ocean.getAccounts()
|
const accounts = await ocean.getAccounts()
|
||||||
|
|
||||||
Logger.log(await accounts[0].getBalance())
|
Logger.log(await accounts[0].getBalance())
|
||||||
|
|
||||||
|
process.exit(0)
|
||||||
})()
|
})()
|
||||||
|
@ -7,4 +7,6 @@ import config from "./config"
|
|||||||
const accounts = await ocean.getAccounts()
|
const accounts = await ocean.getAccounts()
|
||||||
|
|
||||||
Logger.log(JSON.stringify(accounts, null, 2))
|
Logger.log(JSON.stringify(accounts, null, 2))
|
||||||
|
|
||||||
|
process.exit(0)
|
||||||
})()
|
})()
|
||||||
|
@ -71,4 +71,6 @@ import config from "./config"
|
|||||||
|
|
||||||
const accessGranted = await serviceAgreement.grantAccess(did.getId(), did.getId(), publisher)
|
const accessGranted = await serviceAgreement.grantAccess(did.getId(), did.getId(), publisher)
|
||||||
Logger.log(`Asset access granted: ${accessGranted}`)
|
Logger.log(`Asset access granted: ${accessGranted}`)
|
||||||
|
|
||||||
|
process.exit(0)
|
||||||
})()
|
})()
|
||||||
|
@ -67,4 +67,5 @@ import config from "./config"
|
|||||||
consumer,
|
consumer,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
process.exit(0)
|
||||||
})()
|
})()
|
||||||
|
@ -5,7 +5,6 @@ import {Account, Logger, Ocean} from "../squid"
|
|||||||
import config from "./config"
|
import config from "./config"
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
|
|
||||||
const ocean: Ocean = await Ocean.getInstance(config)
|
const ocean: Ocean = await Ocean.getInstance(config)
|
||||||
|
|
||||||
const publisher: Account = (await ocean.getAccounts())[0]
|
const publisher: Account = (await ocean.getAccounts())[0]
|
||||||
@ -42,4 +41,6 @@ import config from "./config"
|
|||||||
|
|
||||||
const ddo: DDO = await ocean.registerAsset(metaData, publisher)
|
const ddo: DDO = await ocean.registerAsset(metaData, publisher)
|
||||||
Logger.log(ddo.id)
|
Logger.log(ddo.id)
|
||||||
|
|
||||||
|
process.exit(0)
|
||||||
})()
|
})()
|
||||||
|
@ -2,7 +2,6 @@ import {Account, Logger, Ocean, ServiceAgreementTemplate, Templates} from "../sq
|
|||||||
import config from "./config"
|
import config from "./config"
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
|
|
||||||
const ocean: Ocean = await Ocean.getInstance(config)
|
const ocean: Ocean = await Ocean.getInstance(config)
|
||||||
|
|
||||||
const templateOwner: Account = (await ocean.getAccounts())[0]
|
const templateOwner: Account = (await ocean.getAccounts())[0]
|
||||||
@ -12,4 +11,6 @@ import config from "./config"
|
|||||||
|
|
||||||
Logger.log("ServiceAgreementTemplate registered:", serviceAgreementRegistered,
|
Logger.log("ServiceAgreementTemplate registered:", serviceAgreementRegistered,
|
||||||
"templateId:", serviceAgreementTemplate.getId())
|
"templateId:", serviceAgreementTemplate.getId())
|
||||||
|
|
||||||
|
process.exit(0)
|
||||||
})()
|
})()
|
||||||
|
@ -14,4 +14,6 @@ import config from "./config"
|
|||||||
})
|
})
|
||||||
|
|
||||||
Logger.log(names.length, names)
|
Logger.log(names.length, names)
|
||||||
|
|
||||||
|
process.exit(0)
|
||||||
})()
|
})()
|
||||||
|
@ -77,4 +77,6 @@ import config from "./config"
|
|||||||
|
|
||||||
Logger.log("ServiceAgreement Id:", serviceAgreementResult.serviceAgreementId)
|
Logger.log("ServiceAgreement Id:", serviceAgreementResult.serviceAgreementId)
|
||||||
Logger.log("ServiceAgreement Signature:", serviceAgreementResult.serviceAgreementSignature)
|
Logger.log("ServiceAgreement Signature:", serviceAgreementResult.serviceAgreementSignature)
|
||||||
|
|
||||||
|
process.exit(0)
|
||||||
})()
|
})()
|
||||||
|
@ -2,8 +2,8 @@ import * as HDWalletProvider from "truffle-hdwallet-provider"
|
|||||||
import Config from "../models/Config"
|
import Config from "../models/Config"
|
||||||
import * as config from "./config/config.json"
|
import * as config from "./config/config.json"
|
||||||
|
|
||||||
if (false) {
|
if (process.env.SEED_WORDS) {
|
||||||
const seedphrase = "xxx"
|
const seedphrase = process.env.SEED_WORDS
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
config.web3Provider = new HDWalletProvider(
|
config.web3Provider = new HDWalletProvider(
|
||||||
|
@ -3,7 +3,7 @@ import Config from "../src/models/Config"
|
|||||||
export default {
|
export default {
|
||||||
aquariusUri: "http://localhost:5000",
|
aquariusUri: "http://localhost:5000",
|
||||||
brizoUri: "http://localhost:3000",
|
brizoUri: "http://localhost:3000",
|
||||||
nodeUri: "http://localhost:8545",
|
nodeUri: `http://localhost:${process.env.ETH_PORT || 8545}`,
|
||||||
parityUri: "http://localhost:9545",
|
parityUri: "http://localhost:9545",
|
||||||
secretStoreUri: "http://localhost:12001",
|
secretStoreUri: "http://localhost:12001",
|
||||||
} as Config
|
} as Config
|
||||||
|
@ -3,5 +3,5 @@
|
|||||||
--full-trace
|
--full-trace
|
||||||
--bail
|
--bail
|
||||||
--exit
|
--exit
|
||||||
--timeout 5000
|
--timeout 20000
|
||||||
test/**/*.test.ts
|
test/**/*.test.ts
|
||||||
|
Loading…
Reference in New Issue
Block a user