mirror of
https://github.com/oceanprotocol-archive/squid-js.git
synced 2024-02-02 15:31:51 +01:00
Fix integration tests and remove parallel execution workaround.
This commit is contained in:
parent
7a13ad8daa
commit
ebb2308df7
@ -7,5 +7,5 @@
|
||||
"threshold": 0,
|
||||
"password": "secret",
|
||||
"address": "0x068Ed00cF0441e4829D9784fCBe7b9e26D4BD8d0",
|
||||
"verbose": 0
|
||||
"verbose": false
|
||||
}
|
||||
|
@ -3,4 +3,4 @@
|
||||
--full-trace
|
||||
--exit
|
||||
--timeout 300000
|
||||
integration/ocean/RegisterEscrowAccessSecretStoreTemplate.test.ts integration/**/*.test.ts
|
||||
integration/**/*.test.ts
|
||||
|
@ -26,9 +26,10 @@ describe("Consume Asset", () => {
|
||||
})
|
||||
|
||||
// Accounts
|
||||
publisher = new Account("0x00Bd138aBD70e2F00903268F3Db08f2D25677C9e")
|
||||
const instanceConfig = (<any>ocean).instanceConfig
|
||||
publisher = new Account("0x00Bd138aBD70e2F00903268F3Db08f2D25677C9e", instanceConfig)
|
||||
publisher.setPassword("node0")
|
||||
consumer = new Account("0x068Ed00cF0441e4829D9784fCBe7b9e26D4BD8d0")
|
||||
consumer = new Account("0x068Ed00cF0441e4829D9784fCBe7b9e26D4BD8d0", instanceConfig)
|
||||
consumer.setPassword("secret")
|
||||
})
|
||||
|
||||
|
@ -26,9 +26,10 @@ describe("Consume Asset (Brizo)", () => {
|
||||
})
|
||||
|
||||
// Accounts
|
||||
publisher = new Account("0x00Bd138aBD70e2F00903268F3Db08f2D25677C9e")
|
||||
const instanceConfig = (<any>ocean).instanceConfig
|
||||
publisher = new Account("0x00Bd138aBD70e2F00903268F3Db08f2D25677C9e", instanceConfig)
|
||||
publisher.setPassword("node0")
|
||||
consumer = new Account("0x068Ed00cF0441e4829D9784fCBe7b9e26D4BD8d0")
|
||||
consumer = new Account("0x068Ed00cF0441e4829D9784fCBe7b9e26D4BD8d0", instanceConfig)
|
||||
consumer.setPassword("secret")
|
||||
})
|
||||
|
||||
|
@ -2,10 +2,9 @@ import { assert } from "chai"
|
||||
|
||||
import { config } from "../config"
|
||||
|
||||
import { Ocean, templates, conditions, utils, Keeper, Account } from "../../src" // @oceanprotocol/squid
|
||||
import { Ocean, templates, conditions, utils, Account, Keeper } from "../../src" // @oceanprotocol/squid
|
||||
|
||||
const { LockRewardCondition, EscrowReward, AccessSecretStoreCondition } = conditions
|
||||
const { EscrowAccessSecretStoreTemplate } = templates
|
||||
|
||||
describe("Register Escrow Access Secret Store Template", () => {
|
||||
let ocean: Ocean
|
||||
@ -27,9 +26,9 @@ describe("Register Escrow Access Secret Store Template", () => {
|
||||
|
||||
before(async () => {
|
||||
ocean = await Ocean.getInstance(config)
|
||||
keeper = await Keeper.getInstance()
|
||||
keeper = ocean.keeper
|
||||
|
||||
template = await EscrowAccessSecretStoreTemplate.getInstance()
|
||||
template = keeper.templates.escrowAccessSecretStoreTemplate
|
||||
|
||||
// Accounts
|
||||
templateManagerOwner = (await ocean.accounts.list())[0]
|
||||
@ -37,22 +36,22 @@ describe("Register Escrow Access Secret Store Template", () => {
|
||||
consumer = (await ocean.accounts.list())[2]
|
||||
|
||||
// Conditions
|
||||
accessSecretStoreCondition = await AccessSecretStoreCondition.getInstance()
|
||||
lockRewardCondition = await LockRewardCondition.getInstance()
|
||||
escrowReward = await EscrowReward.getInstance()
|
||||
accessSecretStoreCondition = keeper.conditions.accessSecretStoreCondition
|
||||
lockRewardCondition = keeper.conditions.lockRewardCondition
|
||||
escrowReward = keeper.conditions.escrowReward
|
||||
})
|
||||
|
||||
describe("Propose and approve template", () => {
|
||||
it("should propose the template", async () => {
|
||||
await keeper.templateStoreManager.proposeTemplate(template.getAddress(), consumer.getId(), true)
|
||||
// TODO: Use a event to detect template mined
|
||||
await new Promise((_) => setTimeout(_, 6 * 1000))
|
||||
await new Promise((_) => setTimeout(_, 2 * 1000))
|
||||
})
|
||||
|
||||
it("should approve the template", async () => {
|
||||
await keeper.templateStoreManager.approveTemplate(template.getAddress(), templateManagerOwner.getId(), true)
|
||||
// TODO: Use a event to detect template mined
|
||||
await new Promise((_) => setTimeout(_, 6 * 1000))
|
||||
await new Promise((_) => setTimeout(_, 2 * 1000))
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -3,7 +3,7 @@ import * as Web3 from "web3"
|
||||
|
||||
import { config } from "../config"
|
||||
|
||||
import { Ocean, Account, DDO, Keeper } from "../../src" // @oceanprotocol/squid
|
||||
import { Ocean, Account, DDO } from "../../src" // @oceanprotocol/squid
|
||||
|
||||
import ServiceAgreement from "../../src/ocean/ServiceAgreements/ServiceAgreement"
|
||||
|
||||
@ -11,14 +11,17 @@ import ServiceAgreement from "../../src/ocean/ServiceAgreements/ServiceAgreement
|
||||
// depends on the first account on spree (only accessible from integration test)
|
||||
describe("Signature", () => {
|
||||
|
||||
let ocean: Ocean
|
||||
let web3: Web3
|
||||
let consumer: Account
|
||||
|
||||
before(async () => {
|
||||
await Ocean.getInstance({
|
||||
ocean = await Ocean.getInstance({
|
||||
...config,
|
||||
web3Provider: new (Web3 as any).providers
|
||||
.HttpProvider("http://localhost:8545", 0, "0x00Bd138aBD70e2F00903268F3Db08f2D25677C9e", "node0"),
|
||||
})
|
||||
web3 = (ocean as any).web3
|
||||
|
||||
// Accounts
|
||||
consumer = new Account("0x00bd138abd70e2f00903268f3db08f2d25677c9e")
|
||||
@ -45,7 +48,7 @@ describe("Signature", () => {
|
||||
})
|
||||
|
||||
it("should generate the correct signature", async () => {
|
||||
const templates = (await Keeper.getInstance()).templates
|
||||
const templates = ocean.keeper.templates
|
||||
|
||||
const did = `did:op:${"c".repeat(64)}`
|
||||
const templateId = `0x${"f".repeat(40)}`
|
||||
@ -80,6 +83,7 @@ describe("Signature", () => {
|
||||
.getAgreementIdsFromDDO(agreementId, ddo, consumer.getId(), consumer.getId())
|
||||
|
||||
const signature = await ServiceAgreement.signServiceAgreement(
|
||||
web3,
|
||||
ddo,
|
||||
serviceDefinitionId,
|
||||
agreementId,
|
||||
|
@ -7,7 +7,7 @@
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "keeper-contracts",
|
||||
"version": "~0.8.5"
|
||||
"version": "~0.8.6"
|
||||
},
|
||||
{
|
||||
"name": "brizo",
|
||||
|
@ -9,10 +9,9 @@
|
||||
"test": "mocha",
|
||||
"test:watch": "mocha -w --watch-extensions js,ts,json",
|
||||
"test:cover": "nyc --report-dir coverage/unit mocha",
|
||||
"@@integration@@": "Using mocha-parallel-tests to ensure independent execution",
|
||||
"integration": "mocha-parallel-tests --max-parallel 1 --opts integration/mocha.opts",
|
||||
"integration": "mocha --opts integration/mocha.opts",
|
||||
"integration:watch": "mocha -w --watch-extensions js,ts,json --opts integration/mocha.opts",
|
||||
"integration:cover": "nyc --report-dir coverage/integration mocha-parallel-tests --max-parallel 1 --opts integration/mocha.opts",
|
||||
"integration:cover": "nyc --report-dir coverage/integration mocha --opts integration/mocha.opts",
|
||||
"examples": "./src/examples/fire_lazers.sh",
|
||||
"clean": "rm -rf ./dist/ ./doc/ ./coverage ./.nyc_output",
|
||||
"lint": "tslint -c tslint.json 'src/**/*.ts' 'test/**/*.ts' 'integration/**/*.ts'",
|
||||
@ -23,7 +22,7 @@
|
||||
"build:watch": "tsc -w",
|
||||
"doc": "typedoc --mode modules --exclude \"**/examples/**\" --out ./doc/ ./src/",
|
||||
"merge-coverages": "npx lcov-result-merger \"coverage/*/lcov.info\" coverage/lcov.info",
|
||||
"report-coverage": "cat ./coverage/lcov.info | codacy-coverage --token 71ef0d15f6f04ac29b31d704b28f866a",
|
||||
"report-coverage": "cat ./coverage/unit/lcov.info | codacy-coverage --token 71ef0d15f6f04ac29b31d704b28f866a",
|
||||
"run": "ts-node",
|
||||
"release": "./node_modules/release-it/bin/release-it.js --src.tagName='v%s' --github.release --npm.publish --non-interactive",
|
||||
"release-minor": "./node_modules/release-it/bin/release-it.js minor --src.tagName='v%s' --github.release --npm.publish --non-interactive",
|
||||
@ -82,7 +81,6 @@
|
||||
"cross-env": "^5.2.0",
|
||||
"lcov-result-merger": "^3.1.0",
|
||||
"mocha": "^5.2.0",
|
||||
"mocha-parallel-tests": "^2.0.6-alpha.3",
|
||||
"nyc": "^13.1.0",
|
||||
"source-map-support": "^0.5.9",
|
||||
"truffle-hdwallet-provider": "^1.0.4",
|
||||
|
@ -1,9 +1,10 @@
|
||||
count=0
|
||||
echo "Starting..."
|
||||
while sleep 0.2;
|
||||
while sleep 0.1;
|
||||
do
|
||||
curl --data '{"method":"personal_unlockAccount","params":["0x00Bd138aBD70e2F00903268F3Db08f2D25677C9e","node0",null],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545 &> /dev/null;
|
||||
curl --data '{"method":"personal_unlockAccount","params":["0x068Ed00cF0441e4829D9784fCBe7b9e26D4BD8d0","secret",null],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545 &> /dev/null;
|
||||
curl --data '{"method":"personal_unlockAccount","params":["0xA99D43d86A0758d5632313b8fA3972B6088A21BB","secret",null],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545 &> /dev/null;
|
||||
count=$((count+1));
|
||||
echo -en "\e[1A";
|
||||
echo -e "\e[0K\rRequest ${count}";
|
||||
|
Loading…
Reference in New Issue
Block a user