From 75cd74fe8c1e73a0582b341f5f4205abfbc1473b Mon Sep 17 00:00:00 2001 From: Xin Li <59580070+xin-hedera@users.noreply.github.com> Date: Wed, 2 Mar 2022 16:02:53 -0600 Subject: [PATCH] Add k6 tests (#3174) * initial commit of k6 tests Signed-off-by: Xin Li Signed-off-by: Matheus DallRosa * port existing rest api k6 tests Signed-off-by: Xin Li Signed-off-by: Matheus DallRosa * add markdown reporter for rest api testing Signed-off-by: Xin Li Signed-off-by: Matheus DallRosa * add url tag to scenario definition Signed-off-by: Xin Li Signed-off-by: Matheus DallRosa * cleanup Signed-off-by: Xin Li Signed-off-by: Matheus DallRosa * add rosetta tests Signed-off-by: Xin Li Signed-off-by: Matheus DallRosa * change rest base url, add web3 Signed-off-by: Xin Li Signed-off-by: Matheus DallRosa * add readme, change column header Signed-off-by: Xin Li Signed-off-by: Matheus DallRosa * address some feedback Signed-off-by: Xin Li Signed-off-by: Matheus DallRosa * convert rest tests to use TestScenarioBuilder Signed-off-by: Xin Li Signed-off-by: Matheus DallRosa * values for mainnet rest tests Signed-off-by: Xin Li Signed-off-by: Matheus DallRosa * address feedback for readme Signed-off-by: Xin Li Signed-off-by: Matheus DallRosa * Add bootstrap script to gather test parameters from environments Signed-off-by: Matheus DallRosa * improve readme: Signed-off-by: Matheus DallRosa * Improve exception message and add base url to the exported file Signed-off-by: Matheus DallRosa * fix JSON-RPC test Signed-off-by: Matheus DallRosa * also check response status Signed-off-by: Matheus DallRosa * use correct media type Signed-off-by: Matheus DallRosa * validate lists returned by the REST API Signed-off-by: Matheus DallRosa * add new balances test Signed-off-by: Matheus DallRosa * Fix transactions REST API regression (#3139) - Add 'order by consensus_timestamp ${order}' to timestampFilter CTE Signed-off-by: Xin Li Signed-off-by: Matheus DallRosa * Fix 'Null entity ID' error in contract result REST api (#3140) - Allow null contractId in ContractResultViewModel Signed-off-by: Xin Li Signed-off-by: Matheus DallRosa * Bump qs from 6.10.2 to 6.10.3 in /hedera-mirror-rest (#3143) Bumps [qs](https://github.com/ljharb/qs) from 6.10.2 to 6.10.3. - [Release notes](https://github.com/ljharb/qs/releases) - [Changelog](https://github.com/ljharb/qs/blob/main/CHANGELOG.md) - [Commits](https://github.com/ljharb/qs/compare/v6.10.2...v6.10.3) --- updated-dependencies: - dependency-name: qs dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump mathjs in /hedera-mirror-rest/monitoring/monitor_apis (#3144) Bumps [mathjs](https://github.com/josdejong/mathjs) from 10.0.2 to 10.1.0. - [Release notes](https://github.com/josdejong/mathjs/releases) - [Changelog](https://github.com/josdejong/mathjs/blob/develop/HISTORY.md) - [Commits](https://github.com/josdejong/mathjs/compare/v10.0.2...v10.1.0) --- updated-dependencies: - dependency-name: mathjs dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump cucumber.version from 7.2.2 to 7.2.3 (#3147) Bumps `cucumber.version` from 7.2.2 to 7.2.3. Updates `cucumber-java` from 7.2.2 to 7.2.3 - [Release notes](https://github.com/cucumber/cucumber-jvm/releases) - [Changelog](https://github.com/cucumber/cucumber-jvm/blob/main/CHANGELOG.md) - [Commits](https://github.com/cucumber/cucumber-jvm/compare/v7.2.2...v7.2.3) Updates `cucumber-junit` from 7.2.2 to 7.2.3 - [Release notes](https://github.com/cucumber/cucumber-jvm/releases) - [Changelog](https://github.com/cucumber/cucumber-jvm/blob/main/CHANGELOG.md) - [Commits](https://github.com/cucumber/cucumber-jvm/compare/v7.2.2...v7.2.3) Updates `cucumber-junit-platform-engine` from 7.2.2 to 7.2.3 - [Release notes](https://github.com/cucumber/cucumber-jvm/releases) - [Changelog](https://github.com/cucumber/cucumber-jvm/blob/main/CHANGELOG.md) - [Commits](https://github.com/cucumber/cucumber-jvm/compare/v7.2.2...v7.2.3) Updates `cucumber-spring` from 7.2.2 to 7.2.3 - [Release notes](https://github.com/cucumber/cucumber-jvm/releases) - [Changelog](https://github.com/cucumber/cucumber-jvm/blob/main/CHANGELOG.md) - [Commits](https://github.com/cucumber/cucumber-jvm/compare/v7.2.2...v7.2.3) --- updated-dependencies: - dependency-name: io.cucumber:cucumber-java dependency-type: direct:development update-type: version-update:semver-patch - dependency-name: io.cucumber:cucumber-junit dependency-type: direct:development update-type: version-update:semver-patch - dependency-name: io.cucumber:cucumber-junit-platform-engine dependency-type: direct:development update-type: version-update:semver-patch - dependency-name: io.cucumber:cucumber-spring dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump eslint-plugin-jest from 25.3.4 to 25.7.0 in /hedera-mirror-rest (#3148) Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 25.3.4 to 25.7.0. - [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases) - [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/main/CHANGELOG.md) - [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v25.3.4...v25.7.0) --- updated-dependencies: - dependency-name: eslint-plugin-jest dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump @hashgraph/proto in /hedera-mirror-rest/check-state-proof (#3156) Bumps [@hashgraph/proto](https://github.com/hashgraph/hedera-sdk-js) from 2.1.1 to 2.1.2. - [Release notes](https://github.com/hashgraph/hedera-sdk-js/releases) - [Changelog](https://github.com/hashgraph/hedera-sdk-js/blob/main/CHANGELOG.md) - [Commits](https://github.com/hashgraph/hedera-sdk-js/commits) --- updated-dependencies: - dependency-name: "@hashgraph/proto" dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump @hashgraph/proto from 2.1.1 to 2.1.2 in /hedera-mirror-rest (#3164) Bumps [@hashgraph/proto](https://github.com/hashgraph/hedera-sdk-js) from 2.1.1 to 2.1.2. - [Release notes](https://github.com/hashgraph/hedera-sdk-js/releases) - [Changelog](https://github.com/hashgraph/hedera-sdk-js/blob/main/CHANGELOG.md) - [Commits](https://github.com/hashgraph/hedera-sdk-js/commits) --- updated-dependencies: - dependency-name: "@hashgraph/proto" dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump dependency-check-maven from 6.5.1 to 6.5.3 (#3166) Bumps [dependency-check-maven](https://github.com/jeremylong/DependencyCheck) from 6.5.1 to 6.5.3. - [Release notes](https://github.com/jeremylong/DependencyCheck/releases) - [Changelog](https://github.com/jeremylong/DependencyCheck/blob/main/RELEASE_NOTES.md) - [Commits](https://github.com/jeremylong/DependencyCheck/compare/v6.5.1...v6.5.3) --- updated-dependencies: - dependency-name: org.owasp:dependency-check-maven dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump supertest from 6.1.6 to 6.2.1 in /hedera-mirror-rest (#3146) Bumps [supertest](https://github.com/visionmedia/supertest) from 6.1.6 to 6.2.1. - [Release notes](https://github.com/visionmedia/supertest/releases) - [Commits](https://github.com/visionmedia/supertest/compare/v6.1.6...v6.2.1) --- updated-dependencies: - dependency-name: supertest dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump mathjs from 10.0.2 to 10.1.0 in /hedera-mirror-rest (#3170) Bumps [mathjs](https://github.com/josdejong/mathjs) from 10.0.2 to 10.1.0. - [Release notes](https://github.com/josdejong/mathjs/releases) - [Changelog](https://github.com/josdejong/mathjs/blob/develop/HISTORY.md) - [Commits](https://github.com/josdejong/mathjs/compare/v10.0.2...v10.1.0) --- updated-dependencies: - dependency-name: mathjs dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump aws-sdk from 2.1053.0 to 2.1058.0 in /hedera-mirror-rest (#3169) Bumps [aws-sdk](https://github.com/aws/aws-sdk-js) from 2.1053.0 to 2.1058.0. - [Release notes](https://github.com/aws/aws-sdk-js/releases) - [Changelog](https://github.com/aws/aws-sdk-js/blob/master/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-js/compare/v2.1053.0...v2.1058.0) --- updated-dependencies: - dependency-name: aws-sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump axios from 0.24.0 to 0.25.0 in /hedera-mirror-rest (#3168) Bumps [axios](https://github.com/axios/axios) from 0.24.0 to 0.25.0. - [Release notes](https://github.com/axios/axios/releases) - [Changelog](https://github.com/axios/axios/blob/master/CHANGELOG.md) - [Commits](https://github.com/axios/axios/compare/v0.24.0...v0.25.0) --- updated-dependencies: - dependency-name: axios dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump gorm.io/gorm from 1.22.4 to 1.22.5 in /hedera-mirror-rosetta (#3154) Bumps [gorm.io/gorm](https://github.com/go-gorm/gorm) from 1.22.4 to 1.22.5. - [Release notes](https://github.com/go-gorm/gorm/releases) - [Commits](https://github.com/go-gorm/gorm/compare/v1.22.4...v1.22.5) --- updated-dependencies: - dependency-name: gorm.io/gorm dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump hedera-protobuf-java-api from 0.21.0 to 0.22.0 (#3149) Bumps [hedera-protobuf-java-api](https://github.com/hashgraph/hedera-protobuf) from 0.21.0 to 0.22.0. - [Release notes](https://github.com/hashgraph/hedera-protobuf/releases) - [Commits](https://github.com/hashgraph/hedera-protobuf/compare/v0.21.0...v0.22.0) --- updated-dependencies: - dependency-name: com.hedera.hashgraph:hedera-protobuf-java-api dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump github.com/cucumber/godog in /hedera-mirror-rosetta (#3153) Bumps [github.com/cucumber/godog](https://github.com/cucumber/godog) from 0.12.3 to 0.12.4. - [Release notes](https://github.com/cucumber/godog/releases) - [Changelog](https://github.com/cucumber/godog/blob/main/CHANGELOG.md) - [Commits](https://github.com/cucumber/godog/compare/v0.12.3...v0.12.4) --- updated-dependencies: - dependency-name: github.com/cucumber/godog dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump protobuf-java from 3.19.2 to 3.19.3 (#3171) Bumps [protobuf-java](https://github.com/protocolbuffers/protobuf) from 3.19.2 to 3.19.3. - [Release notes](https://github.com/protocolbuffers/protobuf/releases) - [Changelog](https://github.com/protocolbuffers/protobuf/blob/master/generate_changelog.py) - [Commits](https://github.com/protocolbuffers/protobuf/compare/v3.19.2...v3.19.3) --- updated-dependencies: - dependency-name: com.google.protobuf:protobuf-java dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump @godaddy/terminus from 4.9.0 to 4.10.1 in /hedera-mirror-rest (#3165) Bumps [@godaddy/terminus](https://github.com/godaddy/terminus) from 4.9.0 to 4.10.1. - [Release notes](https://github.com/godaddy/terminus/releases) - [Commits](https://github.com/godaddy/terminus/compare/v4.9.0...v4.10.1) --- updated-dependencies: - dependency-name: "@godaddy/terminus" dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump software.amazon.awssdk:bom from 2.17.107 to 2.17.112 (#3172) Bumps [software.amazon.awssdk:bom](https://github.com/aws/aws-sdk-java-v2) from 2.17.107 to 2.17.112. - [Release notes](https://github.com/aws/aws-sdk-java-v2/releases) - [Changelog](https://github.com/aws/aws-sdk-java-v2/blob/master/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-java-v2/compare/2.17.107...2.17.112) --- updated-dependencies: - dependency-name: software.amazon.awssdk:bom dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * HIP-171 Add topic_message payer_account_id and chunk info (#3105) * Add chunk_info and payer_account_id to topic message REST APIs Signed-off-by: Ian Jungmann Signed-off-by: Matheus DallRosa * Add a get address book nodes gRPC API (#3141) * Add a NetworkService.getNodes() gRPC API * Change AddressBookEntry and AddressBookServiceEndpoint to use @IdClass with flattened properties * Change TopicMessageFilter to use EntityId instead of long * Fix AddressBookServiceEndpoint incorrectly modeling nodeId as EntityId * Move DomainBuilder to common module Signed-off-by: Steven Sheehy Signed-off-by: Matheus DallRosa * Add data migration guide to database.md (#3175) Signed-off-by: Xin Li Signed-off-by: Matheus DallRosa * Bump versions for v0.50.0-SNAPSHOT (#3179) Signed-off-by: Hedera Github Bot Signed-off-by: Matheus DallRosa * Add bloom, result and status to contract results API and bloom to contract logs API (#3176) * Add result and status to contract result details APIs * Add contract_result bloom to all contract result APIs * Add contract_log bloom to all APIs displaying contract logs Signed-off-by: Ian Jungmann Signed-off-by: Matheus DallRosa * Optimize schedules query (#3185) Signed-off-by: Xin Li Signed-off-by: Matheus DallRosa * Revert Contract Result status back to 0x0 and 0x1 (#3187) Signed-off-by: Ian Jungmann Signed-off-by: Matheus DallRosa * Add NetworkService to grpc ingress (#3186) Fix Helm deployment not exposing new address book API via Ingress Signed-off-by: Steven Sheehy Signed-off-by: Matheus DallRosa * Fix monitor validation issues (#3181) * Add `hedera.mirror.monitor.nodeValidation.maxThreads=25` property * Add `hedera.mirror.monitor.nodeValidation.requestTimeout=10s` property * Add new mainnet nodes * Bump `hedera-sdk-java` to 2.6.0 for monitor * Change monitor to validate nodes in parallel * Disable `hedera.mirror.test.acceptance.retrieveAddressBook` since it doesn't currently work with service endpoints * Fix `EntityRecordItemListenerPerformanceCryptoTest` sporadically timing out * Fix node validation blocking subscribe and re-enable it * Fix node validation taking too long * Workaround SDK bug with a modified `ManagedNode` class https://github.com/hashgraph/hedera-sdk-java/issues/855 Signed-off-by: Steven Sheehy Signed-off-by: Matheus DallRosa * Set importer replicas to 1 to workaround leader election bugs (#3190) Signed-off-by: Steven Sheehy Signed-off-by: Matheus DallRosa * Bump log4js in /hedera-mirror-rest/monitoring/monitor_apis (#3192) Bumps [log4js](https://github.com/log4js-node/log4js-node) from 6.3.0 to 6.4.0. - [Release notes](https://github.com/log4js-node/log4js-node/releases) - [Changelog](https://github.com/log4js-node/log4js-node/blob/master/CHANGELOG.md) - [Commits](https://github.com/log4js-node/log4js-node/compare/v6.3.0...v6.4.0) --- updated-dependencies: - dependency-name: log4js dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump log4js from 6.3.0 to 6.4.0 in /hedera-mirror-rest (#3191) Bumps [log4js](https://github.com/log4js-node/log4js-node) from 6.3.0 to 6.4.0. - [Release notes](https://github.com/log4js-node/log4js-node/releases) - [Changelog](https://github.com/log4js-node/log4js-node/blob/master/CHANGELOG.md) - [Commits](https://github.com/log4js-node/log4js-node/compare/v6.3.0...v6.4.0) --- updated-dependencies: - dependency-name: log4js dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump log4js from 6.3.0 to 6.4.0 in /hedera-mirror-rest/check-state-proof (#3193) Bumps [log4js](https://github.com/log4js-node/log4js-node) from 6.3.0 to 6.4.0. - [Release notes](https://github.com/log4js-node/log4js-node/releases) - [Changelog](https://github.com/log4js-node/log4js-node/blob/master/CHANGELOG.md) - [Commits](https://github.com/log4js-node/log4js-node/compare/v6.3.0...v6.4.0) --- updated-dependencies: - dependency-name: log4js dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump node-fetch to 2.6.7 & fix LoggingFilterTest (#3209) * Bump node-fetch to 2.6.7 * Fix LoggingFilter not capturing cancelled requests * Fix LoggingFilterTest failing in CI Signed-off-by: Steven Sheehy Signed-off-by: Matheus DallRosa * Bump node-fetch in /hedera-mirror-rest/check-state-proof (#3210) Bumps [node-fetch](https://github.com/node-fetch/node-fetch) from 2.6.1 to 2.6.7. - [Release notes](https://github.com/node-fetch/node-fetch/releases) - [Commits](https://github.com/node-fetch/node-fetch/compare/v2.6.1...v2.6.7) --- updated-dependencies: - dependency-name: node-fetch dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump log4js in /hedera-mirror-rest/monitoring/monitor_apis (#3194) Bumps [log4js](https://github.com/log4js-node/log4js-node) from 6.4.0 to 6.4.1. - [Release notes](https://github.com/log4js-node/log4js-node/releases) - [Changelog](https://github.com/log4js-node/log4js-node/blob/master/CHANGELOG.md) - [Commits](https://github.com/log4js-node/log4js-node/compare/v6.4.0...v6.4.1) --- updated-dependencies: - dependency-name: log4js dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump aws-sdk from 2.1058.0 to 2.1062.0 in /hedera-mirror-rest (#3198) Bumps [aws-sdk](https://github.com/aws/aws-sdk-js) from 2.1058.0 to 2.1062.0. - [Release notes](https://github.com/aws/aws-sdk-js/releases) - [Changelog](https://github.com/aws/aws-sdk-js/blob/master/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-js/compare/v2.1058.0...v2.1062.0) --- updated-dependencies: - dependency-name: aws-sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump spring-boot-starter-parent from 2.6.2 to 2.6.3 (#3202) Bumps [spring-boot-starter-parent](https://github.com/spring-projects/spring-boot) from 2.6.2 to 2.6.3. - [Release notes](https://github.com/spring-projects/spring-boot/releases) - [Commits](https://github.com/spring-projects/spring-boot/compare/v2.6.2...v2.6.3) --- updated-dependencies: - dependency-name: org.springframework.boot:spring-boot-starter-parent dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump supertest from 6.2.1 to 6.2.2 in /hedera-mirror-rest (#3203) Bumps [supertest](https://github.com/visionmedia/supertest) from 6.2.1 to 6.2.2. - [Release notes](https://github.com/visionmedia/supertest/releases) - [Commits](https://github.com/visionmedia/supertest/compare/v6.2.1...v6.2.2) --- updated-dependencies: - dependency-name: supertest dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump software.amazon.awssdk:bom from 2.17.112 to 2.17.117 (#3211) Bumps [software.amazon.awssdk:bom](https://github.com/aws/aws-sdk-java-v2) from 2.17.112 to 2.17.117. - [Release notes](https://github.com/aws/aws-sdk-java-v2/releases) - [Changelog](https://github.com/aws/aws-sdk-java-v2/blob/master/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-java-v2/compare/2.17.112...2.17.117) --- updated-dependencies: - dependency-name: software.amazon.awssdk:bom dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump github.com/prometheus/client_golang in /hedera-mirror-rosetta (#3204) Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.11.0 to 1.12.0. - [Release notes](https://github.com/prometheus/client_golang/releases) - [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md) - [Commits](https://github.com/prometheus/client_golang/compare/v1.11.0...v1.12.0) --- updated-dependencies: - dependency-name: github.com/prometheus/client_golang dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump aws-sdk-mock from 5.5.1 to 5.6.0 in /hedera-mirror-rest (#3197) Bumps [aws-sdk-mock](https://github.com/dwyl/aws-sdk-mock) from 5.5.1 to 5.6.0. - [Release notes](https://github.com/dwyl/aws-sdk-mock/releases) - [Commits](https://github.com/dwyl/aws-sdk-mock/compare/v5.5.1...v5.6.0) --- updated-dependencies: - dependency-name: aws-sdk-mock dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump log4js from 6.4.0 to 6.4.1 in /hedera-mirror-rest (#3195) Bumps [log4js](https://github.com/log4js-node/log4js-node) from 6.4.0 to 6.4.1. - [Release notes](https://github.com/log4js-node/log4js-node/releases) - [Changelog](https://github.com/log4js-node/log4js-node/blob/master/CHANGELOG.md) - [Commits](https://github.com/log4js-node/log4js-node/compare/v6.4.0...v6.4.1) --- updated-dependencies: - dependency-name: log4js dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump log4js from 6.4.0 to 6.4.1 in /hedera-mirror-rest/check-state-proof (#3207) Bumps [log4js](https://github.com/log4js-node/log4js-node) from 6.4.0 to 6.4.1. - [Release notes](https://github.com/log4js-node/log4js-node/releases) - [Changelog](https://github.com/log4js-node/log4js-node/blob/master/CHANGELOG.md) - [Commits](https://github.com/log4js-node/log4js-node/compare/v6.4.0...v6.4.1) --- updated-dependencies: - dependency-name: log4js dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump download-maven-plugin from 1.6.7 to 1.6.8 (#3212) Bumps [download-maven-plugin](https://github.com/maven-download-plugin/maven-download-plugin) from 1.6.7 to 1.6.8. - [Release notes](https://github.com/maven-download-plugin/maven-download-plugin/releases) - [Commits](https://github.com/maven-download-plugin/maven-download-plugin/compare/1.6.7...1.6.8) --- updated-dependencies: - dependency-name: com.googlecode.maven-download-plugin:download-maven-plugin dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump embedded.testcontainers.version from 2.0.19 to 2.0.20 (#3213) Bumps `embedded.testcontainers.version` from 2.0.19 to 2.0.20. Updates `embedded-postgresql` from 2.0.19 to 2.0.20 Updates `embedded-redis` from 2.0.19 to 2.0.20 Updates `embedded-google-pubsub` from 2.0.19 to 2.0.20 --- updated-dependencies: - dependency-name: com.playtika.testcontainers:embedded-postgresql dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: com.playtika.testcontainers:embedded-redis dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: com.playtika.testcontainers:embedded-google-pubsub dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump @godaddy/terminus from 4.10.1 to 4.10.2 in /hedera-mirror-rest (#3199) Bumps [@godaddy/terminus](https://github.com/godaddy/terminus) from 4.10.1 to 4.10.2. - [Release notes](https://github.com/godaddy/terminus/releases) - [Commits](https://github.com/godaddy/terminus/compare/v4.10.1...v4.10.2) --- updated-dependencies: - dependency-name: "@godaddy/terminus" dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump junit-jupiter from 1.16.2 to 1.16.3 (#3214) Bumps [junit-jupiter](https://github.com/testcontainers/testcontainers-java) from 1.16.2 to 1.16.3. - [Release notes](https://github.com/testcontainers/testcontainers-java/releases) - [Changelog](https://github.com/testcontainers/testcontainers-java/blob/master/CHANGELOG.md) - [Commits](https://github.com/testcontainers/testcontainers-java/compare/1.16.2...1.16.3) --- updated-dependencies: - dependency-name: org.testcontainers:junit-jupiter dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump vertx-pg-client from 4.2.3 to 4.2.4 (#3215) Bumps [vertx-pg-client](https://github.com/eclipse-vertx/vertx-sql-client) from 4.2.3 to 4.2.4. - [Release notes](https://github.com/eclipse-vertx/vertx-sql-client/releases) - [Commits](https://github.com/eclipse-vertx/vertx-sql-client/compare/4.2.3...4.2.4) --- updated-dependencies: - dependency-name: io.vertx:vertx-pg-client dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Remove streamFileActivity from importer liveness probe (#3216) Signed-off-by: Steven Sheehy Signed-off-by: Matheus DallRosa * Bump jib-maven-plugin from 3.1.4 to 3.2.0 (#3201) * Bump jib-maven-plugin from 3.1.4 to 3.2.0 Bumps [jib-maven-plugin](https://github.com/GoogleContainerTools/jib) from 3.1.4 to 3.2.0. - [Release notes](https://github.com/GoogleContainerTools/jib/releases) - [Commits](https://github.com/GoogleContainerTools/jib/commits) --- updated-dependencies: - dependency-name: com.google.cloud.tools:jib-maven-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Fix jib regression Signed-off-by: Steven Sheehy Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Steven Sheehy Signed-off-by: Matheus DallRosa * Bump spring-cloud-gcp-dependencies from 2.0.7 to 3.0.0 (#3150) Bumps spring-cloud-gcp-dependencies from 2.0.7 to 3.0.0. --- updated-dependencies: - dependency-name: com.google.cloud:spring-cloud-gcp-dependencies dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Add contract state change support to common and importer modules (#3189) [HIP-260](https://hips.hedera.com/HIP/hip-260.html) Smart Contract Traceability adds new information to the transaction record to track contract state changes. - Add v1 db migration to create `contract_state_change` table - Update V2.0.x migrations files with `contract_state_change` table logic - Add `ContractStateChange` domain to common module - Update `EntityListener` interface and implementations with `onContractStateChange()` logic - Update `AbstractContractCallTransactionHandler` with `ContractStateChange` population logic - Update entityListener tests with contractStateChange details Signed-off-by: Nana-EC Signed-off-by: Matheus DallRosa * Return partial response for contract calls without a result (#3182) We currently return not found when a contract call or create returns certain type of errors. - Return a partial result with a 206 HTTP response code when `contract_result` model is missing - Update contract detailed view model to set default `null` or `[]` values in partial case - Update spec files - Add spec test files for missing coverage - Update OpenAPI spec with 206 Signed-off-by: Nana-EC Signed-off-by: Matheus DallRosa * Fix wrong sort order for contract logs in OpenAPI (#3221) Signed-off-by: Steven Sheehy Signed-off-by: Matheus DallRosa * Update topicMessage REST response to use transactionId json format (#3222) In v0.49.0 we added transactionId info to the topicMessage chunkInfo response. Given the nature of the transactionId format a more scalable format should be used to allow for expansion - Add a `transactionIdViewModel.js` to handle display format logic from Protobuf or db schema - Update `topicMessageViewModel.js` to use `transactionIdViewModel.js` as a component - Add a `transactionId.js` model class to dictate transactionId format for use by `transactionIdViewModel` - Update OpenAPI spec - Update spec test files - Update viewmodel test js files Signed-off-by: Nana-EC Signed-off-by: Matheus DallRosa * Update postgresql data migration guide (#3223) - Add flags and values to speed up create index Signed-off-by: Xin Li Signed-off-by: Matheus DallRosa * Fix URL in test pod yaml (#3224) Signed-off-by: Xin Li Signed-off-by: Matheus DallRosa * Update Pubsub message strings based on updated hedera protobuf 0.23.0-SNAPSHOT (#3229) protobuf SNAPSHOT added adjustments, the lack of its presence is causing UT failures across branches - Add `isApproval`, `cryptoAdjustments`, `nftAdjustments` and `tokenAdjustments` to expected transaction record json - Update `pubsub-messages.txt` w `isApproval`, `cryptoAdjustments`, `nftAdjustments` and `tokenAdjustments` - Update PubSubRecordParserTest testPubSubExporter comparison logic to make it easier to see which messages require an update Signed-off-by: Nana-EC Signed-off-by: Matheus DallRosa * Bump sinon from 12.0.1 to 13.0.0 in /hedera-mirror-rest (#3230) Bumps [sinon](https://github.com/sinonjs/sinon) from 12.0.1 to 13.0.0. - [Release notes](https://github.com/sinonjs/sinon/releases) - [Changelog](https://github.com/sinonjs/sinon/blob/master/docs/changelog.md) - [Commits](https://github.com/sinonjs/sinon/compare/v12.0.1...v13.0.0) --- updated-dependencies: - dependency-name: sinon dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump aws-sdk from 2.1062.0 to 2.1066.0 in /hedera-mirror-rest (#3231) Bumps [aws-sdk](https://github.com/aws/aws-sdk-js) from 2.1062.0 to 2.1066.0. - [Release notes](https://github.com/aws/aws-sdk-js/releases) - [Changelog](https://github.com/aws/aws-sdk-js/blob/master/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-js/compare/v2.1062.0...v2.1066.0) --- updated-dependencies: - dependency-name: aws-sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump protobuf-java from 3.19.3 to 3.19.4 (#3232) Bumps [protobuf-java](https://github.com/protocolbuffers/protobuf) from 3.19.3 to 3.19.4. - [Release notes](https://github.com/protocolbuffers/protobuf/releases) - [Changelog](https://github.com/protocolbuffers/protobuf/blob/master/generate_changelog.py) - [Commits](https://github.com/protocolbuffers/protobuf/compare/v3.19.3...v3.19.4) --- updated-dependencies: - dependency-name: com.google.protobuf:protobuf-java dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump eslint-plugin-jest from 25.7.0 to 26.0.0 in /hedera-mirror-rest (#3233) Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 25.7.0 to 26.0.0. - [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases) - [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/main/CHANGELOG.md) - [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v25.7.0...v26.0.0) --- updated-dependencies: - dependency-name: eslint-plugin-jest dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump jest-extended from 1.2.0 to 2.0.0 in /hedera-mirror-rest (#3234) Bumps [jest-extended](https://github.com/jest-community/jest-extended) from 1.2.0 to 2.0.0. - [Release notes](https://github.com/jest-community/jest-extended/releases) - [Commits](https://github.com/jest-community/jest-extended/compare/v1.2.0...v2.0.0) --- updated-dependencies: - dependency-name: jest-extended dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump grpc.version from 1.43.2 to 1.44.0 (#3235) Bumps `grpc.version` from 1.43.2 to 1.44.0. Updates `grpc-bom` from 1.43.2 to 1.44.0 - [Release notes](https://github.com/grpc/grpc-java/releases) - [Commits](https://github.com/grpc/grpc-java/compare/v1.43.2...v1.44.0) Updates `grpc-netty-shaded` from 1.43.2 to 1.44.0 - [Release notes](https://github.com/grpc/grpc-java/releases) - [Commits](https://github.com/grpc/grpc-java/compare/v1.43.2...v1.44.0) Updates `grpc-okhttp` from 1.43.2 to 1.44.0 - [Release notes](https://github.com/grpc/grpc-java/releases) - [Commits](https://github.com/grpc/grpc-java/compare/v1.43.2...v1.44.0) --- updated-dependencies: - dependency-name: io.grpc:grpc-bom dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: io.grpc:grpc-netty-shaded dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: io.grpc:grpc-okhttp dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump aws-sdk-mock from 5.6.0 to 5.6.2 in /hedera-mirror-rest (#3237) Bumps [aws-sdk-mock](https://github.com/dwyl/aws-sdk-mock) from 5.6.0 to 5.6.2. - [Release notes](https://github.com/dwyl/aws-sdk-mock/releases) - [Commits](https://github.com/dwyl/aws-sdk-mock/compare/v5.6.0...v5.6.2) --- updated-dependencies: - dependency-name: aws-sdk-mock dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump github.com/prometheus/client_golang in /hedera-mirror-rosetta (#3239) Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.12.0 to 1.12.1. - [Release notes](https://github.com/prometheus/client_golang/releases) - [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md) - [Commits](https://github.com/prometheus/client_golang/compare/v1.12.0...v1.12.1) --- updated-dependencies: - dependency-name: github.com/prometheus/client_golang dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump spring-native from 0.11.1 to 0.11.2 (#3238) Bumps [spring-native](https://github.com/spring-projects-experimental/spring-native) from 0.11.1 to 0.11.2. - [Release notes](https://github.com/spring-projects-experimental/spring-native/releases) - [Commits](https://github.com/spring-projects-experimental/spring-native/compare/0.11.1...0.11.2) --- updated-dependencies: - dependency-name: org.springframework.experimental:spring-native dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Add contract state change support to contract REST API endpoints (#3219) [HIP-260](https://hips.hedera.com/HIP/hip-260.html) Smart Contract Traceability adds new information to the transaction record to track contract state changes. Importer logic was added to store state changes, REST API must be updated to expose these state changes in the contract result details - Add a `ContractStateChange` model. Update `index.js` for easy import access - Add a `COntractResultStateChangeViewModel.js` view model to display changes. Update `index.js` for easy import access - Add `state_changes` to `contractResultDetailsViewModel.js` - Update `contractController.js` to handle `contract_state_change` rows returned from service - Update `contractService.js` with logic to pull `contract_state_change` rows - Update `integrationDomainOps.js` with db `contract_state_change` population logic - Update test spec files contract results response with `state_change` Signed-off-by: Nana-EC Signed-off-by: Matheus DallRosa * Bump spring-cloud-gcp-dependencies from 3.0.0 to 3.1.0 (#3236) Bumps spring-cloud-gcp-dependencies from 3.0.0 to 3.1.0. --- updated-dependencies: - dependency-name: com.google.cloud:spring-cloud-gcp-dependencies dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump springdoc-openapi-webflux-ui from 1.6.4 to 1.6.5 (#3241) Bumps [springdoc-openapi-webflux-ui](https://github.com/springdoc/springdoc-openapi) from 1.6.4 to 1.6.5. - [Release notes](https://github.com/springdoc/springdoc-openapi/releases) - [Changelog](https://github.com/springdoc/springdoc-openapi/blob/master/CHANGELOG.md) - [Commits](https://github.com/springdoc/springdoc-openapi/compare/v1.6.4...v1.6.5) --- updated-dependencies: - dependency-name: org.springdoc:springdoc-openapi-webflux-ui dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Increase default gas limit used by acceptance tests (#3227) In recent service version releases the gas cost has increased. In cases where a system account is used this gas limit has exceeded the default gas limit used by acceptance tests - Increase default gas limit to support gas cost for system accounts with far off expiration Signed-off-by: Nana-EC Signed-off-by: Matheus DallRosa * Bump software.amazon.awssdk:bom from 2.17.117 to 2.17.121 (#3242) Bumps [software.amazon.awssdk:bom](https://github.com/aws/aws-sdk-java-v2) from 2.17.117 to 2.17.121. - [Release notes](https://github.com/aws/aws-sdk-java-v2/releases) - [Changelog](https://github.com/aws/aws-sdk-java-v2/blob/master/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-java-v2/compare/2.17.117...2.17.121) --- updated-dependencies: - dependency-name: software.amazon.awssdk:bom dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Support HIP-31 expected token decimals in rosetta (#3228) - Set expected decimals for fungible token transfers in cryptoTransferTransactionConstructor - Deprecate the token repository - Enable hts bdd tests in online and offline paired rosetta server env in github workflow Signed-off-by: Xin Li Signed-off-by: Matheus DallRosa * Upgrade hedera-sdk-go to v2.8.0 (#3254) Signed-off-by: Xin Li Signed-off-by: Matheus DallRosa * Add auto restore functionality to Rosetta unified image (#3253) * Add auto restore functionality to Rosetta unified image * Add documentation for running unified image * Change Rosetta default start date to epoch * Fix documentation bug with wrong units for checkpoint_timeout Signed-off-by: Steven Sheehy Signed-off-by: Matheus DallRosa * Add a property to control persistence of topic messages (#3255) * Add a property to control persistence of topic messages * Change Rosetta single image to disable persistence of topic messages by default Signed-off-by: Steven Sheehy Signed-off-by: Matheus DallRosa * Handle invalid entity ID in GCP Pub/Sub (#3257) Signed-off-by: Steven Sheehy Signed-off-by: Matheus DallRosa * Support HIP-329 CREATE2 opcode (#3217) * Add evm_address to contract and contract_history tables * Add an EntityIdService service to centralize alias/evm_address lookups * Make RecordItem HAPI version aware and skip persisting contracts from createdContractIDs if HAPI >= 0.23.0 * Populate evm_address for newly created contracts * Rename solidity_address to evm_adress in REST API response Signed-off-by: Xin Li Signed-off-by: Steven Sheehy Co-authored-by: Steven Sheehy Signed-off-by: Matheus DallRosa * Support HIP-336 Allowance APIs (#3252) * Add an allowance design document * Add crypto_allowance, nft_allowance and token_allowance & corresponding history tables * Refactor history tables to use new History interface Signed-off-by: Steven Sheehy Signed-off-by: Matheus DallRosa * Bump versions for v0.51.0-SNAPSHOT (#3273) * Bump versions for v0.51.0-SNAPSHOT Signed-off-by: Hedera Github Bot Signed-off-by: Matheus DallRosa * Update acceptance tests to use evmAddress (#3274) In v0.50 we updated the REST contract response to use `evmAddress` instead of `solidityAddress`. - Update `MirrorContractResponse` with property change - Update `FeatureInputHandler` methods for address parsing Signed-off-by: Nana-EC Signed-off-by: Matheus DallRosa * Bump mathjs in /hedera-mirror-rest/monitoring/monitor_apis (#3258) Bumps [mathjs](https://github.com/josdejong/mathjs) from 10.1.0 to 10.1.1. - [Release notes](https://github.com/josdejong/mathjs/releases) - [Changelog](https://github.com/josdejong/mathjs/blob/develop/HISTORY.md) - [Commits](https://github.com/josdejong/mathjs/compare/v10.1.0...v10.1.1) --- updated-dependencies: - dependency-name: mathjs dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump sinon from 13.0.0 to 13.0.1 in /hedera-mirror-rest (#3259) Bumps [sinon](https://github.com/sinonjs/sinon) from 13.0.0 to 13.0.1. - [Release notes](https://github.com/sinonjs/sinon/releases) - [Changelog](https://github.com/sinonjs/sinon/blob/master/docs/changelog.md) - [Commits](https://github.com/sinonjs/sinon/compare/v13.0.0...v13.0.1) --- updated-dependencies: - dependency-name: sinon dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump eslint-plugin-jest from 26.0.0 to 26.1.0 in /hedera-mirror-rest (#3260) Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 26.0.0 to 26.1.0. - [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases) - [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/main/CHANGELOG.md) - [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v26.0.0...v26.1.0) --- updated-dependencies: - dependency-name: eslint-plugin-jest dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump software.amazon.awssdk:bom from 2.17.121 to 2.17.124 (#3261) Bumps [software.amazon.awssdk:bom](https://github.com/aws/aws-sdk-java-v2) from 2.17.121 to 2.17.124. - [Release notes](https://github.com/aws/aws-sdk-java-v2/releases) - [Changelog](https://github.com/aws/aws-sdk-java-v2/blob/master/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-java-v2/compare/2.17.121...2.17.124) --- updated-dependencies: - dependency-name: software.amazon.awssdk:bom dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump pg from 8.7.1 to 8.7.3 in /hedera-mirror-rest (#3262) Bumps [pg](https://github.com/brianc/node-postgres/tree/HEAD/packages/pg) from 8.7.1 to 8.7.3. - [Release notes](https://github.com/brianc/node-postgres/releases) - [Changelog](https://github.com/brianc/node-postgres/blob/master/CHANGELOG.md) - [Commits](https://github.com/brianc/node-postgres/commits/pg@8.7.3/packages/pg) --- updated-dependencies: - dependency-name: pg dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump springdoc-openapi-webflux-ui from 1.6.5 to 1.6.6 (#3266) Bumps [springdoc-openapi-webflux-ui](https://github.com/springdoc/springdoc-openapi) from 1.6.5 to 1.6.6. - [Release notes](https://github.com/springdoc/springdoc-openapi/releases) - [Changelog](https://github.com/springdoc/springdoc-openapi/blob/master/CHANGELOG.md) - [Commits](https://github.com/springdoc/springdoc-openapi/compare/v1.6.5...v1.6.6) --- updated-dependencies: - dependency-name: org.springdoc:springdoc-openapi-webflux-ui dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump aws-sdk from 2.1066.0 to 2.1070.0 in /hedera-mirror-rest (#3276) Bumps [aws-sdk](https://github.com/aws/aws-sdk-js) from 2.1066.0 to 2.1070.0. - [Release notes](https://github.com/aws/aws-sdk-js/releases) - [Changelog](https://github.com/aws/aws-sdk-js/blob/master/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-js/compare/v2.1066.0...v2.1070.0) --- updated-dependencies: - dependency-name: aws-sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump follow-redirects from 1.14.7 to 1.14.8 in /hedera-mirror-rest (#3277) Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.14.7 to 1.14.8. - [Release notes](https://github.com/follow-redirects/follow-redirects/releases) - [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.14.7...v1.14.8) --- updated-dependencies: - dependency-name: follow-redirects dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump docker-maven-plugin from 0.38.1 to 0.39.0 (#3268) Bumps [docker-maven-plugin](https://github.com/fabric8io/docker-maven-plugin) from 0.38.1 to 0.39.0. - [Release notes](https://github.com/fabric8io/docker-maven-plugin/releases) - [Changelog](https://github.com/fabric8io/docker-maven-plugin/blob/master/doc/changelog.md) - [Commits](https://github.com/fabric8io/docker-maven-plugin/compare/v0.38.1...v0.39.0) --- updated-dependencies: - dependency-name: io.fabric8:docker-maven-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump mathjs from 10.1.0 to 10.1.1 in /hedera-mirror-rest (#3267) Bumps [mathjs](https://github.com/josdejong/mathjs) from 10.1.0 to 10.1.1. - [Release notes](https://github.com/josdejong/mathjs/releases) - [Changelog](https://github.com/josdejong/mathjs/blob/develop/HISTORY.md) - [Commits](https://github.com/josdejong/mathjs/compare/v10.1.0...v10.1.1) --- updated-dependencies: - dependency-name: mathjs dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump jest from 27.4.7 to 27.5.1 in /hedera-mirror-rest (#3282) Bumps [jest](https://github.com/facebook/jest) from 27.4.7 to 27.5.1. - [Release notes](https://github.com/facebook/jest/releases) - [Changelog](https://github.com/facebook/jest/blob/main/CHANGELOG.md) - [Commits](https://github.com/facebook/jest/compare/v27.4.7...v27.5.1) --- updated-dependencies: - dependency-name: jest dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump aws-sdk from 2.1066.0 to 2.1071.0 in /hedera-mirror-rest (#3280) Bumps [aws-sdk](https://github.com/aws/aws-sdk-js) from 2.1066.0 to 2.1071.0. - [Release notes](https://github.com/aws/aws-sdk-js/releases) - [Changelog](https://github.com/aws/aws-sdk-js/blob/master/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-js/compare/v2.1066.0...v2.1071.0) --- updated-dependencies: - dependency-name: aws-sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump jest from 27.4.7 to 27.5.1 in /hedera-mirror-rest/check-state-proof (#3278) Bumps [jest](https://github.com/facebook/jest) from 27.4.7 to 27.5.1. - [Release notes](https://github.com/facebook/jest/releases) - [Changelog](https://github.com/facebook/jest/blob/main/CHANGELOG.md) - [Commits](https://github.com/facebook/jest/compare/v27.4.7...v27.5.1) --- updated-dependencies: - dependency-name: jest dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump jest in /hedera-mirror-rest/monitoring/monitor_apis (#3279) Bumps [jest](https://github.com/facebook/jest) from 27.4.7 to 27.5.1. - [Release notes](https://github.com/facebook/jest/releases) - [Changelog](https://github.com/facebook/jest/blob/main/CHANGELOG.md) - [Commits](https://github.com/facebook/jest/compare/v27.4.7...v27.5.1) --- updated-dependencies: - dependency-name: jest dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump @hashgraph/proto in /hedera-mirror-rest/check-state-proof (#3270) Bumps [@hashgraph/proto](https://github.com/hashgraph/hedera-sdk-js) from 2.1.2 to 2.1.3. - [Release notes](https://github.com/hashgraph/hedera-sdk-js/releases) - [Changelog](https://github.com/hashgraph/hedera-sdk-js/blob/main/CHANGELOG.md) - [Commits](https://github.com/hashgraph/hedera-sdk-js/commits) --- updated-dependencies: - dependency-name: "@hashgraph/proto" dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump @hashgraph/proto from 2.1.2 to 2.1.3 in /hedera-mirror-rest (#3265) Bumps [@hashgraph/proto](https://github.com/hashgraph/hedera-sdk-js) from 2.1.2 to 2.1.3. - [Release notes](https://github.com/hashgraph/hedera-sdk-js/releases) - [Changelog](https://github.com/hashgraph/hedera-sdk-js/blob/main/CHANGELOG.md) - [Commits](https://github.com/hashgraph/hedera-sdk-js/commits) --- updated-dependencies: - dependency-name: "@hashgraph/proto" dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Update license year to 2022 (#3283) Signed-off-by: Steven Sheehy Signed-off-by: Matheus DallRosa * Bump sdk from 2.6.0 to 2.7.0 (#3263) * Bump sdk from 2.6.0 to 2.7.0 Bumps [sdk](https://github.com/hashgraph/hedera-sdk-java) from 2.6.0 to 2.7.0. - [Release notes](https://github.com/hashgraph/hedera-sdk-java/releases) - [Changelog](https://github.com/hashgraph/hedera-sdk-java/blob/main/CHANGELOG.md) - [Commits](https://github.com/hashgraph/hedera-sdk-java/compare/v2.6.0...v2.7.0) --- updated-dependencies: - dependency-name: com.hedera.hashgraph:sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: Steven Sheehy Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Steven Sheehy Signed-off-by: Matheus DallRosa * Embed rosetta default configuration file (#3286) Signed-off-by: Xin Li Signed-off-by: Matheus DallRosa * Fix failing chart workflow (#3288) * Add retry capability to image import in chart workflow * Bump Rosetta to Go 1.17.1 and use the smaller alpine variant * Bump Maven Wrapper to 3.1.0 (now officially part of Apache) Signed-off-by: Steven Sheehy Signed-off-by: Matheus DallRosa * Bump axios from 0.25.0 to 0.26.0 in /hedera-mirror-rest (#3291) Bumps [axios](https://github.com/axios/axios) from 0.25.0 to 0.26.0. - [Release notes](https://github.com/axios/axios/releases) - [Changelog](https://github.com/axios/axios/blob/master/CHANGELOG.md) - [Commits](https://github.com/axios/axios/compare/v0.25.0...v0.26.0) --- updated-dependencies: - dependency-name: axios dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump software.amazon.awssdk:bom from 2.17.124 to 2.17.129 (#3293) Bumps [software.amazon.awssdk:bom](https://github.com/aws/aws-sdk-java-v2) from 2.17.124 to 2.17.129. - [Release notes](https://github.com/aws/aws-sdk-java-v2/releases) - [Changelog](https://github.com/aws/aws-sdk-java-v2/blob/master/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-java-v2/compare/2.17.124...2.17.129) --- updated-dependencies: - dependency-name: software.amazon.awssdk:bom dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump aws-sdk from 2.1071.0 to 2.1073.0 in /hedera-mirror-rest (#3292) Bumps [aws-sdk](https://github.com/aws/aws-sdk-js) from 2.1071.0 to 2.1073.0. - [Release notes](https://github.com/aws/aws-sdk-js/releases) - [Changelog](https://github.com/aws/aws-sdk-js/blob/master/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-js/compare/v2.1071.0...v2.1073.0) --- updated-dependencies: - dependency-name: aws-sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump hedera-protobufs from 0.23.0-alpha.2 to 0.23.1 (#3299) * Bump hedera-protobufs from 0.23.0-alpha.2 to 0.23.1 * Fix codecov notifying/commenting before all reports are uploaded * Exclude domain POJOs from code coverage Signed-off-by: Steven Sheehy Signed-off-by: Matheus DallRosa * Kubernetes tracing and metrics improvements (#3298) * Add missing REST configuration to docs * Change REST API to log at info level by default to reduce log volume * Change REST API to generate a consistent trace log for all responses * Change Traefik to only log non-2xx requests to reduce log volume * Fix client IP not showing up in any trace logs * Fix Lettuce histogram metrics enabled by default and generating ~10K series * Fix monitor not tracing requests in some scenarios and add test coverage * Improve GCP Pub/Sub performance by reusing printer across transactions * Remove some REST API metric buckets to reduce number of overall time series Signed-off-by: Steven Sheehy Signed-off-by: Matheus DallRosa * Bump github.com/jackc/pgtype in /hedera-mirror-rosetta (#3295) Bumps [github.com/jackc/pgtype](https://github.com/jackc/pgtype) from 1.9.1 to 1.10.0. - [Release notes](https://github.com/jackc/pgtype/releases) - [Changelog](https://github.com/jackc/pgtype/blob/master/CHANGELOG.md) - [Commits](https://github.com/jackc/pgtype/compare/v1.9.1...v1.10.0) --- updated-dependencies: - dependency-name: github.com/jackc/pgtype dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Bump github.com/coinbase/rosetta-sdk-go in /hedera-mirror-rosetta (#3294) Bumps [github.com/coinbase/rosetta-sdk-go](https://github.com/coinbase/rosetta-sdk-go) from 0.7.2 to 0.7.3. - [Release notes](https://github.com/coinbase/rosetta-sdk-go/releases) - [Commits](https://github.com/coinbase/rosetta-sdk-go/compare/v0.7.2...v0.7.3) --- updated-dependencies: - dependency-name: github.com/coinbase/rosetta-sdk-go dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Matheus DallRosa * Workaround the missing disappearing token transfer issue (#3289) - Add workaround for the missing disappearing token transfer issue - Improve nft balance tracking performance - Only show token related data for tokens created after genesis timestmap - Update rosetta-cli check:data configuration to sync from index 1 - Remove genesis token balance retrieval logic in get-genesis-balance.sh - Update rosetta github workflow to not generate genesis balance JSON file - Fix bug that importer start date can't be changed - Enable supervisorctl - Fix issue that the supervisord process doesn't get SIGTERM sent by docker stop - Set stopwaitsecs for importer and postgres for graceful shutdown - Update postgres config for normal operation Signed-off-by: Xin Li Signed-off-by: Matheus DallRosa * Bump versions for v0.52.0-SNAPSHOT (#3303) * Bump versions for v0.52.0-SNAPSHOT Signed-off-by: Hedera Github Bot Signed-off-by: Matheus DallRosa * remove api base url, since it can be easily configured Signed-off-by: Matheus DallRosa * add license headers Signed-off-by: Matheus DallRosa * fix typo Signed-off-by: Matheus DallRosa * use constants for strings Signed-off-by: Matheus DallRosa * remove console.log call Signed-off-by: Matheus DallRosa * check result field inside of error_code Signed-off-by: Matheus DallRosa * fix formatting Signed-off-by: Matheus DallRosa * remove file Signed-off-by: Matheus DallRosa * check every 2** status Signed-off-by: Matheus DallRosa * check only for non empty list Signed-off-by: Matheus DallRosa * remove -env option Signed-off-by: Matheus DallRosa * remove -env option Signed-off-by: Matheus DallRosa * Add balancesAccount tests to the index.js Signed-off-by: Matheus DallRosa * verify all 2** status Signed-off-by: Matheus DallRosa * remove .env files Signed-off-by: Matheus DallRosa * remove duplicated code from merge resolution Signed-off-by: Matheus DallRosa * fix conflict Signed-off-by: Matheus DallRosa * only check if response list is non empty Signed-off-by: Matheus DallRosa * force Husky to be executed Signed-off-by: Matheus DallRosa * use constants instead of string literals Signed-off-by: Matheus DallRosa * reformat files Signed-off-by: Matheus DallRosa * reformat files Signed-off-by: Matheus DallRosa * build the test parameters set inside k6 Signed-off-by: Matheus DallRosa * add setup step for each individual test Signed-off-by: Matheus DallRosa * remove mock Signed-off-by: Matheus DallRosa * validate topic env variables Signed-off-by: Matheus DallRosa * add back properties to test parameters map Signed-off-by: Matheus DallRosa * Move rest bootstrap to inside rest module Signed-off-by: Matheus DallRosa * refactor rosetta tests Signed-off-by: Matheus DallRosa * update readme Signed-off-by: Matheus DallRosa * rename limit parameter and set defaults Signed-off-by: Matheus DallRosa * add validation back and fix readme Signed-off-by: Matheus DallRosa * improve readme Signed-off-by: Matheus DallRosa * remove mock Signed-off-by: Matheus DallRosa * validate response status code Signed-off-by: Matheus DallRosa * fix mapping Signed-off-by: Matheus DallRosa * remove not used constants Signed-off-by: Matheus DallRosa * use only upper case names for the env vairables Signed-off-by: Matheus DallRosa * get network from rosetta api and rename BASE_URL to baseUrl Signed-off-by: Matheus DallRosa * get topic info from rest api Signed-off-by: Matheus DallRosa * small fixes Signed-off-by: Matheus DallRosa * remove logs for debugging Signed-off-by: Matheus DallRosa * pass the baseUrl down Signed-off-by: Matheus DallRosa * do not follow the next link Signed-off-by: Matheus DallRosa * use env props for rosetta tests Signed-off-by: Matheus DallRosa * Improve readme Signed-off-by: Matheus DallRosa * get the pass rate and duration from environment variables map Signed-off-by: Matheus DallRosa * remove report file Signed-off-by: Matheus DallRosa * ignore reports generated by k6 tests Signed-off-by: Matheus DallRosa * remove mock Signed-off-by: Matheus DallRosa Co-authored-by: Matheus DallRosa Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ian Jungmann Co-authored-by: Steven Sheehy <17552371+steven-sheehy@users.noreply.github.com> Co-authored-by: hedera-github-bot <83613065+hedera-github-bot@users.noreply.github.com> Co-authored-by: Steven Sheehy Co-authored-by: Nana-EC <56320167+Nana-EC@users.noreply.github.com> --- .gitignore | 3 + .../importer/config/MetricsConfiguration.java | 2 +- .../monitor/config/MetricsConfiguration.java | 4 +- .../scripts/validation/get-genesis-balance.sh | 1 + hedera-mirror-test/k6/README.md | 226 ++++++++++++++++ hedera-mirror-test/k6/src/lib/common.js | 220 +++++++++++++++ hedera-mirror-test/k6/src/lib/constants.js | 31 +++ hedera-mirror-test/k6/src/lib/parameters.js | 251 ++++++++++++++++++ hedera-mirror-test/k6/src/rest/apis.js | 43 +++ .../k6/src/rest/test/accounts.js | 42 +++ .../k6/src/rest/test/accountsBalanceFalse.js | 39 +++ .../rest/test/accountsBalanceFalsePubkey.js | 42 +++ .../k6/src/rest/test/accountsBalanceGt0.js | 42 +++ .../src/rest/test/accountsBalanceGt0Pubkey.js | 42 +++ .../k6/src/rest/test/accountsBalanceNe.js | 42 +++ .../k6/src/rest/test/accountsId.js | 43 +++ .../k6/src/rest/test/accountsIdNe.js | 42 +++ .../k6/src/rest/test/balances.js | 42 +++ .../k6/src/rest/test/balancesAccount.js | 41 +++ .../src/rest/test/bootstrapEnvParameters.js | 52 ++++ hedera-mirror-test/k6/src/rest/test/common.js | 37 +++ .../k6/src/rest/test/contracts.js | 42 +++ .../k6/src/rest/test/contractsId.js | 42 +++ .../k6/src/rest/test/contractsIdResults.js | 42 +++ .../src/rest/test/contractsIdResultsLogs.js | 42 +++ .../rest/test/contractsIdResultsTimestamp.js | 42 +++ hedera-mirror-test/k6/src/rest/test/index.js | 101 +++++++ .../k6/src/rest/test/networkSupply.js | 42 +++ .../k6/src/rest/test/schedules.js | 42 +++ .../k6/src/rest/test/schedulesAccount.js | 42 +++ .../k6/src/rest/test/schedulesId.js | 42 +++ hedera-mirror-test/k6/src/rest/test/tokens.js | 42 +++ .../k6/src/rest/test/tokensFungibleCommon.js | 42 +++ .../k6/src/rest/test/tokensId.js | 42 +++ .../k6/src/rest/test/tokensIdBalances.js | 42 +++ .../k6/src/rest/test/tokensNfts.js | 42 +++ .../k6/src/rest/test/tokensNftsSerial.js | 42 +++ .../rest/test/tokensNftsSerialTransactions.js | 42 +++ .../src/rest/test/tokensNonFungibleUnique.js | 42 +++ .../k6/src/rest/test/tokensTokenIdNe.js | 42 +++ .../k6/src/rest/test/topicsIdMessages.js | 42 +++ .../src/rest/test/topicsIdMessagesSequence.js | 43 +++ .../topicsIdMessagesSequenceQueryParam.js | 42 +++ .../src/rest/test/topicsMessagesTimestamp.js | 42 +++ .../k6/src/rest/test/transactions.js | 42 +++ .../k6/src/rest/test/transactionsAccountId.js | 42 +++ .../k6/src/rest/test/transactionsId.js | 42 +++ hedera-mirror-test/k6/src/rosetta/apis.js | 43 +++ .../k6/src/rosetta/test/accountBalance.js | 45 ++++ .../k6/src/rosetta/test/block.js | 44 +++ .../k6/src/rosetta/test/blockTransaction.js | 45 ++++ .../rosetta/test/bootstrapEnvParameters.js | 96 +++++++ .../k6/src/rosetta/test/constants.js | 31 +++ .../src/rosetta/test/constructionCombine.js | 57 ++++ .../k6/src/rosetta/test/constructionHash.js | 44 +++ .../k6/src/rosetta/test/constructionParse.js | 45 ++++ .../src/rosetta/test/constructionPayloads.js | 44 +++ .../rosetta/test/constructionPreprocess.js | 44 +++ .../k6/src/rosetta/test/index.js | 53 ++++ .../k6/src/rosetta/test/networkList.js | 41 +++ .../k6/src/rosetta/test/networkOptions.js | 44 +++ .../k6/src/rosetta/test/networkStatus.js | 45 ++++ hedera-mirror-test/k6/src/web3/apis.js | 40 +++ hedera-mirror-test/k6/src/web3/test/common.js | 39 +++ .../k6/src/web3/test/ethBlockNumber.js | 47 ++++ hedera-mirror-test/k6/src/web3/test/index.js | 31 +++ 66 files changed, 3314 insertions(+), 3 deletions(-) create mode 100644 hedera-mirror-test/k6/README.md create mode 100644 hedera-mirror-test/k6/src/lib/common.js create mode 100644 hedera-mirror-test/k6/src/lib/constants.js create mode 100644 hedera-mirror-test/k6/src/lib/parameters.js create mode 100644 hedera-mirror-test/k6/src/rest/apis.js create mode 100644 hedera-mirror-test/k6/src/rest/test/accounts.js create mode 100644 hedera-mirror-test/k6/src/rest/test/accountsBalanceFalse.js create mode 100644 hedera-mirror-test/k6/src/rest/test/accountsBalanceFalsePubkey.js create mode 100644 hedera-mirror-test/k6/src/rest/test/accountsBalanceGt0.js create mode 100644 hedera-mirror-test/k6/src/rest/test/accountsBalanceGt0Pubkey.js create mode 100644 hedera-mirror-test/k6/src/rest/test/accountsBalanceNe.js create mode 100644 hedera-mirror-test/k6/src/rest/test/accountsId.js create mode 100644 hedera-mirror-test/k6/src/rest/test/accountsIdNe.js create mode 100644 hedera-mirror-test/k6/src/rest/test/balances.js create mode 100644 hedera-mirror-test/k6/src/rest/test/balancesAccount.js create mode 100644 hedera-mirror-test/k6/src/rest/test/bootstrapEnvParameters.js create mode 100644 hedera-mirror-test/k6/src/rest/test/common.js create mode 100644 hedera-mirror-test/k6/src/rest/test/contracts.js create mode 100644 hedera-mirror-test/k6/src/rest/test/contractsId.js create mode 100644 hedera-mirror-test/k6/src/rest/test/contractsIdResults.js create mode 100644 hedera-mirror-test/k6/src/rest/test/contractsIdResultsLogs.js create mode 100644 hedera-mirror-test/k6/src/rest/test/contractsIdResultsTimestamp.js create mode 100644 hedera-mirror-test/k6/src/rest/test/index.js create mode 100644 hedera-mirror-test/k6/src/rest/test/networkSupply.js create mode 100644 hedera-mirror-test/k6/src/rest/test/schedules.js create mode 100644 hedera-mirror-test/k6/src/rest/test/schedulesAccount.js create mode 100644 hedera-mirror-test/k6/src/rest/test/schedulesId.js create mode 100644 hedera-mirror-test/k6/src/rest/test/tokens.js create mode 100644 hedera-mirror-test/k6/src/rest/test/tokensFungibleCommon.js create mode 100644 hedera-mirror-test/k6/src/rest/test/tokensId.js create mode 100644 hedera-mirror-test/k6/src/rest/test/tokensIdBalances.js create mode 100644 hedera-mirror-test/k6/src/rest/test/tokensNfts.js create mode 100644 hedera-mirror-test/k6/src/rest/test/tokensNftsSerial.js create mode 100644 hedera-mirror-test/k6/src/rest/test/tokensNftsSerialTransactions.js create mode 100644 hedera-mirror-test/k6/src/rest/test/tokensNonFungibleUnique.js create mode 100644 hedera-mirror-test/k6/src/rest/test/tokensTokenIdNe.js create mode 100644 hedera-mirror-test/k6/src/rest/test/topicsIdMessages.js create mode 100644 hedera-mirror-test/k6/src/rest/test/topicsIdMessagesSequence.js create mode 100644 hedera-mirror-test/k6/src/rest/test/topicsIdMessagesSequenceQueryParam.js create mode 100644 hedera-mirror-test/k6/src/rest/test/topicsMessagesTimestamp.js create mode 100644 hedera-mirror-test/k6/src/rest/test/transactions.js create mode 100644 hedera-mirror-test/k6/src/rest/test/transactionsAccountId.js create mode 100644 hedera-mirror-test/k6/src/rest/test/transactionsId.js create mode 100644 hedera-mirror-test/k6/src/rosetta/apis.js create mode 100644 hedera-mirror-test/k6/src/rosetta/test/accountBalance.js create mode 100644 hedera-mirror-test/k6/src/rosetta/test/block.js create mode 100644 hedera-mirror-test/k6/src/rosetta/test/blockTransaction.js create mode 100644 hedera-mirror-test/k6/src/rosetta/test/bootstrapEnvParameters.js create mode 100644 hedera-mirror-test/k6/src/rosetta/test/constants.js create mode 100644 hedera-mirror-test/k6/src/rosetta/test/constructionCombine.js create mode 100644 hedera-mirror-test/k6/src/rosetta/test/constructionHash.js create mode 100644 hedera-mirror-test/k6/src/rosetta/test/constructionParse.js create mode 100644 hedera-mirror-test/k6/src/rosetta/test/constructionPayloads.js create mode 100644 hedera-mirror-test/k6/src/rosetta/test/constructionPreprocess.js create mode 100644 hedera-mirror-test/k6/src/rosetta/test/index.js create mode 100644 hedera-mirror-test/k6/src/rosetta/test/networkList.js create mode 100644 hedera-mirror-test/k6/src/rosetta/test/networkOptions.js create mode 100644 hedera-mirror-test/k6/src/rosetta/test/networkStatus.js create mode 100644 hedera-mirror-test/k6/src/web3/apis.js create mode 100644 hedera-mirror-test/k6/src/web3/test/common.js create mode 100644 hedera-mirror-test/k6/src/web3/test/ethBlockNumber.js create mode 100644 hedera-mirror-test/k6/src/web3/test/index.js diff --git a/.gitignore b/.gitignore index 91eaee4d801..3781aba14ec 100644 --- a/.gitignore +++ b/.gitignore @@ -134,3 +134,6 @@ coverage.txt # Auto-generated release notes release_notes.md + +# Ignore reports generated by k6 tests +*report.md diff --git a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/config/MetricsConfiguration.java b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/config/MetricsConfiguration.java index 43de609bc61..399b0b50eb4 100644 --- a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/config/MetricsConfiguration.java +++ b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/config/MetricsConfiguration.java @@ -26,8 +26,8 @@ import io.lettuce.core.metrics.MicrometerOptions; import io.lettuce.core.resource.ClientResources; import io.lettuce.core.resource.DefaultClientResources; -import io.micrometer.core.instrument.Gauge; import io.micrometer.core.instrument.MeterRegistry; +import io.micrometer.core.instrument.Gauge; import io.micrometer.core.instrument.binder.BaseUnits; import io.micrometer.core.instrument.binder.MeterBinder; import io.micrometer.core.instrument.binder.db.PostgreSQLDatabaseMetrics; diff --git a/hedera-mirror-monitor/src/main/java/com/hedera/mirror/monitor/config/MetricsConfiguration.java b/hedera-mirror-monitor/src/main/java/com/hedera/mirror/monitor/config/MetricsConfiguration.java index 475331c3ea3..4d17afbe0b5 100644 --- a/hedera-mirror-monitor/src/main/java/com/hedera/mirror/monitor/config/MetricsConfiguration.java +++ b/hedera-mirror-monitor/src/main/java/com/hedera/mirror/monitor/config/MetricsConfiguration.java @@ -9,9 +9,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/hedera-mirror-rosetta/scripts/validation/get-genesis-balance.sh b/hedera-mirror-rosetta/scripts/validation/get-genesis-balance.sh index 0d79892d40a..c05a06ab94b 100755 --- a/hedera-mirror-rosetta/scripts/validation/get-genesis-balance.sh +++ b/hedera-mirror-rosetta/scripts/validation/get-genesis-balance.sh @@ -111,4 +111,5 @@ hbar_json=$(echo "$account_balances" | \ '[.[] | .account_identifier.address=("0.0." + .id) | del(.id) ] | .[].currency=$currency') echo "$hbar_json" > "$parent_path/$network/data_genesis_balances.json" + echo "Data genesis balances written after ${SECONDS}s" diff --git a/hedera-mirror-test/k6/README.md b/hedera-mirror-test/k6/README.md new file mode 100644 index 00000000000..14500e2da50 --- /dev/null +++ b/hedera-mirror-test/k6/README.md @@ -0,0 +1,226 @@ + +# K6 Performance Tests + +This module covers the [k6](https://k6.io/) based performance tests for Mirror Node APIs including rest, rosetta, +and web3. + +## Install k6 + +The k6 test engine is needed to run the tests. Please follow +the [official documentation](https://k6.io/docs/getting-started/installation/) to install k6. + +## Run The Tests + +The tests are organized per API, and they reside in `src/rest`, `src/rosetta`, and `src/web3` respectively. You can run +the tests of an API as a test suite. You can also run tests one at a time. + +### Test Suite + +To run a test suite, such as rest, use the following command. + +```shell +DEFAULT_DURATION=1s \ +DEFAULT_VUS=1 \ +BASE_URL=https://testnet.mirrornode.hedera.com \ +DEFAULT_LIMIT=100 k6 run src/rest/apis.js +``` + +Another option is to have a parameters file named `parameters.env` with the content: + +```shell +export DEFAULT_DURATION=1s +export DEFAULT_VUS=1 +export BASE_URL=https://testnet.mirrornode.hedera.com +export DEFAULT_LIMIT=100 +``` + +And execute k6 after exporting the values for the env variables: + +```shell +source parameters.env +k6 run src/rest/apis.js +``` + +For not domain specific parameters like: + +- DEFAULT_DURATION +- DEFAULT_VUS +- BASE_URL +- DEFAULT_LIMIT + +The value can be set via environment variables. If no value is set, then a sane default will be used. + +For domain specific parameters the following rule is used: +When the value of a parameter is set with an environment variable, the value will be used, but if no value is set for a +particular parameter, then its value will be found by querying either the rest or rosetta APIs. + +The following parameters can be used to configure a rest test: + +- DEFAULT_ACCOUNT_ID +- DEFAULT_ACCOUNT_BALANCE +- DEFAULT_CONTRACT_ID +- DEFAULT_CONTRACT_TIMESTAMP +- DEFAULT_NFT_ID +- DEFAULT_NFT_SERIAL +- DEFAULT_PUBLIC_KEY +- DEFAULT_SCHEDULE_ACCOUNT_ID +- DEFAULT_SCHEDULE_ID +- DEFAULT_TOKEN_ID +- DEFAULT_TOPIC_ID +- DEFAULT_TOPIC_SEQUENCE +- DEFAULT_TRANSACTION_ID + +The following parameters can be used to configure a rosetta test: + +- DEFAULT_BLOCK_INDEX +- DEFAULT_BLOCK_HASH +- DEFAULT_NETWORK +- DEFAULT_TRANSACTION_HASH + +The test suite will run the tests sequentially with a configurable graceful stop time in between, so they don't +interfere with each other. + +Once the tests complete, `k6` will show a summary report. + +``` + /\ |‾‾| /‾‾/ /‾‾/ + /\ / \ | |/ / / / + / \/ \ | ( / ‾‾\ + / \ | |\ \ | (‾) | + / __________ \ |__| \__\ \_____/ .io + + execution: local + script: apis.js + output: - + + scenarios: (100.00%) 11 scenarios, 500 max VUs, 11m55s max duration (incl. graceful stop): + * accountBalance: 500 looping VUs for 1m0s (exec: run, gracefulStop: 5s) + * block: 500 looping VUs for 1m0s (exec: run, startTime: 1m5s, gracefulStop: 5s) + * blockTransaction: 500 looping VUs for 1m0s (exec: run, startTime: 2m10s, gracefulStop: 5s) + * constructionCombine: 500 looping VUs for 1m0s (exec: run, startTime: 3m15s, gracefulStop: 5s) + * constructionHash: 500 looping VUs for 1m0s (exec: run, startTime: 4m20s, gracefulStop: 5s) + * constructionParse: 500 looping VUs for 1m0s (exec: run, startTime: 5m25s, gracefulStop: 5s) + * constructionPayloads: 500 looping VUs for 1m0s (exec: run, startTime: 6m30s, gracefulStop: 5s) + * constructionPreprocess: 500 looping VUs for 1m0s (exec: run, startTime: 7m35s, gracefulStop: 5s) + * networkList: 500 looping VUs for 1m0s (exec: run, startTime: 8m40s, gracefulStop: 5s) + * networkOptions: 500 looping VUs for 1m0s (exec: run, startTime: 9m45s, gracefulStop: 5s) + * networkStatus: 500 looping VUs for 1m0s (exec: run, startTime: 10m50s, gracefulStop: 5s) + + +running (11m50.2s), 000/500 VUs, 2910275 complete and 0 interrupted iterations +accountBalance ✓ [======================================] 500 VUs 1m0s +block ✓ [======================================] 500 VUs 1m0s +blockTransaction ✓ [======================================] 500 VUs 1m0s +constructionCombine ✓ [======================================] 500 VUs 1m0s +constructionHash ✓ [======================================] 500 VUs 1m0s +constructionParse ✓ [======================================] 500 VUs 1m0s +constructionPayloads ✓ [======================================] 500 VUs 1m0s +constructionPreprocess ✓ [======================================] 500 VUs 1m0s +networkList ✓ [======================================] 500 VUs 1m0s +networkOptions ✓ [======================================] 500 VUs 1m0s +networkStatus ✓ [======================================] 500 VUs 1m0s + ✓ AccountBalance OK + ✓ Block OK + ✓ BlockTransaction OK + ✓ ConstructionCombine OK + ✓ ConstructionHash OK + ✓ ConstructionParse OK + ✓ ConstructionPayloads OK + ✓ ConstructionPreprocess OK + ✓ NetworkList OK + ✓ NetworkOptions OK + ✓ NetworkStatus OK + + checks.........................................................: 100.00% ✓ 2910275 ✗ 0 + ✓ { scenario:accountBalance }..................................: 100.00% ✓ 84283 ✗ 0 + ✓ { scenario:blockTransaction }................................: 100.00% ✓ 171178 ✗ 0 + ✓ { scenario:block }...........................................: 100.00% ✓ 99791 ✗ 0 + ✓ { scenario:constructionCombine }.............................: 100.00% ✓ 277238 ✗ 0 + ✓ { scenario:constructionHash }................................: 100.00% ✓ 353405 ✗ 0 + ✓ { scenario:constructionParse }...............................: 100.00% ✓ 345479 ✗ 0 + ✓ { scenario:constructionPayloads }............................: 100.00% ✓ 330888 ✗ 0 + ✓ { scenario:constructionPreprocess }..........................: 100.00% ✓ 331073 ✗ 0 + ✓ { scenario:networkList }.....................................: 100.00% ✓ 389307 ✗ 0 + ✓ { scenario:networkOptions }..................................: 100.00% ✓ 346037 ✗ 0 + ✓ { scenario:networkStatus }...................................: 100.00% ✓ 181596 ✗ 0 + data_received..................................................: 11 GB 16 MB/s + data_sent......................................................: 1.6 GB 2.2 MB/s + http_req_blocked...............................................: avg=26.28ms min=329.25µs med=26.12ms max=3.09s p(90)=45.56ms p(95)=57.14ms + http_req_connecting............................................: avg=26.06ms min=294.53µs med=25.98ms max=3.09s p(90)=45.09ms p(95)=56.56ms + http_req_duration..............................................: avg=83.76ms min=763.29µs med=51.09ms max=6.8s p(90)=145.26ms p(95)=225.72ms + { expected_response:true }...................................: avg=83.76ms min=763.29µs med=51.09ms max=6.8s p(90)=145.26ms p(95)=225.72ms + ✗ { scenario:accountBalance,expected_response:true }...........: avg=351.87ms min=23.48ms med=249.8ms max=4.23s p(90)=726.13ms p(95)=978.25ms + ✗ { scenario:block,expected_response:true }....................: avg=300.1ms min=16.65ms med=185.37ms max=6.8s p(90)=507.75ms p(95)=889.7ms + ✗ { scenario:blockTransaction,expected_response:true }.........: avg=164.43ms min=6.05ms med=108.42ms max=3.35s p(90)=330.46ms p(95)=525.31ms + ✓ { scenario:constructionCombine,expected_response:true }......: avg=73.77ms min=1.06ms med=65.47ms max=729.79ms p(90)=121.4ms p(95)=147.72ms + ✓ { scenario:constructionHash,expected_response:true }.........: avg=49.23ms min=813.14µs med=43.48ms max=485.16ms p(90)=82.14ms p(95)=100.07ms + ✓ { scenario:constructionParse,expected_response:true }........: avg=50.64ms min=888.63µs med=45.11ms max=528.51ms p(90)=81.39ms p(95)=100.5ms + ✓ { scenario:constructionPayloads,expected_response:true }.....: avg=56.43ms min=1.17ms med=49.81ms max=529.69ms p(90)=90.18ms p(95)=111.18ms + ✓ { scenario:constructionPreprocess,expected_response:true }...: avg=52.87ms min=1.08ms med=47.77ms max=486.11ms p(90)=82.71ms p(95)=103.17ms + ✓ { scenario:networkList,expected_response:true }..............: avg=44.76ms min=763.29µs med=40.33ms max=469.95ms p(90)=67.94ms p(95)=84.78ms + ✓ { scenario:networkOptions,expected_response:true }...........: avg=51.96ms min=1.74ms med=46.75ms max=477.27ms p(90)=79.69ms p(95)=97.45ms + ✓ { scenario:networkStatus,expected_response:true }............: avg=160.1ms min=7.16ms med=108.19ms max=2.52s p(90)=321.2ms p(95)=490.1ms + http_req_failed................................................: 0.00% ✓ 0 ✗ 2910275 + http_req_receiving.............................................: avg=7.96ms min=24.5µs med=5.23ms max=481.33ms p(90)=18.99ms p(95)=25.13ms + http_req_sending...............................................: avg=7.43ms min=19.24µs med=4.86ms max=492.96ms p(90)=17.78ms p(95)=23.77ms + http_req_tls_handshaking.......................................: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s + http_req_waiting...............................................: avg=68.35ms min=455.36µs med=35.52ms max=6.79s p(90)=128.24ms p(95)=220.83ms + http_reqs......................................................: 2910275 4097.974399/s + ✓ { scenario:accountBalance }..................................: 84283 118.679361/s + ✓ { scenario:blockTransaction }................................: 171178 241.036693/s + ✓ { scenario:block }...........................................: 99791 140.516262/s + ✓ { scenario:constructionCombine }.............................: 277238 390.380368/s + ✓ { scenario:constructionHash }................................: 353405 497.631544/s + ✓ { scenario:constructionParse }...............................: 345479 486.4709/s + ✓ { scenario:constructionPayloads }............................: 330888 465.925231/s + ✓ { scenario:constructionPreprocess }..........................: 331073 466.185731/s + ✓ { scenario:networkList }.....................................: 389307 548.18535/s + ✓ { scenario:networkOptions }..................................: 346037 487.256623/s + ✓ { scenario:networkStatus }...................................: 181596 255.706337/s + iteration_duration.............................................: avg=113.49ms min=1.8ms med=81.45ms max=6.8s p(90)=179.94ms p(95)=244.44ms + iterations.....................................................: 2910275 4097.974399/s + scenario_duration..............................................: 60166 min=38 max=60634 + ✓ { scenario:accountBalance }..................................: 60634 min=139 max=60634 + ✓ { scenario:blockTransaction }................................: 60253 min=40 max=60253 + ✓ { scenario:block }...........................................: 60282 min=112 max=60282 + ✓ { scenario:constructionCombine }.............................: 60068 min=39 max=60068 + ✓ { scenario:constructionHash }................................: 60136 min=41 max=60136 + ✓ { scenario:constructionParse }...............................: 60200 min=38 max=60200 + ✓ { scenario:constructionPayloads }............................: 60071 min=53 max=60071 + ✓ { scenario:constructionPreprocess }..........................: 60034 min=41 max=60034 + ✓ { scenario:networkList }.....................................: 60086 min=43 max=60086 + ✓ { scenario:networkOptions }..................................: 60041 min=40 max=60041 + ✓ { scenario:networkStatus }...................................: 60166 min=66 max=60166 + vus............................................................: 500 min=0 max=500 + vus_max........................................................: 500 min=500 max=500 ERRO[0719] some thresholds have failed +``` + +Note: disregard the per scenario RPS reported in the `http_reqs` section since it's calculated as the total requests in +a scenario divided by the run time of the test suite. + +With the test suite mode, a simplified markdown format report `report.md` will also be generated. + +| URL | VUS | Pass% | RPS | Avg. Req Duration | Comment | +|----------|-----|-------|-----|-------------------|---------| +| /account/balance | 500 | 100.00 | 1390.03/s | 351.87ms | | +| /block | 500 | 100.00 | 1655.40/s | 300.11ms | | +| /block/transaction | 500 | 100.00 | 2840.99/s | 164.44ms | | +| /construction/combine | 500 | 100.00 | 4615.40/s | 73.77ms | | +| /construction/hash | 500 | 100.00 | 5876.76/s | 49.23ms | | +| /construction/parse | 500 | 100.00 | 5738.85/s | 50.65ms | | +| /construction/payloads | 500 | 100.00 | 5508.28/s | 56.44ms | | +| /construction/preprocess | 500 | 100.00 | 5514.76/s | 52.88ms | | +| /network/list | 500 | 100.00 | 6479.16/s | 44.77ms | | +| /network/options | 500 | 100.00 | 5763.35/s | 51.97ms | | +| /network/status | 500 | 100.00 | 3018.25/s | 160.10ms | | + +### Single Test + +To run a single test, such as the rosetta accountBalance test, just do + +```shell +source src/rosetta/k6.env +k6 run src/rosetta/test/accountBalance.js +``` + +When it completes, k6 will show a similar summary report. However, there won't be a `report.md` report. diff --git a/hedera-mirror-test/k6/src/lib/common.js b/hedera-mirror-test/k6/src/lib/common.js new file mode 100644 index 00000000000..a338a218e4e --- /dev/null +++ b/hedera-mirror-test/k6/src/lib/common.js @@ -0,0 +1,220 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import {check} from "k6"; +import {Gauge} from 'k6/metrics'; +import {setDefaultValuesForEnvParameters} from "./parameters.js"; + +setDefaultValuesForEnvParameters(); + +const SCENARIO_DURATION_METRIC_NAME = 'scenario_duration'; + +const options = { + thresholds: { + checks: [`rate>=${__ENV['DEFAULT_PASS_RATE']}`], // at least 95% should pass the checks, + http_req_duration: [`p(95)<${__ENV['DEFAULT_MAX_DURATION']}`], // 95% requests should receive response in less than 500ms + }, + insecureSkipTLSVerify: true, + noConnectionReuse: true, + noVUConnectionReuse: true, +}; + +const scenario = { + duration: __ENV.DEFAULT_DURATION, + exec: 'run', + executor: 'constant-vus', + gracefulStop: (__ENV.DEFAULT_GRACEFUL_STOP != null && __ENV.DEFAULT_GRACEFUL_STOP) || '15s', + vus: __ENV.DEFAULT_VUS, +}; + +function getMetricNameWithTags(name, ...tags) { + return tags.length === 0 ? name : `${name}{${tags}}`; +} + +const timeRegex = /^[0-9]+s$/; + +function getNextStartTime(startTime, duration, gracefulStop) { + if (!timeRegex.test(startTime)) { + throw new Error(`Invalid startTime ${startTime}`); + } + + if (!timeRegex.test(duration)) { + throw new Error(`Invalid duration ${duration}`); + } + + if (!timeRegex.test(gracefulStop)) { + throw new Error(`Invalid gracefulStop ${gracefulStop}`); + } + + return `${parseInt(startTime) + parseInt(duration) + parseInt(gracefulStop)}s`; +} + +function getOptionsWithScenario(name, tags = {}) { + return Object.assign({}, options, { + scenarios: { + [name]: Object.assign({}, scenario, {tags}), + }, + }); +} + +function getSequentialTestScenarios(tests) { + let startTime = '0s'; + let duration = '0s'; + let gracefulStop = '0s'; + + const funcs = {}; + const scenarios = {}; + const thresholds = {}; + for (const testName of Object.keys(tests).sort()) { + const testModule = tests[testName]; + const testScenarios = testModule.options.scenarios; + const testThresholds = testModule.options.thresholds; + for (const [scenarioName, testScenario] of Object.entries(testScenarios)) { + const scenario = Object.assign({}, testScenario); + funcs[scenarioName] = testModule[scenario.exec]; + scenarios[scenarioName] = scenario; + + // update the scenario's startTime, so scenarios run in sequence + scenario.startTime = getNextStartTime(startTime, duration, gracefulStop); + startTime = scenario.startTime; + duration = scenario.duration; + gracefulStop = scenario.gracefulStop; + + // thresholds + const tag = `scenario:${scenarioName}`; + for (const [name, threshold] of Object.entries(testThresholds)) { + if (name === 'http_req_duration') { + thresholds[getMetricNameWithTags(name, tag, 'expected_response:true')] = threshold; + } else { + thresholds[getMetricNameWithTags(name, tag)] = threshold; + } + } + thresholds[getMetricNameWithTags('http_reqs', tag)] = ['count>0']; + thresholds[getMetricNameWithTags(SCENARIO_DURATION_METRIC_NAME,tag)] = ['value>0']; + } + } + + const testOptions = Object.assign({}, options, {scenarios, thresholds}); + + return {funcs, options: testOptions, scenarioDurationGauge: new Gauge(SCENARIO_DURATION_METRIC_NAME)}; +} + +const checksRegex = /^checks{.*scenario:.*}$/; +const httpReqDurationRegex = /^http_req_duration{.*scenario:.*}$/; +const httpReqsRegex = /^http_reqs{.*scenario:.*}$/; +const scenarioDurationRegex = /^scenario_duration{.*scenario:.*}$/; +const scenarioRegex = /scenario:([^,}]+)/; + +function getScenario(metricKey) { + const match = scenarioRegex.exec(metricKey); + return match[1]; +} + +function markdownReport(data, isFirstColumnUrl, scenarios) { + const firstColumnName = isFirstColumnUrl ? 'URL' : 'Scenario'; + const header = `| ${firstColumnName} | VUS | Pass% | RPS | Avg. Req Duration | Comment | +|----------|-----|-------|-----|-------------------|---------|`; + + // collect the metrics + const {metrics} = data; + const scenarioMetrics = {}; + for (const [key, value] of Object.entries(metrics)) { + let name; + if (checksRegex.test(key)) { + name = 'checks'; + } else if (httpReqDurationRegex.test(key)) { + name = 'http_req_duration'; + } else if (httpReqsRegex.test(key)) { + name = 'http_reqs'; + } else if (scenarioDurationRegex.test(key)) { + name = 'scenario_duration'; + } else { + continue; + } + + const scenario = getScenario(key); + scenarioMetrics[scenario] = Object.assign(scenarioMetrics[scenario] || {}, {[name]: value}); + } + + const scenarioUrls = {}; + if (isFirstColumnUrl) { + for (const [name, scenario] of Object.entries(scenarios)) { + scenarioUrls[name] = scenario.tags.url; + } + } + + // generate the markdown report + let markdown = `${header}\n`; + for (const scenario of Object.keys(scenarioMetrics).sort()) { + const scenarioMetric = scenarioMetrics[scenario]; + const passPercentage = (scenarioMetric['checks'].values.rate * 100.0).toFixed(2); + const httpReqs = scenarioMetric['http_reqs'].values.count; + const duration = scenarioMetric['scenario_duration'].values.value; // in ms + const rps = ((httpReqs * 1.0 / duration) * 1000).toFixed(2); + const httpReqDuration = scenarioMetric['http_req_duration'].values.avg.toFixed(2); + + const firstColumn = isFirstColumnUrl ? scenarioUrls[scenario] : scenario; + markdown += `| ${firstColumn} | ${__ENV.DEFAULT_VUS} | ${passPercentage} | ${rps}/s | ${httpReqDuration}ms | |\n`; + } + + return markdown; +} + +function TestScenarioBuilder () { + this._checks = {}; + this._name = null; + this._request = null; + this._tags = {}; + + this.build = function () { + const that = this; + return { + options: getOptionsWithScenario(that._name, that._tags), + run: function (testParameters) { + const response = that._request(testParameters); + check(response, that._checks); + }, + }; + } + + this.check = function (name, func) { + this._checks[name] = func; + return this; + } + + this.name = function (name) { + this._name = name; + return this; + } + + this.request = function (func) { + this._request = func; + return this; + } + + this.tags = function (tags) { + this._tags = tags; + return this; + } + + return this; +} + +export {getSequentialTestScenarios, markdownReport, TestScenarioBuilder}; diff --git a/hedera-mirror-test/k6/src/lib/constants.js b/hedera-mirror-test/k6/src/lib/constants.js new file mode 100644 index 00000000000..e1406585db5 --- /dev/null +++ b/hedera-mirror-test/k6/src/lib/constants.js @@ -0,0 +1,31 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +export const accountListName = "accounts"; +export const balanceListName = "balances"; +export const contractListName = "contracts"; +export const logListName = "logs"; +export const messageListName = "messages"; +export const nftListName = "nfts"; +export const resultListName = "results"; +export const scheduleListName = "schedules"; +export const tokenListName = "tokens"; +export const transactionListName = "transactions"; +export const urlPrefix = '/api/v1'; diff --git a/hedera-mirror-test/k6/src/lib/parameters.js b/hedera-mirror-test/k6/src/lib/parameters.js new file mode 100644 index 00000000000..7116be0b864 --- /dev/null +++ b/hedera-mirror-test/k6/src/lib/parameters.js @@ -0,0 +1,251 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from 'k6/http'; + +import { + accountListName, + contractListName, messageListName, + nftListName, + scheduleListName, + tokenListName, + transactionListName +} from "./constants.js"; + +const getValidResponse = (requestUrl, requestBody, httpVerbMethod) => { + const response = httpVerbMethod(requestUrl, JSON.stringify(requestBody)); + if (response.status !== 200) { + throw new Error(`${response.status} received when requesting ${requestUrl}`); + } + return JSON.parse(response.body); +} + +const getFirstEntity = (entityPath, key) => { + const body = getValidResponse(entityPath, null, http.get); + const entity = body[key]; + if (entity.length === 0) { + throw new Error(`No ${key} were found in the response for request at ${entityPath}`); + } + return entity[0]; +}; + +const copyEnvParamsFromEnvMap = (propertyList) => { + const envProperties = {}; + let allPropertiesFound = true; + for (const property of propertyList) { + if (__ENV.hasOwnProperty(property)) { + envProperties[property] = __ENV[property]; + } else { + allPropertiesFound = false; + } + } + return { + allPropertiesFound, + envProperties + }; +} + +const computeProperties = (propertyList, fallback) => { + const copyResult = copyEnvParamsFromEnvMap(propertyList); + if (copyResult.allPropertiesFound) { + return copyResult.envProperties; + } + return Object.assign(copyResult.envProperties, fallback()); +} + +export const computeAccountParameters = (configuration) => + computeProperties( + ['DEFAULT_ACCOUNT_ID', 'DEFAULT_ACCOUNT_BALANCE', 'DEFAULT_PUBLIC_KEY'], + () => { + const accountPath = `${configuration.baseApiUrl}/accounts?balance=true&limit=1&order=desc`; + const firstAccount = getFirstEntity(accountPath, accountListName); + return { + DEFAULT_ACCOUNT_ID: firstAccount.account, + DEFAULT_ACCOUNT_BALANCE: firstAccount.balance.balance || 0, + DEFAULT_PUBLIC_KEY: firstAccount.key.key + }; + }); + +export const computeContractParameters = (configuration) => + computeProperties( + ['DEFAULT_CONTRACT_ID', 'DEFAULT_CONTRACT_TIMESTAMP'], + () => { + const contractPath = `${configuration.baseApiUrl}/contracts?limit=1&order=desc`; + const firstContract = getFirstEntity(contractPath, contractListName) + return { + DEFAULT_CONTRACT_ID: firstContract.contract_id, + DEFAULT_CONTRACT_TIMESTAMP: firstContract.created_timestamp + }; + } + ); + +export const computeNftParameters = (configuration) => { + const tokenProperties = computeProperties( + ['DEFAULT_NFT_ID'], + () => { + const tokenPath = `${configuration.baseApiUrl}/tokens?type=NON_FUNGIBLE_UNIQUE&limit=1&order=desc`; + const firstNftFromTokenList = getFirstEntity(tokenPath, tokenListName); + return {DEFAULT_NFT_ID: firstNftFromTokenList.token_id}; + } + ); + + const nftProperties = computeProperties( + ['DEFAULT_NFT_SERIAL'], + () => { + const nftPath = `${configuration.baseApiUrl}/tokens/${tokenProperties.DEFAULT_NFT_ID}/nfts?limit=1&order=desc`; + const firstNft = getFirstEntity(nftPath, nftListName); + return {DEFAULT_NFT_SERIAL: firstNft.serial_number}; + } + ); + + return Object.assign(tokenProperties, nftProperties) +}; + +export const computeScheduleParameters = (configuration) => + computeProperties( + ['DEFAULT_SCHEDULE_ACCOUNT_ID', 'DEFAULT_SCHEDULE_ID'], + () => { + const schedulePath = `${configuration.baseApiUrl}/schedules?limit=1&order=desc`; + const firstSchedule = getFirstEntity(schedulePath, scheduleListName); + return { + DEFAULT_SCHEDULE_ACCOUNT_ID: firstSchedule.creator_account_id, + DEFAULT_SCHEDULE_ID: firstSchedule.schedule_id + }; + } + ); + +export const computeFungibleTokenParameters = (configuration) => + computeProperties( + ['DEFAULT_TOKEN_ID'], + () => { + const tokenPath = `${configuration.baseApiUrl}/tokens?type=FUNGIBLE_COMMON&limit=1&order=desc`; + const firstToken = getFirstEntity(tokenPath, tokenListName); + return { + DEFAULT_TOKEN_ID: firstToken.token_id, + }; + } + ); + +export const computeTransactionParameters = (configuration) => + computeProperties( + ['DEFAULT_TRANSACTION_ID'], + () => { + const tokenPath = `${configuration.baseApiUrl}/transactions?limit=1&transactiontype=cryptotransfer&order=desc`; + const firstTransaction = getFirstEntity(tokenPath, transactionListName) + return { + DEFAULT_TRANSACTION_ID: firstTransaction.transaction_id + }; + } + ); + +export const computeTopicInfo = (configuration) => { + const transactionProperties = computeProperties( + ['DEFAULT_TOPIC_ID'], + () => { + const transactionPath = `${configuration.baseApiUrl}/transactions?transactiontype=CONSENSUSSUBMITMESSAGE&result=success&limit=1&order=desc`; + const DEFAULT_TOPIC_ID = getFirstEntity(transactionPath, transactionListName).entity_id; + return {DEFAULT_TOPIC_ID}; + } + ); + + const topicProperties = computeProperties( + ['DEFAULT_TOPIC_SEQUENCE', 'DEFAULT_TOPIC_TIMESTAMP'], + () => { + const topicMessagePath = `${configuration.baseApiUrl}/topics/${transactionProperties.DEFAULT_TOPIC_ID}/messages`; + const firstTopicMessage = getFirstEntity(topicMessagePath, messageListName); + return { + DEFAULT_TOPIC_SEQUENCE: firstTopicMessage.sequence_number, + DEFAULT_TOPIC_TIMESTAMP: firstTopicMessage.consensus_timestamp + }; + } + ); + + return Object.assign(transactionProperties, topicProperties); +}; + +export const computeBlockFromNetwork = (rosettaApiUrl, network) => + computeProperties( + ['DEFAULT_BLOCK_INDEX', 'DEFAULT_BLOCK_HASH'], + () => { + const requestUrl = `${rosettaApiUrl}/rosetta/network/status`; + const requestBody = { + "network_identifier": { + "blockchain": "Hedera", + "network": network, + "sub_network_identifier": { + "network": "shard 0 realm 0" + } + }, + "metadata": {} + }; + const response = getValidResponse(requestUrl, requestBody, http.post); + return { + DEFAULT_BLOCK_INDEX: parseInt(response.current_block_identifier.index), + DEFAULT_BLOCK_HASH: response.current_block_identifier.hash + }; + } + ); + +export const computeTransactionFromBlock = (rosettaApiUrl, networkIdentifier, blockIdentifier) => + computeProperties( + ['DEFAULT_TRANSACTION_HASH'], + () => { + const requestUrl = `${rosettaApiUrl}/rosetta/block`; + const requestBody = { + network_identifier: networkIdentifier, + block_identifier: blockIdentifier + }; + const response = getValidResponse(requestUrl, requestBody, http.post); + const transactions = response.block.transactions; + if (!transactions || transactions.length === 0) { + throw new Error(`It was not possible to find a transaction with the block identifier: ${JSON.stringify(blockIdentifier)}`); + } + return { + DEFAULT_TRANSACTION_HASH: transactions[0].transaction_identifier.hash + }; + } + ); + + +export const computeNetworkInfo = (rosettaApiUrl) => + computeProperties( + ['DEFAULT_NETWORK'], + () => { + const requestUrl = `${rosettaApiUrl}/rosetta/network/list`; + const response = getValidResponse(requestUrl, {"metadata": {}}, http.post); + const networks = response.network_identifiers; + if (networks.length === 0) { + throw new Error(`It was not possible to find a network at ${rosettaApiUrl}`); + } + return { + DEFAULT_NETWORK: networks[0].network + }; + } + ); + + +export const setDefaultValuesForEnvParameters = () => { + __ENV['BASE_URL'] = __ENV['BASE_URL'] || 'http://localhost'; + __ENV['DEFAULT_DURATION'] = __ENV['DEFAULT_DURATION'] || '120s'; + __ENV['DEFAULT_VUS'] = __ENV['DEFAULT_VUS'] || 10; + __ENV['DEFAULT_LIMIT'] = __ENV['DEFAULT_LIMIT'] || 100; + __ENV['DEFAULT_PASS_RATE'] = __ENV['DEFAULT_PASS_RATE'] || 0.95; + __ENV['DEFAULT_MAX_DURATION'] = __ENV['DEFAULT_MAX_DURATION'] || 500; +} diff --git a/hedera-mirror-test/k6/src/rest/apis.js b/hedera-mirror-test/k6/src/rest/apis.js new file mode 100644 index 00000000000..982882dc996 --- /dev/null +++ b/hedera-mirror-test/k6/src/rest/apis.js @@ -0,0 +1,43 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import exec from 'k6/execution'; +import {textSummary} from 'https://jslib.k6.io/k6-summary/0.0.1/index.js'; + +import {markdownReport} from '../lib/common.js'; +import {funcs, options, scenarioDurationGauge} from './test/index.js'; +import {setupTestParameters} from "./test/bootstrapEnvParameters.js"; + +function handleSummary(data) { + return { + 'stdout': textSummary(data, {indent: ' ', enableColors: true}), + 'report.md': markdownReport(data, true, options.scenarios) + }; +} + +function run(testParameters) { + const scenario = exec.scenario; + funcs[scenario.name](testParameters); + scenarioDurationGauge.add(Date.now() - scenario.startTime, {scenario: scenario.name}); +} + +export {handleSummary, options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rest/test/accounts.js b/hedera-mirror-test/k6/src/rest/test/accounts.js new file mode 100644 index 00000000000..ce66c8c0682 --- /dev/null +++ b/hedera-mirror-test/k6/src/rest/test/accounts.js @@ -0,0 +1,42 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {accountListName, urlPrefix} from '../../lib/constants.js'; +import {isValidListResponse} from "./common.js"; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/accounts'; + +const {options, run} = new TestScenarioBuilder() + .name('accounts') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = `${testParameters['BASE_URL']}${urlPrefix}${urlTag}?limit=${testParameters['DEFAULT_LIMIT']}`; + return http.get(url); + }) + .check('Accounts OK', (r) => isValidListResponse(r, accountListName)) + .build(); + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rest/test/accountsBalanceFalse.js b/hedera-mirror-test/k6/src/rest/test/accountsBalanceFalse.js new file mode 100644 index 00000000000..bf32e25ad59 --- /dev/null +++ b/hedera-mirror-test/k6/src/rest/test/accountsBalanceFalse.js @@ -0,0 +1,39 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {accountListName, urlPrefix} from '../../lib/constants.js'; +import {isValidListResponse} from "./common.js"; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/accounts?balance=false'; + +const {options, run} = new TestScenarioBuilder() + .name('accountsBalanceFalse') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => http.get(`${testParameters['BASE_URL']}${urlPrefix}${urlTag}`)) + .check('Accounts balance false OK', (r) => isValidListResponse(r, accountListName)) + .build(); + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rest/test/accountsBalanceFalsePubkey.js b/hedera-mirror-test/k6/src/rest/test/accountsBalanceFalsePubkey.js new file mode 100644 index 00000000000..e4ed708bfaf --- /dev/null +++ b/hedera-mirror-test/k6/src/rest/test/accountsBalanceFalsePubkey.js @@ -0,0 +1,42 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {accountListName, urlPrefix} from '../../lib/constants.js'; +import {isValidListResponse} from "./common.js"; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/accounts?balance=false&account.publickey={publicKey}'; + +const {options, run} = new TestScenarioBuilder() + .name('accountsBalanceFalsePubkey') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = `${testParameters['BASE_URL']}${urlPrefix}/accounts?balance=false&account.publickey=${testParameters['DEFAULT_PUBLIC_KEY']}`; + return http.get(url); + }) + .check('Accounts balance false with publickey OK', (r) => isValidListResponse(r, accountListName)) + .build(); + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rest/test/accountsBalanceGt0.js b/hedera-mirror-test/k6/src/rest/test/accountsBalanceGt0.js new file mode 100644 index 00000000000..0c18f51b03b --- /dev/null +++ b/hedera-mirror-test/k6/src/rest/test/accountsBalanceGt0.js @@ -0,0 +1,42 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {accountListName, urlPrefix} from '../../lib/constants.js'; +import {isValidListResponse} from "./common.js"; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/accounts?account.balance=gt:0'; + +const {options, run} = new TestScenarioBuilder() + .name('accountsBalanceGt0') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = `${testParameters['BASE_URL']}${urlPrefix}${urlTag}`; + return http.get(url); + }) + .check('Accounts balance gt:0 OK', (r) => isValidListResponse(r, accountListName)) + .build(); + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rest/test/accountsBalanceGt0Pubkey.js b/hedera-mirror-test/k6/src/rest/test/accountsBalanceGt0Pubkey.js new file mode 100644 index 00000000000..959ef8da43b --- /dev/null +++ b/hedera-mirror-test/k6/src/rest/test/accountsBalanceGt0Pubkey.js @@ -0,0 +1,42 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {accountListName, urlPrefix} from '../../lib/constants.js'; +import {isValidListResponse} from "./common.js"; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/accounts?account.balance=gt:0&account.publickey={publicKey}'; + +const {options, run} = new TestScenarioBuilder() + .name('accountsBalanceGt0Pubkey') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = `${testParameters['BASE_URL']}${urlPrefix}/accounts?account.balance=gt:0&account.publickey=${testParameters['DEFAULT_PUBLIC_KEY']}`; + return http.get(url); + }) + .check('Accounts balance gt:0 with publickey OK', (r) => isValidListResponse(r, accountListName)) + .build(); + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rest/test/accountsBalanceNe.js b/hedera-mirror-test/k6/src/rest/test/accountsBalanceNe.js new file mode 100644 index 00000000000..5e6870e5d2b --- /dev/null +++ b/hedera-mirror-test/k6/src/rest/test/accountsBalanceNe.js @@ -0,0 +1,42 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {accountListName, urlPrefix} from '../../lib/constants.js'; +import {isValidListResponse} from "./common.js"; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/accounts?account.balance=ne:{balance}&order=desc'; + +const {options, run} = new TestScenarioBuilder() + .name('accountsBalanceNe') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = `${testParameters['BASE_URL']}${urlPrefix}/accounts?account.balance=ne:${testParameters['DEFAULT_ACCOUNT_BALANCE']}&order=desc`; + return http.get(url); + }) + .check('Accounts balance NE OK', (r) => isValidListResponse(r, accountListName)) + .build(); + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rest/test/accountsId.js b/hedera-mirror-test/k6/src/rest/test/accountsId.js new file mode 100644 index 00000000000..5cf89936802 --- /dev/null +++ b/hedera-mirror-test/k6/src/rest/test/accountsId.js @@ -0,0 +1,43 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {urlPrefix} from '../../lib/constants.js'; +import {isSuccess} from "./common.js"; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/accounts/{accountId}'; + +const {options, run} = new TestScenarioBuilder() + .name('accountsId') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = `${testParameters['BASE_URL']}${urlPrefix}/accounts/${testParameters['DEFAULT_ACCOUNT_ID']}`; + return http.get(url); + }) + .check('Accounts Id OK', isSuccess) + .build(); + + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rest/test/accountsIdNe.js b/hedera-mirror-test/k6/src/rest/test/accountsIdNe.js new file mode 100644 index 00000000000..fad0514caed --- /dev/null +++ b/hedera-mirror-test/k6/src/rest/test/accountsIdNe.js @@ -0,0 +1,42 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {accountListName, urlPrefix} from '../../lib/constants.js'; +import {isValidListResponse} from "./common.js"; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/accounts?account.id=ne:{accountId}&order=desc'; + +const {options, run} = new TestScenarioBuilder() + .name('accountsIdNe') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = `${testParameters['BASE_URL']}${urlPrefix}/accounts?account.id=ne:${testParameters['DEFAULT_ACCOUNT_ID']}&order=desc`; + return http.get(url); + }) + .check('Accounts ne: accountId order desc OK', (r) => isValidListResponse(r, accountListName)) + .build(); + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rest/test/balances.js b/hedera-mirror-test/k6/src/rest/test/balances.js new file mode 100644 index 00000000000..01bcecbf3de --- /dev/null +++ b/hedera-mirror-test/k6/src/rest/test/balances.js @@ -0,0 +1,42 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {balanceListName, urlPrefix} from '../../lib/constants.js'; +import {isValidListResponse} from "./common.js"; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/balances'; + +const {options, run} = new TestScenarioBuilder() + .name('balances') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = `${testParameters['BASE_URL']}${urlPrefix}${urlTag}?limit=${testParameters['DEFAULT_LIMIT']}`; + return http.get(url); + }) + .check('Balances OK', (r) => isValidListResponse(r, balanceListName)) + .build(); + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rest/test/balancesAccount.js b/hedera-mirror-test/k6/src/rest/test/balancesAccount.js new file mode 100644 index 00000000000..f01e9c949a5 --- /dev/null +++ b/hedera-mirror-test/k6/src/rest/test/balancesAccount.js @@ -0,0 +1,41 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {urlPrefix} from '../../lib/constants.js'; +import {isValidListResponse} from "./common.js"; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/balances'; +const {options, run} = new TestScenarioBuilder() + .name('balances_account') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = `${testParameters['BASE_URL']}${urlPrefix}${urlTag}?account.id=eq:${testParameters['DEFAULT_ACCOUNT_ID']}`; + return http.get(url); + }) + .check('Balances for specific account OK', (r) => isValidListResponse(r, "balances")) + .build(); + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rest/test/bootstrapEnvParameters.js b/hedera-mirror-test/k6/src/rest/test/bootstrapEnvParameters.js new file mode 100644 index 00000000000..fdebc93d074 --- /dev/null +++ b/hedera-mirror-test/k6/src/rest/test/bootstrapEnvParameters.js @@ -0,0 +1,52 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import { + computeAccountParameters, + computeContractParameters, + computeFungibleTokenParameters, + computeNftParameters, + computeScheduleParameters, computeTopicInfo, + computeTransactionParameters, + setDefaultValuesForEnvParameters, +} from "../../lib/parameters.js"; + +const computeTestParameters = (configuration) => + Object.assign({}, + computeAccountParameters(configuration), + computeContractParameters(configuration), + computeNftParameters(configuration), + computeScheduleParameters(configuration), + computeFungibleTokenParameters(configuration), + computeTransactionParameters(configuration), + computeTopicInfo(configuration) + ); + +const setupTestParameters = () => { + setDefaultValuesForEnvParameters(); + const baseApiUrl = __ENV['BASE_URL']; + const testParametersMap = computeTestParameters({baseApiUrl: `${baseApiUrl}/api/v1`}); + return Object.assign(testParametersMap, { + BASE_URL: baseApiUrl, + DEFAULT_LIMIT: __ENV.DEFAULT_LIMIT + }); +}; + +export {setupTestParameters}; diff --git a/hedera-mirror-test/k6/src/rest/test/common.js b/hedera-mirror-test/k6/src/rest/test/common.js new file mode 100644 index 00000000000..e75b621dc60 --- /dev/null +++ b/hedera-mirror-test/k6/src/rest/test/common.js @@ -0,0 +1,37 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +const isSuccess = (response) => response.status >= 200 && response.status < 300; + +const isValidListResponse = (response, listName) => { + if (!isSuccess(response)) { + return false; + } + + const body = JSON.parse(response.body); + const list = body[listName]; + if (!Array.isArray(list)) { + return false; + } + + return list.length > 0; +} + +export {isValidListResponse, isSuccess}; diff --git a/hedera-mirror-test/k6/src/rest/test/contracts.js b/hedera-mirror-test/k6/src/rest/test/contracts.js new file mode 100644 index 00000000000..2fd1278a010 --- /dev/null +++ b/hedera-mirror-test/k6/src/rest/test/contracts.js @@ -0,0 +1,42 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {contractListName, urlPrefix} from '../../lib/constants.js'; +import {isValidListResponse} from "./common.js"; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/contracts'; + +const {options, run} = new TestScenarioBuilder() + .name('contracts') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = `${testParameters['BASE_URL']}${urlPrefix}${urlTag}?limit=${testParameters['DEFAULT_LIMIT']}`; + return http.get(url); + }) + .check('Contracts OK', (r) => isValidListResponse(r, contractListName)) + .build(); + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rest/test/contractsId.js b/hedera-mirror-test/k6/src/rest/test/contractsId.js new file mode 100644 index 00000000000..82a8ccd2040 --- /dev/null +++ b/hedera-mirror-test/k6/src/rest/test/contractsId.js @@ -0,0 +1,42 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {urlPrefix} from '../../lib/constants.js'; +import {isSuccess} from "./common.js"; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/contracts/{id}'; + +const {options, run} = new TestScenarioBuilder() + .name('contractsId') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = `${testParameters['BASE_URL']}${urlPrefix}/contracts/${testParameters['DEFAULT_CONTRACT_ID']}`; + return http.get(url); + }) + .check('Contracts Id OK', isSuccess) + .build(); + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rest/test/contractsIdResults.js b/hedera-mirror-test/k6/src/rest/test/contractsIdResults.js new file mode 100644 index 00000000000..04ad10f4603 --- /dev/null +++ b/hedera-mirror-test/k6/src/rest/test/contractsIdResults.js @@ -0,0 +1,42 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {resultListName, urlPrefix} from '../../lib/constants.js'; +import {isValidListResponse} from "./common.js"; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/contracts/{id}/results'; + +const {options, run} = new TestScenarioBuilder() + .name('contractsIdResults') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = `${testParameters['BASE_URL']}${urlPrefix}/contracts/${testParameters['DEFAULT_CONTRACT_ID']}/results`; + return http.get(url); + }) + .check('Contracts id results OK', (r) => isValidListResponse(r, resultListName)) + .build(); + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rest/test/contractsIdResultsLogs.js b/hedera-mirror-test/k6/src/rest/test/contractsIdResultsLogs.js new file mode 100644 index 00000000000..3b4a6a5c860 --- /dev/null +++ b/hedera-mirror-test/k6/src/rest/test/contractsIdResultsLogs.js @@ -0,0 +1,42 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {logListName, urlPrefix} from '../../lib/constants.js'; +import {isValidListResponse} from "./common.js"; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/contracts/{id}/results/logs'; + +const {options, run} = new TestScenarioBuilder() + .name('contractsIdResultsLogs') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = `${testParameters['BASE_URL']}${urlPrefix}/contracts/${testParameters['DEFAULT_CONTRACT_ID']}/results/logs`; + return http.get(url); + }) + .check('Contracts id results logs OK', (r) => isValidListResponse(r, logListName)) + .build(); + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rest/test/contractsIdResultsTimestamp.js b/hedera-mirror-test/k6/src/rest/test/contractsIdResultsTimestamp.js new file mode 100644 index 00000000000..53a0e454781 --- /dev/null +++ b/hedera-mirror-test/k6/src/rest/test/contractsIdResultsTimestamp.js @@ -0,0 +1,42 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {urlPrefix} from '../../lib/constants.js'; +import {isSuccess} from "./common.js"; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/contracts/{id}/results/{timestamp}'; + +const {options, run} = new TestScenarioBuilder() + .name('contractsIdResultsTimestamp') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = `${testParameters['BASE_URL']}${urlPrefix}/contracts/${testParameters['DEFAULT_CONTRACT_ID']}/results/${testParameters['DEFAULT_CONTRACT_TIMESTAMP']}`; + return http.get(url); + }) + .check('Contracts id results timestamp OK', isSuccess) + .build(); + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rest/test/index.js b/hedera-mirror-test/k6/src/rest/test/index.js new file mode 100644 index 00000000000..2afbe9b9eaf --- /dev/null +++ b/hedera-mirror-test/k6/src/rest/test/index.js @@ -0,0 +1,101 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import {getSequentialTestScenarios} from '../../lib/common.js'; + +// import test modules +import * as accounts from './accounts.js'; +import * as accountsBalanceFalse from './accountsBalanceFalse.js'; +import * as accountsBalanceFalsePubkey from './accountsBalanceFalsePubkey.js'; +import * as accountsBalanceGt0 from './accountsBalanceGt0.js'; +import * as accountsBalanceGt0Pubkey from './accountsBalanceGt0Pubkey.js'; +import * as accountsBalanceNe from './accountsBalanceNe.js'; +import * as accountsId from './accountsId.js'; +import * as accountsIdNe from './accountsIdNe.js'; +import * as balances from './balances.js'; +import * as balancesAccount from './balancesAccount.js'; +import * as contracts from './contracts.js'; +import * as contractsId from './contractsId.js'; +import * as contractsIdResults from './contractsIdResults.js'; +import * as contractsIdResultsLogs from './contractsIdResultsLogs.js'; +import * as contractsIdResultsTimestamp from './contractsIdResultsTimestamp.js'; +import * as networkSupply from './networkSupply.js'; +import * as schedules from './schedules.js'; +import * as schedulesAccount from './schedulesAccount.js'; +import * as schedulesId from './schedulesId.js'; +import * as tokens from './tokens.js'; +import * as tokensFungibleCommon from './tokensFungibleCommon.js'; +import * as tokensId from './tokensId.js'; +import * as tokensIdBalances from './tokensIdBalances.js'; +import * as tokensNfts from './tokensNfts.js'; +import * as tokensNftsSerial from './tokensNftsSerial.js'; +import * as tokensNftsSerialTransactions from './tokensNftsSerialTransactions.js'; +import * as tokensNonFungibleUnique from './tokensNonFungibleUnique.js'; +import * as tokensTokenIdNe from './tokensTokenIdNe.js'; +import * as topicsIdMessages from './topicsIdMessages.js'; +import * as topicsIdMessagesSequence from './topicsIdMessagesSequence.js'; +import * as topicsIdMessagesSequenceQueryParam from './topicsIdMessagesSequenceQueryParam.js'; +import * as topicsMessagesTimestamp from './topicsMessagesTimestamp.js'; +import * as transactions from './transactions.js'; +import * as transactionsAccountId from './transactionsAccountId.js'; +import * as transactionsId from './transactionsId.js'; + +// add test modules here +const tests = { + accounts, + accountsBalanceFalse, + accountsBalanceFalsePubkey, + accountsBalanceGt0, + accountsBalanceGt0Pubkey, + accountsBalanceNe, + accountsId, + accountsIdNe, + balances, + balancesAccount, + contracts, + contractsId, + contractsIdResults, + contractsIdResultsLogs, + contractsIdResultsTimestamp, + networkSupply, + schedules, + schedulesAccount, + schedulesId, + tokens, + tokensFungibleCommon, + tokensId, + tokensIdBalances, + tokensNfts, + tokensNftsSerial, + tokensNftsSerialTransactions, + tokensNonFungibleUnique, + tokensTokenIdNe, + topicsIdMessages, + topicsIdMessagesSequence, + topicsIdMessagesSequenceQueryParam, + topicsMessagesTimestamp, + transactions, + transactionsAccountId, + transactionsId, +}; + +const {funcs, options, scenarioDurationGauge} = getSequentialTestScenarios(tests); + +export {funcs, options, scenarioDurationGauge}; diff --git a/hedera-mirror-test/k6/src/rest/test/networkSupply.js b/hedera-mirror-test/k6/src/rest/test/networkSupply.js new file mode 100644 index 00000000000..36d63127cb1 --- /dev/null +++ b/hedera-mirror-test/k6/src/rest/test/networkSupply.js @@ -0,0 +1,42 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {urlPrefix} from '../../lib/constants.js'; +import {isSuccess} from "./common.js"; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/network/supply'; + +const {options, run} = new TestScenarioBuilder() + .name('networkSupply') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = `${testParameters['BASE_URL']}${urlPrefix}${urlTag}`; + return http.get(url); + }) + .check('Network supply OK', isSuccess) + .build(); + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rest/test/schedules.js b/hedera-mirror-test/k6/src/rest/test/schedules.js new file mode 100644 index 00000000000..1af0d7a9894 --- /dev/null +++ b/hedera-mirror-test/k6/src/rest/test/schedules.js @@ -0,0 +1,42 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {scheduleListName, urlPrefix} from '../../lib/constants.js'; +import {isValidListResponse} from "./common.js"; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/schedules'; + +const {options, run} = new TestScenarioBuilder() + .name('schedules') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = `${testParameters['BASE_URL']}${urlPrefix}${urlTag}?limit=${testParameters['DEFAULT_LIMIT']}`; + return http.get(url); + }) + .check('Schedules OK', (r) => isValidListResponse(r, scheduleListName)) + .build(); + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rest/test/schedulesAccount.js b/hedera-mirror-test/k6/src/rest/test/schedulesAccount.js new file mode 100644 index 00000000000..c266985fc06 --- /dev/null +++ b/hedera-mirror-test/k6/src/rest/test/schedulesAccount.js @@ -0,0 +1,42 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {scheduleListName, urlPrefix} from '../../lib/constants.js'; +import {isValidListResponse} from "./common.js"; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/schedules?account.id=gte:{accountId}'; + +const {options, run} = new TestScenarioBuilder() + .name('schedulesAccount') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = `${testParameters['BASE_URL']}${urlPrefix}/schedules?account.id=gte:${testParameters['DEFAULT_SCHEDULE_ACCOUNT_ID']}`; + return http.get(url); + }) + .check('Schedules account OK', (r) => isValidListResponse(r, scheduleListName)) + .build(); + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rest/test/schedulesId.js b/hedera-mirror-test/k6/src/rest/test/schedulesId.js new file mode 100644 index 00000000000..41c56f16a34 --- /dev/null +++ b/hedera-mirror-test/k6/src/rest/test/schedulesId.js @@ -0,0 +1,42 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {urlPrefix} from '../../lib/constants.js'; +import {isSuccess} from "./common.js"; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/schedules/{id}'; + +const {options, run} = new TestScenarioBuilder() + .name('schedulesId') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = `${testParameters['BASE_URL']}${urlPrefix}/schedules/${testParameters['DEFAULT_SCHEDULE_ID']}`; + return http.get(url); + }) + .check('Schedules id OK', isSuccess) + .build(); + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rest/test/tokens.js b/hedera-mirror-test/k6/src/rest/test/tokens.js new file mode 100644 index 00000000000..21b202170b9 --- /dev/null +++ b/hedera-mirror-test/k6/src/rest/test/tokens.js @@ -0,0 +1,42 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {tokenListName, urlPrefix} from '../../lib/constants.js'; +import {isValidListResponse} from "./common.js"; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/tokens'; + +const {options, run} = new TestScenarioBuilder() + .name('tokens') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = `${testParameters['BASE_URL']}${urlPrefix}${urlTag}?limit=${testParameters['DEFAULT_LIMIT']}`; + return http.get(url); + }) + .check('Tokens OK', (r) => isValidListResponse(r, tokenListName)) + .build(); + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rest/test/tokensFungibleCommon.js b/hedera-mirror-test/k6/src/rest/test/tokensFungibleCommon.js new file mode 100644 index 00000000000..684ffcbeee9 --- /dev/null +++ b/hedera-mirror-test/k6/src/rest/test/tokensFungibleCommon.js @@ -0,0 +1,42 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {tokenListName, urlPrefix} from '../../lib/constants.js'; +import {isValidListResponse} from "./common.js"; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/tokens?type=FUNGIBLE_COMMON'; + +const {options, run} = new TestScenarioBuilder() + .name('tokensFungibleCommon') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = `${testParameters['BASE_URL']}${urlPrefix}${urlTag}`; + return http.get(url); + }) + .check('Tokens FUNGIBLE_COMMON OK', (r) => isValidListResponse(r, tokenListName)) + .build(); + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rest/test/tokensId.js b/hedera-mirror-test/k6/src/rest/test/tokensId.js new file mode 100644 index 00000000000..b3c4a39516f --- /dev/null +++ b/hedera-mirror-test/k6/src/rest/test/tokensId.js @@ -0,0 +1,42 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {urlPrefix} from '../../lib/constants.js'; +import {isSuccess} from "./common.js"; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/tokens/{id}'; + +const {options, run} = new TestScenarioBuilder() + .name('tokensId') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = `${testParameters['BASE_URL']}${urlPrefix}/tokens/${testParameters['DEFAULT_TOKEN_ID']}`; + return http.get(url); + }) + .check('Tokens id OK', isSuccess) + .build(); + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rest/test/tokensIdBalances.js b/hedera-mirror-test/k6/src/rest/test/tokensIdBalances.js new file mode 100644 index 00000000000..e8c2ef60f38 --- /dev/null +++ b/hedera-mirror-test/k6/src/rest/test/tokensIdBalances.js @@ -0,0 +1,42 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {balanceListName, urlPrefix} from '../../lib/constants.js'; +import {isValidListResponse} from "./common.js"; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/tokens/{id}/balances'; + +const {options, run} = new TestScenarioBuilder() + .name('tokensIdBalances') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = `${testParameters['BASE_URL']}${urlPrefix}/tokens/${testParameters['DEFAULT_TOKEN_ID']}/balances`; + return http.get(url); + }) + .check('Tokens id balances OK', (r) => isValidListResponse(r, balanceListName)) + .build(); + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rest/test/tokensNfts.js b/hedera-mirror-test/k6/src/rest/test/tokensNfts.js new file mode 100644 index 00000000000..aeeb7f3ef34 --- /dev/null +++ b/hedera-mirror-test/k6/src/rest/test/tokensNfts.js @@ -0,0 +1,42 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {nftListName, urlPrefix} from '../../lib/constants.js'; +import {isValidListResponse} from "./common.js"; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/tokens/{id}/nfts'; + +const {options, run} = new TestScenarioBuilder() + .name('tokensNfts') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = `${testParameters['BASE_URL']}${urlPrefix}/tokens/${testParameters['DEFAULT_NFT_ID']}/nfts`; + return http.get(url); + }) + .check('Tokens nfts OK', (r) => isValidListResponse(r, nftListName)) + .build(); + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rest/test/tokensNftsSerial.js b/hedera-mirror-test/k6/src/rest/test/tokensNftsSerial.js new file mode 100644 index 00000000000..d1860dc162b --- /dev/null +++ b/hedera-mirror-test/k6/src/rest/test/tokensNftsSerial.js @@ -0,0 +1,42 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {urlPrefix} from '../../lib/constants.js'; +import {isSuccess} from "./common.js"; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/tokens/{id}/nfts/{serial}'; + +const {options, run} = new TestScenarioBuilder() + .name('tokensNftsSerial') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = `${testParameters['BASE_URL']}${urlPrefix}/tokens/${testParameters['DEFAULT_NFT_ID']}/nfts/${testParameters['DEFAULT_NFT_SERIAL']}`; + return http.get(url); + }) + .check('Tokens nfts serial OK', isSuccess) + .build(); + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rest/test/tokensNftsSerialTransactions.js b/hedera-mirror-test/k6/src/rest/test/tokensNftsSerialTransactions.js new file mode 100644 index 00000000000..e6bc72d18e3 --- /dev/null +++ b/hedera-mirror-test/k6/src/rest/test/tokensNftsSerialTransactions.js @@ -0,0 +1,42 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {transactionListName, urlPrefix} from '../../lib/constants.js'; +import {isValidListResponse} from "./common.js"; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/tokens/{id}/nfts/{serial}/transactions'; + +const {options, run} = new TestScenarioBuilder() + .name('tokensNftsSerialTransactions') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = `${testParameters['BASE_URL']}${urlPrefix}/tokens/${testParameters['DEFAULT_NFT_ID']}/nfts/${testParameters['DEFAULT_NFT_SERIAL']}/transactions`; + return http.get(url); + }) + .check('Tokens nfts serial transactions OK', (r) => isValidListResponse(r, transactionListName)) + .build(); + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rest/test/tokensNonFungibleUnique.js b/hedera-mirror-test/k6/src/rest/test/tokensNonFungibleUnique.js new file mode 100644 index 00000000000..79790400a5d --- /dev/null +++ b/hedera-mirror-test/k6/src/rest/test/tokensNonFungibleUnique.js @@ -0,0 +1,42 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {tokenListName, urlPrefix} from '../../lib/constants.js'; +import {isValidListResponse} from "./common.js"; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/tokens?type=NON_FUNGIBLE_UNIQUE'; + +const {options, run} = new TestScenarioBuilder() + .name('tokensNonFungibleUnique') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = `${testParameters['BASE_URL']}${urlPrefix}${urlTag}`; + return http.get(url); + }) + .check('Tokens NON_FUNGIBLE_UNIQUE OK', (r) => isValidListResponse(r, tokenListName)) + .build(); + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rest/test/tokensTokenIdNe.js b/hedera-mirror-test/k6/src/rest/test/tokensTokenIdNe.js new file mode 100644 index 00000000000..8940df53687 --- /dev/null +++ b/hedera-mirror-test/k6/src/rest/test/tokensTokenIdNe.js @@ -0,0 +1,42 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {tokenListName, urlPrefix} from '../../lib/constants.js'; +import {isValidListResponse} from "./common.js"; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/tokens?token.id=ne:100000'; + +const {options, run} = new TestScenarioBuilder() + .name('tokensTokenIdNe') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = `${testParameters['BASE_URL']}${urlPrefix}${urlTag}`; + return http.get(url); + }) + .check('Tokens token id ne 100000 OK', (r) => isValidListResponse(r, tokenListName)) + .build(); + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rest/test/topicsIdMessages.js b/hedera-mirror-test/k6/src/rest/test/topicsIdMessages.js new file mode 100644 index 00000000000..e968337a773 --- /dev/null +++ b/hedera-mirror-test/k6/src/rest/test/topicsIdMessages.js @@ -0,0 +1,42 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {messageListName, urlPrefix} from '../../lib/constants.js'; +import {isValidListResponse} from "./common.js"; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/topics/{id}/messages'; + +const {options, run} = new TestScenarioBuilder() + .name('topicsIdMessages') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = `${testParameters['BASE_URL']}${urlPrefix}/topics/${testParameters['DEFAULT_TOPIC_ID']}/messages?limit=${testParameters['DEFAULT_LIMIT']}`; + return http.get(url); + }) + .check('Topics id messages OK', (r) => isValidListResponse(r, messageListName)) + .build(); + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rest/test/topicsIdMessagesSequence.js b/hedera-mirror-test/k6/src/rest/test/topicsIdMessagesSequence.js new file mode 100644 index 00000000000..04e63075957 --- /dev/null +++ b/hedera-mirror-test/k6/src/rest/test/topicsIdMessagesSequence.js @@ -0,0 +1,43 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {messageListName, urlPrefix} from '../../lib/constants.js'; +import {isValidListResponse} from "./common.js"; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/topics/{id}/messages/{sequenceNumber}'; + +const {options, run} = new TestScenarioBuilder() + .name('topicsIdMessagesSequence') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = `${testParameters['BASE_URL']}${urlPrefix}/topics/${testParameters['DEFAULT_TOPIC_ID']}/messages/${testParameters['DEFAULT_TOPIC_SEQUENCE']}`; + return http.get(url); + }) + .check('Topics id messages sequenceNumber OK', (r) => isValidListResponse(r, messageListName)) + .build(); + + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rest/test/topicsIdMessagesSequenceQueryParam.js b/hedera-mirror-test/k6/src/rest/test/topicsIdMessagesSequenceQueryParam.js new file mode 100644 index 00000000000..c2bb119517e --- /dev/null +++ b/hedera-mirror-test/k6/src/rest/test/topicsIdMessagesSequenceQueryParam.js @@ -0,0 +1,42 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {messageListName, urlPrefix} from '../../lib/constants.js'; +import {isValidListResponse} from "./common.js"; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/topics/{id}/messages?sequencenumber={sequenceNumber}'; + +const {options, run} = new TestScenarioBuilder() + .name('topicsIdMessagesSequenceQueryParam') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = `${testParameters['BASE_URL']}${urlPrefix}/topics/${testParameters['DEFAULT_TOPIC_ID']}/messages?sequencenumber=${testParameters['DEFAULT_TOPIC_SEQUENCE']}`; + return http.get(url); + }) + .check('Topics id messages sequenceNumber query param OK', (r) => isValidListResponse(r, messageListName)) + .build(); + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rest/test/topicsMessagesTimestamp.js b/hedera-mirror-test/k6/src/rest/test/topicsMessagesTimestamp.js new file mode 100644 index 00000000000..b197d8a97e7 --- /dev/null +++ b/hedera-mirror-test/k6/src/rest/test/topicsMessagesTimestamp.js @@ -0,0 +1,42 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {urlPrefix} from '../../lib/constants.js'; +import {isSuccess} from "./common.js"; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/topics/messages/{timestamp}'; + +const {options, run} = new TestScenarioBuilder() + .name('topicsMessageTimestamp') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = `${testParameters['BASE_URL']}${urlPrefix}/topics/messages/${testParameters['DEFAULT_TOPIC_TIMESTAMP']}`; + return http.get(url); + }) + .check('Topics messages timestamp OK', isSuccess) + .build(); + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rest/test/transactions.js b/hedera-mirror-test/k6/src/rest/test/transactions.js new file mode 100644 index 00000000000..7a294a1b4d4 --- /dev/null +++ b/hedera-mirror-test/k6/src/rest/test/transactions.js @@ -0,0 +1,42 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {transactionListName, urlPrefix} from '../../lib/constants.js'; +import {isValidListResponse} from "./common.js"; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/transactions'; + +const {options, run} = new TestScenarioBuilder() + .name('transactions') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = `${testParameters['BASE_URL']}${urlPrefix}${urlTag}?limit=${testParameters['DEFAULT_LIMIT']}`; + return http.get(url); + }) + .check('Transactions OK', (r) => isValidListResponse(r, transactionListName)) + .build(); + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rest/test/transactionsAccountId.js b/hedera-mirror-test/k6/src/rest/test/transactionsAccountId.js new file mode 100644 index 00000000000..64ced0f372b --- /dev/null +++ b/hedera-mirror-test/k6/src/rest/test/transactionsAccountId.js @@ -0,0 +1,42 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {transactionListName, urlPrefix} from '../../lib/constants.js'; +import {isValidListResponse} from "./common.js"; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/transactions?account.id={accountId}'; + +const {options, run} = new TestScenarioBuilder() + .name('transactionsAccountId') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = `${testParameters['BASE_URL']}${urlPrefix}/transactions?account.id=${testParameters['DEFAULT_ACCOUNT_ID']}&limit=${testParameters['DEFAULT_LIMIT']}`; + return http.get(url); + }) + .check('Transactions by account id OK', (r) => isValidListResponse(r, transactionListName)) + .build(); + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rest/test/transactionsId.js b/hedera-mirror-test/k6/src/rest/test/transactionsId.js new file mode 100644 index 00000000000..68c3392fb5c --- /dev/null +++ b/hedera-mirror-test/k6/src/rest/test/transactionsId.js @@ -0,0 +1,42 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {urlPrefix} from '../../lib/constants.js'; +import {isSuccess} from "./common.js"; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/transactions/{id}'; + +const {options, run} = new TestScenarioBuilder() + .name('transactionsId') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = `${testParameters['BASE_URL']}${urlPrefix}/transactions/${testParameters['DEFAULT_TRANSACTION_ID']}`; + return http.get(url); + }) + .check('Transactions id OK', isSuccess) + .build(); + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rosetta/apis.js b/hedera-mirror-test/k6/src/rosetta/apis.js new file mode 100644 index 00000000000..e79f453427c --- /dev/null +++ b/hedera-mirror-test/k6/src/rosetta/apis.js @@ -0,0 +1,43 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import exec from 'k6/execution'; +import {textSummary} from 'https://jslib.k6.io/k6-summary/0.0.1/index.js'; + +import {markdownReport} from "../lib/common.js"; +import {funcs, options, scenarioDurationGauge} from './test/index.js'; +import {setupTestParameters} from "./test/bootstrapEnvParameters.js"; + +function handleSummary(data) { + return { + 'stdout': textSummary(data, {indent: ' ', enableColors: true}), + 'report.md': markdownReport(data, true, options.scenarios), + }; +} + +function run(testParameters) { + const scenario = exec.scenario; + funcs[scenario.name](testParameters); + scenarioDurationGauge.add(Date.now() - scenario.startTime, {scenario: scenario.name}); +} + +export {handleSummary, options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rosetta/test/accountBalance.js b/hedera-mirror-test/k6/src/rosetta/test/accountBalance.js new file mode 100644 index 00000000000..b9aaf2566d5 --- /dev/null +++ b/hedera-mirror-test/k6/src/rosetta/test/accountBalance.js @@ -0,0 +1,45 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/rosetta/account/balance'; + +const {options, run} = new TestScenarioBuilder() + .name('accountBalance') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = testParameters.baseUrl + urlTag; + const payload = JSON.stringify({ + account_identifier: testParameters.accountIdentifier, + block_identifier: testParameters.blockIdentifier, + network_identifier: testParameters.networkIdentifier, + }); + return http.post(url, payload); + }) + .check('AccountBalance OK', (r) => r.status === 200) + .build(); + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rosetta/test/block.js b/hedera-mirror-test/k6/src/rosetta/test/block.js new file mode 100644 index 00000000000..b5e57a656fd --- /dev/null +++ b/hedera-mirror-test/k6/src/rosetta/test/block.js @@ -0,0 +1,44 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/rosetta/block'; + +const {options, run} = new TestScenarioBuilder() + .name('block') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = testParameters.baseUrl + urlTag; + const payload = JSON.stringify({ + block_identifier: testParameters.blockIdentifier, + network_identifier: testParameters.networkIdentifier, + }); + return http.post(url, payload); + }) + .check('Block OK', (r) => r.status === 200) + .build(); + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rosetta/test/blockTransaction.js b/hedera-mirror-test/k6/src/rosetta/test/blockTransaction.js new file mode 100644 index 00000000000..99f48f2d5d7 --- /dev/null +++ b/hedera-mirror-test/k6/src/rosetta/test/blockTransaction.js @@ -0,0 +1,45 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/rosetta/block/transaction'; + +const {options, run} = new TestScenarioBuilder() + .name('blockTransaction') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = testParameters.baseUrl + urlTag; + const payload = JSON.stringify({ + block_identifier: testParameters.blockIdentifier, + network_identifier: testParameters.networkIdentifier, + transaction_identifier: testParameters.transactionIdentifier, + }); + return http.post(url, payload); + }) + .check('BlockTransaction OK', (r) => r.status === 200) + .build(); + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rosetta/test/bootstrapEnvParameters.js b/hedera-mirror-test/k6/src/rosetta/test/bootstrapEnvParameters.js new file mode 100644 index 00000000000..28e403e10c3 --- /dev/null +++ b/hedera-mirror-test/k6/src/rosetta/test/bootstrapEnvParameters.js @@ -0,0 +1,96 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + + +import { + computeAccountParameters, + computeBlockFromNetwork, + computeTransactionFromBlock, + computeNetworkInfo, + setDefaultValuesForEnvParameters +} from "../../lib/parameters.js"; +import {currencyHbar} from "./constants.js"; +import {urlPrefix} from "../../lib/constants.js"; + +const setupTestParameters = () => { + setDefaultValuesForEnvParameters(); + + const baseUrl = __ENV['BASE_URL']; + const networkName = computeNetworkInfo(baseUrl).DEFAULT_NETWORK; + const accountParameters = computeAccountParameters({baseApiUrl: `${baseUrl}${urlPrefix}`}); + + const blockInfo = computeBlockFromNetwork(baseUrl, networkName); + const blockIdentifier = { + index: blockInfo.DEFAULT_BLOCK_INDEX, + hash: blockInfo.DEFAULT_BLOCK_HASH + }; + const networkIdentifier = { + blockchain: 'Hedera', + network: networkName, + sub_network_identifier: { + network: 'shard 0 realm 0', + } + }; + const transactionInfo = computeTransactionFromBlock(baseUrl, networkIdentifier, blockIdentifier); + const accountIdentifier = { + address: `0.0.${accountParameters.DEFAULT_ACCOUNT_ID}`, + metadata: {}, + }; + return { + baseUrl, + accountIdentifier, + blockIdentifier, + networkIdentifier, + operations: [ + { + operation_identifier: {index: 0}, + type: 'CRYPTOTRANSFER', + account: accountIdentifier, + amount: { + value: '-100', + currency: currencyHbar, + } + }, + { + operation_identifier: {index: 1}, + type: 'CRYPTOTRANSFER', + account: accountIdentifier, + amount: { + value: '100', + currency: currencyHbar, + } + } + ], + publicKey: { + hex_bytes: __ENV['ROSETTA_ACCOUNT_PUBLIC_KEY'] || 'eba8cc093a83a4ca5e813e30d8c503babb35c22d57d34b6ec5ac0303a6aaba77', + curve_type: 'edwards25519' + }, + signatureType: 'ed25519', + signingTransaction: __ENV['ROSETTA_SIGNING_PAYLOAD'] || '967f26876ad492cc27b4c384dc962f443bcc9be33cbb7add3844bc864de047340e7a78c0fbaf40ab10948dc570bbc25edb505f112d0926dffb65c93199e6d507', + signedTransaction: __ENV['ROSETTA_SIGNED_TRANSACTION'] || '0x0aaa012aa7010a3d0a140a0c08feafcb840610ae86c0db03120418d8c307120218041880c2d72f2202087872180a160a090a0418d8c30710cf0f0a090a0418fec40710d00f12660a640a20eba8cc093a83a4ca5e813e30d8c503babb35c22d57d34b6ec5ac0303a6aaba771a40793de745bc19dd8fe8e817891f51b8fe1e259c2e6428bd7fa075b181585a2d40e3666a7c9a1873abb5433ffe1414502836d8d37082eaf94a648b530e9fa78108', + transactionIdentifier: { + hash: transactionInfo.DEFAULT_TRANSACTION_HASH + }, + transactionSignature: __ENV['ROSETTA_TRANSACTION_SIGNATURE'] || '793de745bc19dd8fe8e817891f51b8fe1e259c2e6428bd7fa075b181585a2d40e3666a7c9a1873abb5433ffe1414502836d8d37082eaf94a648b530e9fa78108', + unsignedTransaction: __ENV['ROSETTA_UNSIGNED_TRANSACTION'] || '0a432a410a3d0a140a0c08feafcb840610ae86c0db03120418d8c307120218041880c2d72f2202087872180a160a090a0418d8c30710cf0f0a090a0418fec40710d00f1200' + }; +}; + +export {setupTestParameters}; diff --git a/hedera-mirror-test/k6/src/rosetta/test/constants.js b/hedera-mirror-test/k6/src/rosetta/test/constants.js new file mode 100644 index 00000000000..09a7e3ba134 --- /dev/null +++ b/hedera-mirror-test/k6/src/rosetta/test/constants.js @@ -0,0 +1,31 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +const currencyHbar = { + symbol: 'HBAR', + decimals: 8, + metadata: { + issuer: 'Hedera', + }, +}; + +export { + currencyHbar +}; diff --git a/hedera-mirror-test/k6/src/rosetta/test/constructionCombine.js b/hedera-mirror-test/k6/src/rosetta/test/constructionCombine.js new file mode 100644 index 00000000000..ddd3b70f246 --- /dev/null +++ b/hedera-mirror-test/k6/src/rosetta/test/constructionCombine.js @@ -0,0 +1,57 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/rosetta/construction/combine'; + +const {options, run} = new TestScenarioBuilder() + .name('constructionCombine') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = testParameters.baseUrl + urlTag; + // the public key doesn't have to belong to the account in the payload since it's merely used to verify the signature + const payload = JSON.stringify({ + network_identifier: testParameters.networkIdentifier, + unsigned_transaction: testParameters.unsignedTransaction, + signatures: [ + { + signing_payload: { + account_identifier: testParameters.accountIdentifier, + hex_bytes: testParameters.signingTransaction, + signature_type: testParameters.signatureType, + }, + public_key: testParameters.publicKey, + signature_type: testParameters.signatureType, + hex_bytes: testParameters.transactionSignature, + }, + ], + }); + return http.post(url, payload); + }) + .check('ConstructionCombine OK', (r) => r.status === 200) + .build(); + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rosetta/test/constructionHash.js b/hedera-mirror-test/k6/src/rosetta/test/constructionHash.js new file mode 100644 index 00000000000..ff82d981aa6 --- /dev/null +++ b/hedera-mirror-test/k6/src/rosetta/test/constructionHash.js @@ -0,0 +1,44 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/rosetta/construction/hash'; + +const {options, run} = new TestScenarioBuilder() + .name('constructionHash') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = testParameters.baseUrl + urlTag; + const payload = JSON.stringify({ + network_identifier: testParameters.networkIdentifier, + signed_transaction: testParameters.signedTransaction + }); + return http.post(url, payload); + }) + .check('ConstructionHash OK', (r) => r.status === 200) + .build(); + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rosetta/test/constructionParse.js b/hedera-mirror-test/k6/src/rosetta/test/constructionParse.js new file mode 100644 index 00000000000..bb056514ece --- /dev/null +++ b/hedera-mirror-test/k6/src/rosetta/test/constructionParse.js @@ -0,0 +1,45 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/rosetta/construction/parse'; + +const {options, run} = new TestScenarioBuilder() + .name('constructionParse') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = testParameters.baseUrl + urlTag; + const payload = JSON.stringify({ + network_identifier: testParameters.networkIdentifier, + signed: true, + transaction: testParameters.signedTransaction, + }); + return http.post(url, payload); + }) + .check('ConstructionParse OK', (r) => r.status === 200) + .build(); + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rosetta/test/constructionPayloads.js b/hedera-mirror-test/k6/src/rosetta/test/constructionPayloads.js new file mode 100644 index 00000000000..36b0284e632 --- /dev/null +++ b/hedera-mirror-test/k6/src/rosetta/test/constructionPayloads.js @@ -0,0 +1,44 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/rosetta/construction/payloads'; + +const {options, run} = new TestScenarioBuilder() + .name('constructionPayloads') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = testParameters.baseUrl + urlTag; + const payload = JSON.stringify({ + network_identifier: testParameters.networkIdentifier, + operations: testParameters.operations, + }); + return http.post(url, payload); + }) + .check('ConstructionPayloads OK', (r) => r.status === 200) + .build(); + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rosetta/test/constructionPreprocess.js b/hedera-mirror-test/k6/src/rosetta/test/constructionPreprocess.js new file mode 100644 index 00000000000..b9306f7f3f7 --- /dev/null +++ b/hedera-mirror-test/k6/src/rosetta/test/constructionPreprocess.js @@ -0,0 +1,44 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/rosetta/construction/preprocess'; + +const {options, run} = new TestScenarioBuilder() + .name('constructionPreprocess') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const payload = JSON.stringify({ + network_identifier: testParameters.networkIdentifier, + operations: testParameters.operations, + }); + const url = testParameters.baseUrl + urlTag; + return http.post(url, payload); + }) + .check('ConstructionPreprocess OK', (r) => r.status === 200) + .build(); + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rosetta/test/index.js b/hedera-mirror-test/k6/src/rosetta/test/index.js new file mode 100644 index 00000000000..1bb7c540ce8 --- /dev/null +++ b/hedera-mirror-test/k6/src/rosetta/test/index.js @@ -0,0 +1,53 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import {getSequentialTestScenarios} from '../../lib/common.js'; + +// import test modules +import * as accountBalance from './accountBalance.js'; +import * as block from './block.js'; +import * as blockTransaction from './blockTransaction.js'; +import * as constructionCombine from './constructionCombine.js'; +import * as constructionHash from './constructionHash.js'; +import * as constructionParse from './constructionParse.js'; +import * as constructionPayloads from './constructionPayloads.js'; +import * as constructionPreprocess from './constructionPreprocess.js'; +import * as networkList from './networkList.js'; +import * as networkOptions from './networkOptions.js'; +import * as networkStatus from './networkStatus.js'; + +// add test modules here +const tests = { + accountBalance, + block, + blockTransaction, + constructionCombine, + constructionHash, + constructionParse, + constructionPayloads, + constructionPreprocess, + networkList, + networkOptions, + networkStatus, +}; + +const {funcs, options, scenarioDurationGauge} = getSequentialTestScenarios(tests); + +export {funcs, options, scenarioDurationGauge}; diff --git a/hedera-mirror-test/k6/src/rosetta/test/networkList.js b/hedera-mirror-test/k6/src/rosetta/test/networkList.js new file mode 100644 index 00000000000..8e535c5170b --- /dev/null +++ b/hedera-mirror-test/k6/src/rosetta/test/networkList.js @@ -0,0 +1,41 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const payload = JSON.stringify({metadata: {}}); +const urlTag = '/rosetta/network/list'; + +const {options, run} = new TestScenarioBuilder() + .name('networkList') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = testParameters.baseUrl + urlTag; + return http.post(url, payload); + }) + .check('NetworkList OK', (r) => r.status === 200) + .build(); + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rosetta/test/networkOptions.js b/hedera-mirror-test/k6/src/rosetta/test/networkOptions.js new file mode 100644 index 00000000000..fbb071b46d8 --- /dev/null +++ b/hedera-mirror-test/k6/src/rosetta/test/networkOptions.js @@ -0,0 +1,44 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/rosetta/network/options'; + +const {options, run} = new TestScenarioBuilder() + .name('networkOptions') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = testParameters.baseUrl + urlTag; + const payload = JSON.stringify({ + network_identifier: testParameters.networkIdentifier, + metadata: {}, + }); + return http.post(url, payload); + }) + .check('NetworkOptions OK', (r) => r.status === 200) + .build(); + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/rosetta/test/networkStatus.js b/hedera-mirror-test/k6/src/rosetta/test/networkStatus.js new file mode 100644 index 00000000000..36322dc3625 --- /dev/null +++ b/hedera-mirror-test/k6/src/rosetta/test/networkStatus.js @@ -0,0 +1,45 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {setupTestParameters} from "./bootstrapEnvParameters.js"; + +const urlTag = '/rosetta/network/status'; + +const {options, run} = new TestScenarioBuilder() + .name('networkStatus') // use unique scenario name among all tests + .tags({url: urlTag}) + .request((testParameters) => { + const url = testParameters.baseUrl + urlTag; + const payload = JSON.stringify({ + network_identifier: testParameters.networkIdentifier, + metadata: {}, + }); + return http.post(url, payload); + }) + .check('NetworkStatus OK', (r) => r.status === 200) + .build(); + + +export {options, run}; + +export const setup = setupTestParameters; diff --git a/hedera-mirror-test/k6/src/web3/apis.js b/hedera-mirror-test/k6/src/web3/apis.js new file mode 100644 index 00000000000..12a369d1bc2 --- /dev/null +++ b/hedera-mirror-test/k6/src/web3/apis.js @@ -0,0 +1,40 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import exec from 'k6/execution'; +import {textSummary} from 'https://jslib.k6.io/k6-summary/0.0.1/index.js'; + +import {markdownReport} from "../lib/common.js"; +import {funcs, options, scenarioDurationGauge} from './test/index.js'; + +function handleSummary(data) { + return { + 'stdout': textSummary(data, {indent: ' ', enableColors: true}), + 'report.md': markdownReport(data, false, options.scenarios), + }; +} + +function run() { + const scenario = exec.scenario; + funcs[scenario.name](); + scenarioDurationGauge.add(Date.now() - scenario.startTime, {scenario: scenario.name}); +} + +export {handleSummary, options, run}; diff --git a/hedera-mirror-test/k6/src/web3/test/common.js b/hedera-mirror-test/k6/src/web3/test/common.js new file mode 100644 index 00000000000..5188cfdca1d --- /dev/null +++ b/hedera-mirror-test/k6/src/web3/test/common.js @@ -0,0 +1,39 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +const errorField = "error"; +const resultField = "result"; + +function isNonErrorResponse(response) { + //instead of doing multiple type checks, + //lets just do the normal path and return false, + //if an exception happens. + try { + if (response.status !== 200) { + return false; + } + const body = JSON.parse(response.body); + return body.hasOwnProperty(resultField) && !body.hasOwnProperty(errorField); + } catch (e) { + return false; + } +} + +export {isNonErrorResponse}; diff --git a/hedera-mirror-test/k6/src/web3/test/ethBlockNumber.js b/hedera-mirror-test/k6/src/web3/test/ethBlockNumber.js new file mode 100644 index 00000000000..b19ad723dd3 --- /dev/null +++ b/hedera-mirror-test/k6/src/web3/test/ethBlockNumber.js @@ -0,0 +1,47 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import http from "k6/http"; + +import {TestScenarioBuilder} from '../../lib/common.js'; +import {isNonErrorResponse} from "./common.js"; + +const url = __ENV.BASE_URL; + +const payload = JSON.stringify({ + id: 1, + jsonrpc: "2.0", + method: "eth_blockNumber", + params: [] +}); + +const httpParams = { + headers: { + 'Content-Type': 'application/json', + }, +}; + +const {options, run} = new TestScenarioBuilder() + .name('eth_blockNumber') // use unique scenario name among all tests + .request(() => http.post(url, payload, httpParams)) + .check('eth_blockNumber', (r) => isNonErrorResponse(r)) + .build(); + +export {options, run}; diff --git a/hedera-mirror-test/k6/src/web3/test/index.js b/hedera-mirror-test/k6/src/web3/test/index.js new file mode 100644 index 00000000000..1931e160f5c --- /dev/null +++ b/hedera-mirror-test/k6/src/web3/test/index.js @@ -0,0 +1,31 @@ +/*- + * ‌ + * Hedera Mirror Node + * ​ + * Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import {getSequentialTestScenarios} from '../../lib/common.js'; + +// import test modules +import * as ethBlockNumber from './ethBlockNumber.js'; + +// add test modules here +const tests = {ethBlockNumber}; + +const {funcs, options, scenarioDurationGauge} = getSequentialTestScenarios(tests); + +export {funcs, options, scenarioDurationGauge};