fix websocket test, but still some hangs on second test run
This commit is contained in:
parent
5fe86e35d1
commit
13e0d453ae
|
@ -20,6 +20,8 @@ class Provider {
|
|||
self.provider = new this.web3.providers.HttpProvider(self.web3Endpoint);
|
||||
} else if (this.type === 'ws') {
|
||||
self.provider = new this.web3.providers.WebsocketProvider(self.web3Endpoint, {headers: {Origin: "embark"}});
|
||||
self.provider.on('error', e => self.logger.error('Websocket Error', e));
|
||||
self.provider.on('end', e => self.logger.error('Websocket connection ended', e));
|
||||
} else {
|
||||
return callback(__("contracts config error: unknown deployment type %s", this.type));
|
||||
}
|
||||
|
|
|
@ -40,6 +40,10 @@ const parseResponse = function (ipc, resBody) {
|
|||
commList[jsonO.id].transactionHash = jsonO.result;
|
||||
transactions[jsonO.result] = {commListId: jsonO.id};
|
||||
} else if (receipts[jsonO.id] && jsonO.result && jsonO.result.blockNumber) {
|
||||
// TODO find out why commList[receipts[jsonO.id]] is sometimes not defined
|
||||
if (!commList[receipts[jsonO.id]]) {
|
||||
commList[receipts[jsonO.id]] = {};
|
||||
}
|
||||
commList[receipts[jsonO.id]].blockNumber = jsonO.result.blockNumber;
|
||||
commList[receipts[jsonO.id]].gasUsed = jsonO.result.gasUsed;
|
||||
commList[receipts[jsonO.id]].status = jsonO.result.status;
|
||||
|
|
|
@ -326,11 +326,13 @@ class Test {
|
|||
if (newContract.options) {
|
||||
newContract.options.from = self.web3.eth.defaultAccount;
|
||||
newContract.options.data = contract.code;
|
||||
if (!newContract.options.data.startsWith('0x')) {
|
||||
newContract.options.data = '0x' + newContract.options.data;
|
||||
}
|
||||
newContract.options.gas = 6000000;
|
||||
}
|
||||
|
||||
Object.setPrototypeOf(self.contracts[contract.className], newContract);
|
||||
Object.assign(self.contracts[contract.className], newContract);
|
||||
|
||||
eachCb();
|
||||
}, (err) => {
|
||||
|
|
|
@ -23,9 +23,9 @@ contract SimpleStorage is Ownable {
|
|||
|
||||
function set(uint x) public {
|
||||
storedData = x;
|
||||
for(uint i = 0; i < 1000; i++) {
|
||||
storedData += i;
|
||||
}
|
||||
// for(uint i = 0; i < 1000; i++) {
|
||||
// storedData += i;
|
||||
// }
|
||||
Assert.triggerEvent(true, "hi");
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ contract("SimpleStorage Deploy", function () {
|
|||
it("set storage value", async function () {
|
||||
await SimpleStorageInstance.methods.set(150).send();
|
||||
let result = await SimpleStorageInstance.methods.get().call();
|
||||
assert.strictEqual(parseInt(result, 10), 499650);
|
||||
assert.strictEqual(parseInt(result, 10), 150);
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -24,7 +24,7 @@ contract("SimpleStorage", function () {
|
|||
it("set storage value", async function () {
|
||||
await SimpleStorage.methods.set(150).send();
|
||||
let result = await SimpleStorage.methods.get().call();
|
||||
assert.strictEqual(parseInt(result, 10), 499650);
|
||||
assert.strictEqual(parseInt(result, 10), 150);
|
||||
});
|
||||
|
||||
it("should set defaultAccount", async function () {
|
||||
|
|
Loading…
Reference in New Issue