Skip to content

Commit

Permalink
test(plugin-consortium-manual): fix API server CRPC port allocation
Browse files Browse the repository at this point in the history
1. Also sneaking in a fix for a DCI-Lint failure that was introduced recently
when we added a new Yarn plugin which then stored its install URL in the
.yarnrc.yml file and it uses the old git default main branch name and does
not support the new one so we had to exclude the config file from linting.
2. Also ensured that the ConnectRPC ports are bound to zero in all tests where the API
server is being used. This will prevent port conflicts randomly popping up across the
test suite in the future.
3. Also removed a few test cases from the taprc file because they were already migrated to
Jest and therefore tap should not run them as they fail with the Jest syntax.
4. Also fixing the lack of etherscan API key environment variable in the HTLC coordinator tests.

Signed-off-by: Peter Somogyvari <[email protected]>
  • Loading branch information
petermetz committed Jun 12, 2024
1 parent cc2f9c5 commit 5e342ad
Show file tree
Hide file tree
Showing 35 changed files with 45 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .dcilintignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,7 @@ CHANGELOG.md

# Ignore the Gradle Wrapper scripts because they are vendored dependencies that we cannot alter
**/gradlew

# We can't get around this one because there's a yarn plugin whose install URL
# only supports the old default branch name in git
.yarnrc.yml
1 change: 1 addition & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1961,6 +1961,7 @@ jobs:
ctp-htlc-eth-besu:
continue-on-error: false
env:
ETHERSCAN_KEY: ${{ secrets.ETHERSCAN_KEY }}
FULL_BUILD_DISABLED: true
JEST_TEST_PATTERN: packages/cactus-test-plugin-htlc-eth-besu/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts
JEST_TEST_RUNNER_DISABLED: false
Expand Down
2 changes: 0 additions & 2 deletions .taprc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ files:
- ./packages/cactus-plugin-ledger-connector-quorum/src/test/typescript/integration/plugin-ledger-connector-quorum/deploy-contract/v2.3.0-deploy-contract-from-json-json-object-endpoints.test.ts
- ./packages/cactus-plugin-ledger-connector-quorum/src/test/typescript/integration/plugin-ledger-connector-quorum/deploy-contract/openapi/openapi-validation-no-keychain.test.ts
- ./packages/cactus-plugin-ledger-connector-quorum/src/test/typescript/integration/plugin-ledger-connector-quorum/deploy-contract/v2.3.0-invoke-contract-json-object.test.ts
- ./packages/cactus-plugin-ledger-connector-quorum/src/test/typescript/integration/plugin-ledger-connector-quorum/deploy-contract/v2.3.0-deploy-contract-from-json.test.ts
- ./packages/cactus-plugin-ledger-connector-quorum/src/test/typescript/integration/plugin-ledger-connector-quorum/deploy-contract/v21.4.1-deploy-contract-from-json-json-object.test.ts
- ./packages/cactus-plugin-ledger-connector-quorum/src/test/typescript/integration/plugin-ledger-connector-quorum/deploy-contract/v2.3.0-deploy-contract-from-json-json-object.test.ts
- ./packages/cactus-plugin-ledger-connector-quorum/src/test/typescript/integration/plugin-ledger-connector-quorum/deploy-contract/openapi/openapi-validation.test.ts
Expand All @@ -34,7 +33,6 @@ files:
- ./packages/cactus-test-plugin-htlc-eth-besu-erc20/src/test/typescript/integration/plugin-htlc-eth-besu-erc20/get-status-endpoint.test.ts
- ./packages/cactus-test-plugin-htlc-eth-besu-erc20/src/test/typescript/integration/plugin-htlc-eth-besu-erc20/openapi/openapi-validation.test.ts
- ./packages/cactus-test-plugin-htlc-eth-besu-erc20/src/test/typescript/integration/plugin-htlc-eth-besu-erc20/refund-endpoint.test.ts
- ./packages/cactus-test-cmd-api-server/src/test/typescript/integration/remote-plugin-imports.test.ts
- ./packages/cactus-test-cmd-api-server/src/test/typescript/integration/plugin-import-with-npm-install-version-selection.test.ts
- ./packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/openapi/openapi-validation.test.ts
- ./packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/deploy-cordapp-jars-to-nodes-v4.7.test.ts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ export class CarbonAccountingApp {
config.cockpitPort = addressInfoCockpit.port;
config.grpcPort = 0; // TODO - make this configurable as well
config.logLevel = this.options.logLevel || "INFO";
config.crpcPort = 0;
}

