Skip to content

Commit

Permalink
Jmeterbenchmark
Browse files Browse the repository at this point in the history
test jmeter benchmarking

Signed-off-by: ruzell22 <ruzell.vince.aquino@accenture.com>
  • Loading branch information
ruzell22 committed Feb 29, 2024
1 parent f68a36d commit 699c65a
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 15 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -962,11 +962,11 @@ jobs:
${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }}
- run: ./tools/ci.sh
cactus-plugin-ledger-connector-besu:
continue-on-error: true
# needs:
# - build-dev
# - compute_changed_packages
# if: needs.compute_changed_packages.outputs.plugin-ledger-connector-besu-changed == 'true'
continue-on-error: false
needs:
- build-dev
- compute_changed_packages
if: needs.compute_changed_packages.outputs.plugin-ledger-connector-besu-changed == 'true'
env:
FULL_BUILD_DISABLED: true
JEST_TEST_PATTERN: packages/cactus-plugin-ledger-connector-besu/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts
Expand All @@ -982,6 +982,9 @@ jobs:
node-version: ${{ env.NODEJS_VERSION }}
- uses: actions/checkout@v3.5.2

# - name: Run configure
# run: yarn run configure

- id: yarn-cache
name: Restore Yarn Cache
uses: actions/cache@v3.3.1
Expand Down
5 changes: 4 additions & 1 deletion packages/cactus-plugin-ledger-connector-besu/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,19 @@
"devDependencies": {
"@hyperledger/cactus-plugin-keychain-memory": "2.0.0-alpha.2",
"@hyperledger/cactus-test-tooling": "2.0.0-alpha.2",
"@types/benchmark": "2.1.5",
"@types/body-parser": "1.19.4",
"@types/express": "4.17.19",
"@types/http-errors": "2.0.4",
"@types/uuid": "9.0.6",
"benchmark": "2.1.4",
"body-parser": "1.20.2",
"key-encoder": "2.0.3",
"socket.io": "4.5.4",
"uuid": "9.0.1",
"web3-core": "1.6.1",
"web3-eth": "1.6.1"
"web3-eth": "1.6.1",
"tsx": "4.7.0"
},
"engines": {
"node": ">=18",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ test("BEFORE " + testCase, async (t: Test) => {
t.end();
});

const createTest = async (t: Test) => {
const createTestInfrastructure = async (t: {
readonly logLevel: LogLevelDesc;
}) => {
const keyEncoder: KeyEncoder = new KeyEncoder("secp256k1");
const keychainIdForSigned = uuidv4();
const keychainIdForUnsigned = uuidv4();
Expand All @@ -66,8 +68,8 @@ const createTest = async (t: Test) => {
const rpcApiWsHost = await besuTestLedger.getRpcApiWsHost();

const testEthAccount1 = await besuTestLedger.createEthTestAccount();
const testEthAccount2 = await besuTestLedger.createEthTestAccount();
const firstHighNetWorthAccount = besuTestLedger.getGenesisAccountPubKey();
// const testEthAccount2 = await besuTestLedger.createEthTestAccount();
// const firstHighNetWorthAccount = besuTestLedger.getGenesisAccountPubKey();

// keychainPlugin for signed transactions
const { privateKey } = Secp256k1Keys.generateKeyPairsBuffer();
Expand Down Expand Up @@ -124,12 +126,12 @@ const createTest = async (t: Test) => {
test.onFinish(async () => await Servers.shutdown(server));
const { address, port } = addressInfo;
const apiHost = `http://${address}:${port}`;
t.comment(
`Metrics URL: ${apiHost}/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/get-prometheus-exporter-metrics`,
);
// t.comment(
// `Metrics URL: ${apiHost}/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/get-prometheus-exporter-metrics`,
// );

const wsBasePath = apiHost + Constants.SocketIoConnectionPathV1;
t.comment("WS base path: " + wsBasePath);
// const wsBasePath = apiHost + Constants.SocketIoConnectionPathV1;
// t.comment("WS base path: " + wsBasePath);
const besuApiClientOptions = new BesuApiClientOptions({ basePath: apiHost });
const apiClient = new BesuApiClient(besuApiClientOptions);

Expand All @@ -141,6 +143,11 @@ const createTest = async (t: Test) => {

await connector.getOrCreateWebServices();
await connector.registerWebServices(expressApp, wsApi);

return {
httpApi: apiClient,
apiServer: connector,
};
};

const main = async (opts: { readonly argv: Readonly<Array<string>> }) => {
Expand Down Expand Up @@ -181,7 +188,7 @@ const main = async (opts: { readonly argv: Readonly<Array<string>> }) => {
await fse.mkdirp(absoluteOutputDirPath);
console.log("%s mkdir -p OK: %s", LOG_TAG, absoluteOutputDirPath);

const { apiServer, httpApi } = await createTest({ logLevel });
const { apiServer, httpApi } = await createTestInfrastructure({ logLevel });

const minSamples = 100;
const suite = new Benchmark.Suite({});
Expand Down

0 comments on commit 699c65a

Please sign in to comment.