From beefcefbebbdb9a22d08118b6fb2e667493504cf Mon Sep 17 00:00:00 2001 From: Peter Somogyvari Date: Thu, 2 Sep 2021 15:47:20 -0700 Subject: [PATCH] fix(test): flaky fabric AIO container boot #876 Epic facepalm once again. Turns out the default restart try count of supervisord is too low which leads to race conditions. Increasing the retry count from 4 to 20 should do it, this way the fabric-network process (see supervisord.conf file) should be 5 times as "patient" waiting for the docker daemon to launch within the AIO container. What was happening before is that the fabric-network script tried launching itself in parallel with the docker daemon, but it would time out before the docker daemon could come online. Published these images as ghcr.io/hyperledger/cactus-fabric2-all-in-one:2021-09-02--fix-876-supervisord-retries and ghcr.io/hyperledger/cactus-fabric-all-in-one:2021-09-02--fix-876-supervisord-retries Fixes #718 Fixes #876 Fixes #320 Fixes #319 Signed-off-by: Peter Somogyvari --- .../carbon-accounting-app-dummy-infrastructure.ts | 2 +- .../infrastructure/supply-chain-app-dummy-infrastructure.ts | 2 +- .../fabric-v1-4-x/deploy-cc-from-golang-source.test.ts | 2 +- .../fabric-v1-4-x/run-transaction-endpoint-v1.test.ts | 2 +- .../deploy-cc-from-golang-source-private-data.test.ts | 2 +- .../fabric-v2-2-x/deploy-cc-from-golang-source.test.ts | 2 +- .../fabric-v2-2-x/deploy-cc-from-javascript-source.test.ts | 2 +- .../fabric-v2-2-x/deploy-cc-from-typescript-source.test.ts | 2 +- .../fabric-v2-2-x/run-transaction-endpoint-v1.test.ts | 2 +- .../fabric-v2-2-x/run-transaction-with-identities.test.ts | 2 +- .../src/main/typescript/fabric/fabric-test-ledger-v1.ts | 2 +- tools/docker/fabric-all-in-one/supervisord.conf | 3 +++ 12 files changed, 14 insertions(+), 11 deletions(-) diff --git a/examples/cactus-example-carbon-accounting-backend/src/main/typescript/infrastructure/carbon-accounting-app-dummy-infrastructure.ts b/examples/cactus-example-carbon-accounting-backend/src/main/typescript/infrastructure/carbon-accounting-app-dummy-infrastructure.ts index 01dc604daf..aa8225d2fd 100644 --- a/examples/cactus-example-carbon-accounting-backend/src/main/typescript/infrastructure/carbon-accounting-app-dummy-infrastructure.ts +++ b/examples/cactus-example-carbon-accounting-backend/src/main/typescript/infrastructure/carbon-accounting-app-dummy-infrastructure.ts @@ -127,7 +127,7 @@ export class CarbonAccountingAppDummyInfrastructure { this.fabric = new FabricTestLedgerV1({ publishAllPorts: true, imageName: "ghcr.io/hyperledger/cactus-fabric2-all-in-one", - imageVersion: "2021-04-20-nodejs", + imageVersion: "2021-09-02--fix-876-supervisord-retries", envVars: new Map([["FABRIC_VERSION", "2.2.0"]]), logLevel: this.options.logLevel || "INFO", }); diff --git a/examples/cactus-example-supply-chain-backend/src/main/typescript/infrastructure/supply-chain-app-dummy-infrastructure.ts b/examples/cactus-example-supply-chain-backend/src/main/typescript/infrastructure/supply-chain-app-dummy-infrastructure.ts index 65092a09e0..e3484e950e 100644 --- a/examples/cactus-example-supply-chain-backend/src/main/typescript/infrastructure/supply-chain-app-dummy-infrastructure.ts +++ b/examples/cactus-example-supply-chain-backend/src/main/typescript/infrastructure/supply-chain-app-dummy-infrastructure.ts @@ -113,7 +113,7 @@ export class SupplyChainAppDummyInfrastructure { this.fabric = new FabricTestLedgerV1({ publishAllPorts: true, imageName: "ghcr.io/hyperledger/cactus-fabric-all-in-one", - imageVersion: "2021-03-02-ssh-hotfix", + imageVersion: "2021-09-02--fix-876-supervisord-retries", logLevel: level, emitContainerLogs: true, }); diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v1-4-x/deploy-cc-from-golang-source.test.ts b/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v1-4-x/deploy-cc-from-golang-source.test.ts index 01dc109a3f..f84f97b2df 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v1-4-x/deploy-cc-from-golang-source.test.ts +++ b/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v1-4-x/deploy-cc-from-golang-source.test.ts @@ -60,7 +60,7 @@ test(testCase, async (t: Test) => { // imageName: "faio14x", // imageVersion: "latest", imageName: "ghcr.io/hyperledger/cactus-fabric-all-in-one", - imageVersion: "2021-04-21-2016750", + imageVersion: "2021-09-02--fix-876-supervisord-retries", }); const tearDown = async () => { diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v1-4-x/run-transaction-endpoint-v1.test.ts b/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v1-4-x/run-transaction-endpoint-v1.test.ts index 8595dc18d0..c92b8cb2be 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v1-4-x/run-transaction-endpoint-v1.test.ts +++ b/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v1-4-x/run-transaction-endpoint-v1.test.ts @@ -62,7 +62,7 @@ test(testCase, async (t: Test) => { emitContainerLogs: true, logLevel, imageName: "ghcr.io/hyperledger/cactus-fabric-all-in-one", - imageVersion: "2020-12-16-3ddfd8f-v1.4.8", + imageVersion: "2021-09-02--fix-876-supervisord-retries", envVars: new Map([ ["FABRIC_VERSION", "1.4.8"], ["CA_VERSION", "1.4.9"], diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/deploy-cc-from-golang-source-private-data.test.ts b/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/deploy-cc-from-golang-source-private-data.test.ts index a983de1c0a..e2694abe3f 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/deploy-cc-from-golang-source-private-data.test.ts +++ b/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/deploy-cc-from-golang-source-private-data.test.ts @@ -59,7 +59,7 @@ test(testCase, async (t: Test) => { emitContainerLogs: true, publishAllPorts: true, imageName: "ghcr.io/hyperledger/cactus-fabric2-all-in-one", - imageVersion: "2021-04-20-nodejs", + imageVersion: "2021-09-02--fix-876-supervisord-retries", envVars: new Map([["FABRIC_VERSION", "2.2.0"]]), logLevel, }); diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/deploy-cc-from-golang-source.test.ts b/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/deploy-cc-from-golang-source.test.ts index 5d3ec4aa67..583553b891 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/deploy-cc-from-golang-source.test.ts +++ b/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/deploy-cc-from-golang-source.test.ts @@ -61,7 +61,7 @@ test(testCase, async (t: Test) => { // imageName: "faio2x", // imageVersion: "latest", imageName: "ghcr.io/hyperledger/cactus-fabric2-all-in-one", - imageVersion: "2021-04-20-nodejs", + imageVersion: "2021-09-02--fix-876-supervisord-retries", envVars: new Map([["FABRIC_VERSION", "2.2.0"]]), logLevel, }); diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/deploy-cc-from-javascript-source.test.ts b/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/deploy-cc-from-javascript-source.test.ts index dde31f2750..9a2a489363 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/deploy-cc-from-javascript-source.test.ts +++ b/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/deploy-cc-from-javascript-source.test.ts @@ -62,7 +62,7 @@ test(testCase, async (t: Test) => { // imageName: "faio2x", // imageVersion: "latest", imageName: "ghcr.io/hyperledger/cactus-fabric2-all-in-one", - imageVersion: "2021-04-20-nodejs", + imageVersion: "2021-09-02--fix-876-supervisord-retries", envVars: new Map([["FABRIC_VERSION", "2.2.0"]]), logLevel, }); diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/deploy-cc-from-typescript-source.test.ts b/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/deploy-cc-from-typescript-source.test.ts index f58ac7905a..14330c30c8 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/deploy-cc-from-typescript-source.test.ts +++ b/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/deploy-cc-from-typescript-source.test.ts @@ -62,7 +62,7 @@ test(testCase, async (t: Test) => { // imageName: "faio2x", // imageVersion: "latest", imageName: "ghcr.io/hyperledger/cactus-fabric2-all-in-one", - imageVersion: "2021-04-20-nodejs", + imageVersion: "2021-09-02--fix-876-supervisord-retries", envVars: new Map([["FABRIC_VERSION", "2.2.0"]]), logLevel, }); diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/run-transaction-endpoint-v1.test.ts b/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/run-transaction-endpoint-v1.test.ts index aafca696fe..b1394b814f 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/run-transaction-endpoint-v1.test.ts +++ b/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/run-transaction-endpoint-v1.test.ts @@ -65,7 +65,7 @@ test(testCase, async (t: Test) => { publishAllPorts: true, logLevel, imageName: "ghcr.io/hyperledger/cactus-fabric2-all-in-one", - imageVersion: "2021-04-20-nodejs", + imageVersion: "2021-09-02--fix-876-supervisord-retries", envVars: new Map([ ["FABRIC_VERSION", "2.2.0"], ["CA_VERSION", "1.4.9"], diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/run-transaction-with-identities.test.ts b/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/run-transaction-with-identities.test.ts index d6d894873a..a8f0af3f90 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/run-transaction-with-identities.test.ts +++ b/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/run-transaction-with-identities.test.ts @@ -42,7 +42,7 @@ test("run-transaction-with-identities", async (t: Test) => { emitContainerLogs: true, publishAllPorts: true, imageName: "ghcr.io/hyperledger/cactus-fabric2-all-in-one", - imageVersion: "2021-04-20-nodejs", + imageVersion: "2021-09-02--fix-876-supervisord-retries", envVars: new Map([["FABRIC_VERSION", "2.2.0"]]), logLevel, }); diff --git a/packages/cactus-test-tooling/src/main/typescript/fabric/fabric-test-ledger-v1.ts b/packages/cactus-test-tooling/src/main/typescript/fabric/fabric-test-ledger-v1.ts index fbf2a63b78..36a8bc9f11 100644 --- a/packages/cactus-test-tooling/src/main/typescript/fabric/fabric-test-ledger-v1.ts +++ b/packages/cactus-test-tooling/src/main/typescript/fabric/fabric-test-ledger-v1.ts @@ -37,8 +37,8 @@ export interface IFabricTestLedgerV1ConstructorOptions { * Provides default options for Fabric container */ const DEFAULT_OPTS = Object.freeze({ - imageVersion: "2021-01-05-3400c06", imageName: "ghcr.io/hyperledger/cactus-fabric-all-in-one", + imageVersion: "2021-09-02--fix-876-supervisord-retries", envVars: new Map([["FABRIC_VERSION", "1.4.8"]]), }); export const FABRIC_TEST_LEDGER_DEFAULT_OPTIONS = DEFAULT_OPTS; diff --git a/tools/docker/fabric-all-in-one/supervisord.conf b/tools/docker/fabric-all-in-one/supervisord.conf index e3dcd103dc..07f4b52e58 100644 --- a/tools/docker/fabric-all-in-one/supervisord.conf +++ b/tools/docker/fabric-all-in-one/supervisord.conf @@ -8,6 +8,7 @@ loglevel = debug command=/usr/sbin/sshd -D autostart=true autorestart=true +startretries=20 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 stdout_logfile=/dev/stdout @@ -17,6 +18,7 @@ stdout_logfile_maxbytes=0 command=dockerd-entrypoint.sh autostart=true autorestart=true +startretries=20 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 stdout_logfile=/dev/stdout @@ -26,6 +28,7 @@ stdout_logfile_maxbytes=0 command=/run-fabric-network.sh autostart=true autorestart=unexpected +startretries=20 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 stdout_logfile=/dev/stdout