const apiServer = new ApiServer({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ test.skip(testCase, async (t: Test) => {
apiSrvOpts.apiPort = 0;
apiSrvOpts.cockpitPort = 0;
apiSrvOpts.grpcPort = 0;
apiSrvOpts.crpcPort = 0;
apiSrvOpts.apiTlsEnabled = false;
apiSrvOpts.plugins = [];
const convictConfig = await configService.newExampleConfigConvict(apiSrvOpts);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,7 @@ export class SupplyChainApp {
properties.authorizationProtocol = AuthorizationProtocol.JSON_WEB_TOKEN;
properties.authorizationConfigJson =
await this.getOrCreateAuthorizationConfig();
properties.crpcPort = 0;

const apiServer = new ApiServer({
config: properties,
Expand Down
1 change: 0 additions & 1 deletion jest.config.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ const createTestInfrastructure = async (opts: {
apiSrvOpts.apiPort = 0;
apiSrvOpts.cockpitPort = 0;
apiSrvOpts.grpcPort = 0;
apiSrvOpts.crpcPort = 0;
apiSrvOpts.apiTlsEnabled = false;
apiSrvOpts.grpcMtlsEnabled = false;
apiSrvOpts.plugins = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ describe(testCase, () => {
apiSrvOpts.apiPort = 0;
apiSrvOpts.cockpitPort = 0;
apiSrvOpts.grpcPort = 0;
apiSrvOpts.crpcPort = 0;
apiSrvOpts.apiTlsEnabled = false;
apiSrvOpts.plugins = [];
const config = await configService.newExampleConfigConvict(apiSrvOpts);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ describe(testCase, () => {
apiSrvOpts.apiPort = 0;
apiSrvOpts.cockpitPort = 0;
apiSrvOpts.grpcPort = 0;
apiSrvOpts.crpcPort = 0;
apiSrvOpts.apiTlsEnabled = false;
apiSrvOpts.plugins = [];
const config = await configService.newExampleConfigConvict(apiSrvOpts);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ describe("cmd-api-server:ApiServer", () => {
apiSrvOpts.apiPort = 0;
apiSrvOpts.cockpitPort = 0;
apiSrvOpts.grpcPort = 0;
apiSrvOpts.crpcPort = 0;
apiSrvOpts.logLevel = logLevel;
apiSrvOpts.apiTlsEnabled = false;
apiSrvOpts.plugins = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ test(testCase, async () => {
apiSrvOpts.apiPort = 0;
apiSrvOpts.cockpitPort = 0;
apiSrvOpts.grpcPort = 0;
apiSrvOpts.crpcPort = 0;
apiSrvOpts.apiTlsEnabled = false;
apiSrvOpts.plugins = [];
const config = await configService.newExampleConfigConvict(apiSrvOpts);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ describe(testCase, () => {
apiSrvOpts.apiPort = 0;
apiSrvOpts.cockpitPort = 0;
apiSrvOpts.grpcPort = 0;
apiSrvOpts.crpcPort = 0;
apiSrvOpts.apiTlsEnabled = false;
apiSrvOpts.plugins = [];
const config = await configService.newExampleConfigConvict(apiSrvOpts);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ test("can install plugins at runtime with specified version based on imports", a
apiServerOptions.apiPort = 0;
apiServerOptions.cockpitPort = 0;
apiServerOptions.grpcPort = 0;
apiServerOptions.crpcPort = 0;
apiServerOptions.apiTlsEnabled = false;
apiServerOptions.plugins = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ test("can instantiate plugins at runtime without install them", async (t: Test)
apiServerOptions.apiPort = 0;
apiServerOptions.cockpitPort = 0;
apiServerOptions.grpcPort = 0;
apiServerOptions.crpcPort = 0;
apiServerOptions.apiTlsEnabled = false;

const instanceId = uuidv4();
Expand Down Expand Up @@ -86,6 +87,7 @@ test("can instantiate plugins at runtime without install them", async (t: Test)
apiServerOptions.apiPort = 0;
apiServerOptions.cockpitPort = 0;
apiServerOptions.grpcPort = 0;
apiServerOptions.crpcPort = 0;
apiServerOptions.apiTlsEnabled = false;

const versionToSendServer = "0.7.0";
Expand Down Expand Up @@ -183,6 +185,7 @@ test("can instantiate plugins at runtime without install them", async (t: Test)
apiServerOptions.apiPort = 0;
apiServerOptions.cockpitPort = 0;
apiServerOptions.grpcPort = 0;
apiServerOptions.crpcPort = 0;
apiServerOptions.apiTlsEnabled = false;
const versionToInstall = "0.8.0";
apiServerOptions.plugins = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ test("NodeJS API server + Rust plugin work together", async (t: Test) => {
apiServerOptions.apiPort = 0;
apiServerOptions.cockpitPort = 0;
apiServerOptions.grpcPort = 0;
apiServerOptions.crpcPort = 0;
apiServerOptions.apiTlsEnabled = false;
apiServerOptions.plugins = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ describe("cmd-api-server:getOpenApiSpecV1Endpoint", () => {
apiSrvOpts.apiPort = 0;
apiSrvOpts.cockpitPort = 0;
apiSrvOpts.grpcPort = 0;
apiSrvOpts.crpcPort = 0;
apiSrvOpts.apiTlsEnabled = false;
apiSrvOpts.grpcMtlsEnabled = false;
apiSrvOpts.plugins = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ test(testCase, async (t: Test) => {
apiSrvOpts.apiCorsDomainCsv = "*";
apiSrvOpts.apiPort = 0;
apiSrvOpts.grpcPort = 0;
apiSrvOpts.crpcPort = 0;
apiSrvOpts.cockpitPort = 0;
apiSrvOpts.grpcMtlsEnabled = false;
apiSrvOpts.apiTlsEnabled = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ test(testCase, async (t: Test) => {
apiSrvOpts.apiCorsDomainCsv = "*";
apiSrvOpts.apiPort = 0;
apiSrvOpts.grpcPort = 0;
apiSrvOpts.crpcPort = 0;
apiSrvOpts.cockpitPort = 0;
apiSrvOpts.grpcMtlsEnabled = false;
apiSrvOpts.apiTlsEnabled = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ test(testCase, async (t: Test) => {
apiSrvOpts.apiTlsKeyPem = serverCert.privateKeyPem;
apiSrvOpts.apiTlsClientCaPem = clientCert.certificatePem;
apiSrvOpts.grpcPort = 0;
apiSrvOpts.crpcPort = 0;
apiSrvOpts.cockpitPort = 0;
apiSrvOpts.grpcMtlsEnabled = true;
apiSrvOpts.apiTlsEnabled = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ test("can install plugin-consortium-manual", async (t: Test) => {
apiServerOptions.apiPort = 0;
apiServerOptions.cockpitPort = 0;
apiServerOptions.grpcPort = 0;
apiServerOptions.crpcPort = 0;
apiServerOptions.apiTlsEnabled = false;
apiServerOptions.plugins = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ test("can import plugins at runtime (CLI)", async (t: Test) => {
apiServerOptions.apiPort = 0;
apiServerOptions.cockpitPort = 0;
apiServerOptions.grpcPort = 0;
apiServerOptions.crpcPort = 0;
apiServerOptions.apiTlsEnabled = false;
apiServerOptions.plugins = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ describe(testCase, () => {
apiServerOptions.apiPort = addressInfo1.port;
apiServerOptions.cockpitPort = 0;
apiServerOptions.grpcPort = 0;
apiServerOptions.crpcPort = 0;
apiServerOptions.apiTlsEnabled = false;
apiServerOptions.crpcPort = 0;
const config =
Expand Down Expand Up @@ -249,6 +250,7 @@ describe(testCase, () => {
apiServerOptions.apiPort = addressInfo2.port;
apiServerOptions.cockpitPort = 0;
apiServerOptions.grpcPort = 0;
apiServerOptions.crpcPort = 0;
apiServerOptions.apiTlsEnabled = false;
apiServerOptions.plugins = [];
apiServerOptions.crpcPort = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ test("can install plugins at runtime with specified version based on imports", a
apiServerOptions.apiPort = 0;
apiServerOptions.cockpitPort = 0;
apiServerOptions.grpcPort = 0;
apiServerOptions.crpcPort = 0;
apiServerOptions.apiTlsEnabled = false;
apiServerOptions.plugins = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ describe(testcase, () => {
apiServerOptions.apiPort = 0;
apiServerOptions.cockpitPort = 0;
apiServerOptions.grpcPort = 0;
apiServerOptions.crpcPort = 0;
apiServerOptions.apiTlsEnabled = false;
apiServerOptions.plugins = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ describe(testCase, () => {
apiServerOptions.apiPort = 0;
apiServerOptions.cockpitPort = 0;
apiServerOptions.grpcPort = 0;
apiServerOptions.crpcPort = 0;
apiServerOptions.apiTlsEnabled = false;
apiServerOptions.plugins = [];
const config =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ describe(testCase, () => {
apiServerOptions.apiPort = 0;
apiServerOptions.cockpitPort = 0;
apiServerOptions.grpcPort = 0;
apiServerOptions.crpcPort = 0;
apiServerOptions.apiTlsEnabled = false;
apiServerOptions.plugins = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ describe(testCase, () => {
apiServerOptions.apiPort = addressInfo2.port;
apiServerOptions.cockpitPort = 0;
apiServerOptions.grpcPort = 0;
apiServerOptions.crpcPort = 0;
apiServerOptions.apiTlsEnabled = false;
apiServerOptions.plugins = [];
apiServerOptions.crpcPort = 0;
Expand Down Expand Up @@ -317,6 +318,7 @@ describe(testCase, () => {
apiServerOptions.apiPort = addressInfo3.port;
apiServerOptions.cockpitPort = 0;
apiServerOptions.grpcPort = 0;
apiServerOptions.crpcPort = 0;
apiServerOptions.apiTlsEnabled = false;
apiServerOptions.plugins = [];
apiServerOptions.crpcPort = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,10 @@ test(testCase, async (t: Test) => {
apiServerOptions.apiCorsDomainCsv = "*";
apiServerOptions.apiPort = addressInfo1.port;
apiServerOptions.grpcPort = 0;
apiServerOptions.crpcPort = 0;
apiServerOptions.cockpitPort = 0;
apiServerOptions.apiTlsEnabled = false;
apiServerOptions.crpcPort = 0;
const config =
await configService.newExampleConfigConvict(apiServerOptions);

Expand Down Expand Up @@ -198,7 +200,9 @@ test(testCase, async (t: Test) => {
apiServerOptions.apiPort = addressInfo2.port;
apiServerOptions.cockpitPort = 0;
apiServerOptions.grpcPort = 0;
apiServerOptions.crpcPort = 0;
apiServerOptions.apiTlsEnabled = false;
apiServerOptions.crpcPort = 0;
const config =
await configService.newExampleConfigConvict(apiServerOptions);

Expand Down Expand Up @@ -235,7 +239,9 @@ test(testCase, async (t: Test) => {
apiServerOptions.apiPort = addressInfo3.port;
apiServerOptions.cockpitPort = 0;
apiServerOptions.grpcPort = 0;
apiServerOptions.crpcPort = 0;
apiServerOptions.apiTlsEnabled = false;
apiServerOptions.crpcPort = 0;
const config =
await configService.newExampleConfigConvict(apiServerOptions);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ describe("BesuGrpcSvcOpenApi", () => {
apiSrvOpts.apiPort = addressInfo.port;
apiSrvOpts.cockpitPort = 0;
apiSrvOpts.grpcPort = 0;
apiSrvOpts.crpcPort = 0;
apiSrvOpts.grpcMtlsEnabled = false;
apiSrvOpts.apiTlsEnabled = false;
const cfg = await cfgSrv.newExampleConfigConvict(apiSrvOpts);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ test(testCase, async (t: Test) => {
apiServerOptions.apiPort = addressInfo1.port;
apiServerOptions.cockpitPort = 0;
apiServerOptions.grpcPort = 0;
apiServerOptions.crpcPort = 0;
apiServerOptions.apiTlsEnabled = false;
const config = await configService.newExampleConfigConvict(apiServerOptions);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ test(testCase, async (t: Test) => {
apiServerOptions.apiPort = addressInfo1.port;
apiServerOptions.cockpitPort = 0;
apiServerOptions.grpcPort = 0;
apiServerOptions.crpcPort = 0;
apiServerOptions.apiTlsEnabled = false;
const config = await configService.newExampleConfigConvict(apiServerOptions);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ test(testCase, async (t: Test) => {
apiServerOptions.apiPort = addressInfo1.port;
apiServerOptions.cockpitPort = 0;
apiServerOptions.grpcPort = 0;
apiServerOptions.crpcPort = 0;
apiServerOptions.apiTlsEnabled = false;
const config = await configService.newExampleConfigConvict(apiServerOptions);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ test(testCase, async (t: Test) => {
apiServerOptions.apiPort = addressInfo1.port;
apiServerOptions.cockpitPort = 0;
apiServerOptions.grpcPort = 0;
apiServerOptions.crpcPort = 0;
apiServerOptions.apiTlsEnabled = false;
const config = await configService.newExampleConfigConvict(apiServerOptions);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ describe(testCase, () => {
apiServerOptions.apiPort = addressInfo1.port;
apiServerOptions.cockpitPort = 0;
apiServerOptions.grpcPort = 0;
apiServerOptions.crpcPort = 0;
apiServerOptions.apiTlsEnabled = false;
const config =
await configService.newExampleConfigConvict(apiServerOptions);
Expand Down

0 comments on commit 5e342ad

Please sign in to comment.