Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
avkos committed Nov 27, 2023
1 parent 900eb97 commit de28728
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 237 deletions.
16 changes: 7 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"test:coverage:integration": "lerna run test:coverage:integration --stream --parallel",
"test:unit": "lerna run test:unit --stream --parallel && jest --config=./scripts/jest.config.js",
"test:integration": "lerna run test:integration --stream",
"test:integration:manual": "lerna run test:integration:manual --stream",
"test:integration:stress": "lerna run test:integration:stress --stream",
"test:e2e:ganache:http": "./scripts/test-runner.sh ganache http",
"test:e2e:ganache:ws": "./scripts/test-runner.sh ganache ws",
"test:e2e:geth:http": "./scripts/test-runner.sh geth http",
Expand All @@ -77,12 +77,10 @@
"test:e2e:mainnet:ws": "./scripts/test-runner.sh mainnet ws",
"test:e2e:sepolia:http": "./scripts/test-runner.sh sepolia http",
"test:e2e:sepolia:ws": "./scripts/test-runner.sh sepolia ws",
"test:e2e:manual:geth:ws": "./scripts/test-runner.sh geth-manual ws node manual",
"test:e2e:manual:geth:ipc": "./scripts/test-runner.sh geth-manual ipc node manual",
"test:e2e:manual:geth:http": "./scripts/test-runner.sh geth-manual http node manual",
"test:e2e:manual:geth:ws:chrome": "./scripts/test-runner.sh geth-manual ws chrome manual",
"test:e2e:manual:geth:ws:firefox": "./scripts/test-runner.sh geth-manual ws firefox manual",
"test:e2e:manual:geth:ws:electron": "./scripts/test-runner.sh geth-manual ws electron manual",
"test:stress:geth:ws": "./scripts/test-runner.sh geth-manual ws node manual",
"test:stress:geth:ipc": "./scripts/test-runner.sh geth-manual ipc node manual",
"test:stress:geth:http": "./scripts/test-runner.sh geth-manual http node manual",
"test:e2e:stress:geth:ws:chrome": "./scripts/test-runner.sh geth-manual ws chrome manual",
"generate:accounts": "node ./scripts/gen_accounts.js",
"pre-blackbox": "yarn config set registry http://localhost:4873 && git init && git config --global user.email \"[email protected]\" && git config --global user.name \"CI\"",
"post-blackbox": "./scripts/verdaccio.sh stop",
Expand All @@ -94,8 +92,8 @@
"test:blackbox:geth:ws": "yarn pre-blackbox && yarn geth:start:background && ./scripts/verdaccio.sh startBackgroundAndPublish && lerna run test:blackbox:geth:ws --stream && yarn post-blackbox:geth",
"test:blackbox:infura:http": "yarn pre-blackbox && ./scripts/verdaccio.sh startBackgroundAndPublish && lerna run test:blackbox:infura:http --stream && yarn post-blackbox",
"test:blackbox:infura:ws": "yarn pre-blackbox && ./scripts/verdaccio.sh startBackgroundAndPublish && lerna run test:blackbox:infura:ws --stream && yarn post-blackbox",
"test:manual:long-connection-ws":"node ./packages/web3/test/manual/long_ws_tests/nodejs_test/long_connection_ws.js",
"test:manual":"yarn test:e2e:manual:geth:ws && yarn test:e2e:manual:geth:http && yarn test:e2e:manual:geth:ipc",
"test:manual:long-connection-ws": "node packages/web3/test/stress/long_ws_tests/nodejs_test/long_connection_ws.js",
"test:stress":"yarn test:stress:geth:ws && yarn test:stress:geth:http && yarn test:stress:geth:ipc && yarn test:e2e:stress:geth:ws:chrome",
"husky:install": "husky install",
"husky:uninstall": "husky uninstall",
"postinstall": "yarn build",
Expand Down
6 changes: 2 additions & 4 deletions packages/web3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,14 @@
"test:watch": "npm test -- --watch",
"test:unit": "jest --config=./test/unit/jest.config.js",
"test:integration": "jest --config=./test/integration/jest.config.js --forceExit",
"test:integration:manual": "jest --config=./test/manual/jest.config.js --forceExit",
"test:integration:stress": "jest --config=./test/stress/jest.config.js --forceExit",
"test:blackbox:ganache:http": "./scripts/black_box_test.sh ganache http",
"test:blackbox:ganache:ws": "./scripts/black_box_test.sh ganache ws",
"test:blackbox:geth:http": "./scripts/black_box_test.sh geth http",
"test:blackbox:geth:ws": "./scripts/black_box_test.sh geth ws",
"test:blackbox:infura:http": "./scripts/black_box_test.sh infura http",
"test:blackbox:infura:ws": "./scripts/black_box_test.sh infura ws",
"test:e2e:electron:manual": "npx cypress run --headless --browser electron",
"test:e2e:chrome:manual": "npx cypress run --headless --browser chrome",
"test:e2e:firefox:manual": "npx cypress run --headless --browser firefox"
"test:e2e:chrome:stress": "npx cypress run --headless --browser chrome"
},
"devDependencies": {
"@truffle/hdwallet-provider": "^2.0.12",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@ const sendAndGetData = async (web3: Web3, i: number) => {
const c = new web3.eth.Contract<typeof BasicAbi>(BasicAbi);
const contract = await c.deploy(deployOptions).send(sendOptions);

await contract.methods
.setValues(1, 'A'.repeat(DATA_AMOUNT), true)
.send({ from: accounts[i].address });
await expect(
contract.methods
.setValues(1, 'A'.repeat(DATA_AMOUNT), true)
.send({ from: accounts[i].address }),
).resolves.toBeDefined();

await contract.methods.getStringValue().call();
await expect(contract.methods.getStringValue().call()).resolves.toBe('A'.repeat(DATA_AMOUNT));
};

describe('huge data', () => {
Expand All @@ -55,7 +57,7 @@ describe('huge data', () => {
}
});

it('send and get', async () => {
it('send and get large data', async () => {
for (const a of accounts) {
const acc = web3.eth.accounts.privateKeyToAccount(a.privateKey);
web3.eth.accounts.wallet.add(acc);
Expand All @@ -65,6 +67,6 @@ describe('huge data', () => {
for (let i = 0; i < 15; i++) {
prs.push(sendAndGetData(web3, i));
}
await Promise.all(prs);
await expect(Promise.all(prs)).resolves.toBeDefined();
});
});
68 changes: 0 additions & 68 deletions packages/web3/test/stress/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const base = require('../config/jest.config');

module.exports = {
...base,
setupFilesAfterEnv: ['<rootDir>/test/manual/setup.js'],
testMatch: ['<rootDir>/test/manual/**/*.(spec|test).(js|ts)'],
setupFilesAfterEnv: ['<rootDir>/test/stress/setup.js'],
testMatch: ['<rootDir>/test/stress/**/*.(spec|test).(js|ts)'],
/**
* restoreMocks [boolean]
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,12 @@ describe('huge data', () => {
(web3.provider as unknown as WebSocketProvider).disconnect();
}
});
it('send requests', async () => {
it('send requests large number of requests', async () => {
const sendPrs = [];
for (let i = 0; i < parallelCount; i++) {
sendPrs.push(sendData(accounts[i]));
}
await Promise.all(sendPrs);
expect(await Promise.all(sendPrs)).resolves.toBeDefined();
// if socket subscribe to events
if (isIpc || isWs) {
contractSubscriptions(accounts);
Expand All @@ -142,6 +142,6 @@ describe('huge data', () => {
for (let i = 0; i < parallelCount; i++) {
getPrs.push(getData(accounts[i]));
}
await Promise.all(getPrs);
await expect(Promise.all(getPrs)).resolves.toBeDefined();
});
});
File renamed without changes.
17 changes: 0 additions & 17 deletions packages/web3/test/stress/start.sh

This file was deleted.

126 changes: 0 additions & 126 deletions packages/web3/test/stress/validator.ts

This file was deleted.

4 changes: 2 additions & 2 deletions scripts/test-runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ fi

if [[ $ENGINE == "node" ]] || [[ $ENGINE == "" ]]; then
if [[ $TEST_OPTION == "manual" ]]; then
TEST_COMMAND="test:integration:manual"
TEST_COMMAND="test:integration:stress"
elif [[ $TEST_OPTION == "coverage" ]]; then
TEST_COMMAND="test:coverage:integration"
elif [[ $BACKEND == "sepolia" || $BACKEND == "mainnet" ]]; then
Expand All @@ -66,7 +66,7 @@ if [[ $ENGINE == "node" ]] || [[ $ENGINE == "" ]]; then
fi
else
if [[ $TEST_OPTION == "manual" ]]; then
TEST_COMMAND="lerna run test:e2e:$ENGINE:manual --stream"
TEST_COMMAND="lerna run test:e2e:$ENGINE:stress --stream"
else
TEST_COMMAND="lerna run test:e2e:$ENGINE --stream"
fi
Expand Down

0 comments on commit de28728

Please sign in to comment.