From 07099fd6469b1c25a5ed0fbfe00d0744cab2b01e Mon Sep 17 00:00:00 2001 From: Peter Somogyvari Date: Fri, 28 May 2021 10:22:57 -0700 Subject: [PATCH] test(connector-fabric): fix module requires Go 1.17 #914 Primary change: ------------------ Pinned the buggy dependency to yesterday's version (the bug was introduced in this morning's build). This prevents today's version from being used and fixes the problem. Secondary change: -------------------- Upgraded the container image that's being used for the test to the one that has the fabric images pre-cached. This leads to faster test execution and lower probability of developers getting hit by the dreaded DockerHub rate limiting issue. Fixes #914 Signed-off-by: Peter Somogyvari --- .../supply-chain-app-dummy-infrastructure.ts | 5 ++++- .../README.md | 17 ++++++++++------- .../deploy-cc-from-golang-source.test.ts | 9 +++++++-- .../typescript/unit/chain-code-compiler.test.ts | 5 ++++- 4 files changed, 25 insertions(+), 11 deletions(-) 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 cfbd986862..60333f4d8d 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 @@ -276,7 +276,10 @@ export class SupplyChainAppDummyInfrastructure { }, moduleName: "shipment", targetOrganizations: [org1Env], - pinnedDeps: ["github.com/hyperledger/fabric@v1.4.8"], + pinnedDeps: [ + "github.com/hyperledger/fabric@v1.4.8", + "golang.org/x/net@v0.0.0-20210503060351-7fd8e65b6420", + ], }); this.log.debug(res); diff --git a/packages/cactus-plugin-ledger-connector-fabric/README.md b/packages/cactus-plugin-ledger-connector-fabric/README.md index 7f0ef4ed50..e5232f8a14 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/README.md +++ b/packages/cactus-plugin-ledger-connector-fabric/README.md @@ -45,7 +45,7 @@ The above diagram shows the sequence diagraom of transact() method of the Plugin ## Usage -To use this import public-api and create new **PluginLedgerConnectorFabric** and **ChainCodeCompiler**. +To use this import public-api and create new **PluginLedgerConnectorFabric** and **ChainCodeCompiler**. ```typescript const connector: PluginLedgerConnectorFabric = new PluginLedgerConnectorFabric(pluginOptions); const compiler = new ChainCodeCompiler({ logLevel }); @@ -55,7 +55,10 @@ For compile the chaincodes: const opts: ICompilationOptions = { fileName: "hello-world-contract.go", moduleName: "hello-world-contract", - pinnedDeps: ["github.com/hyperledger/fabric@v1.4.8"], + pinnedDeps: [ + "github.com/hyperledger/fabric@v1.4.8", + "golang.org/x/net@v0.0.0-20210503060351-7fd8e65b6420", + ], modTidyOnly: true, // we just need the go.mod file so tidy only is enough sourceCode: HELLO_WORLD_CONTRACT_GO_SOURCE, }; @@ -108,7 +111,7 @@ docker run \ "discoveryOptions": { "enabled": true, "asLocalhost: true" - } + } }}}]' \ cplcb ``` @@ -134,7 +137,7 @@ docker run \ "discoveryOptions": { "enabled": true, "asLocalhost: true" - } + } }}}]' ``` @@ -154,7 +157,7 @@ echo '[{"packageName": "@hyperledger/cactus-plugin-ledger-connector-fabric", "ty "discoveryOptions": { "enabled": true, "asLocalhost: true" - } + } }}}]' > cactus.json docker run \ @@ -196,7 +199,7 @@ docker run \ "discoveryOptions": { "enabled": true, "asLocalhost: true" - } + } }}}]' \ cplcb ``` @@ -288,4 +291,4 @@ Please review [CONTIRBUTING.md](../../CONTRIBUTING.md) to get started. This distribution is published under the Apache License Version 2.0 found in the [LICENSE](../../LICENSE) file. -## Acknowledgments +## Acknowledgments 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 6bbab7aad5..f31e4bf138 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 @@ -55,8 +55,10 @@ test(testCase, async (t: Test) => { const ledger = new FabricTestLedgerV1({ emitContainerLogs: true, publishAllPorts: true, + // imageName: "faio14x", + // imageVersion: "latest", imageName: "hyperledger/cactus-fabric-all-in-one", - imageVersion: "2021-03-02-ssh-hotfix", + imageVersion: "2021-04-21-2016750", }); const tearDown = async () => { @@ -174,7 +176,10 @@ test(testCase, async (t: Test) => { }, moduleName: "hello-world", targetOrganizations: [org1Env, org2Env], - pinnedDeps: ["github.com/hyperledger/fabric@v1.4.8"], + pinnedDeps: [ + "github.com/hyperledger/fabric@v1.4.8", + "golang.org/x/net@v0.0.0-20210503060351-7fd8e65b6420", + ], }); const { diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/unit/chain-code-compiler.test.ts b/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/unit/chain-code-compiler.test.ts index 7d5b61a0ab..41badb9513 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/unit/chain-code-compiler.test.ts +++ b/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/unit/chain-code-compiler.test.ts @@ -17,7 +17,10 @@ test.skip("compiles chaincode straight from go source code", async (t: Test) => const opts: ICompilationOptions = { fileName: "hello-world-contract.go", moduleName: "hello-world-contract", - pinnedDeps: ["github.com/hyperledger/fabric@v1.4.8"], + pinnedDeps: [ + "github.com/hyperledger/fabric@v1.4.8", + "golang.org/x/net@v0.0.0-20210503060351-7fd8e65b6420", + ], sourceCode: HELLO_WORLD_CONTRACT_GO_SOURCE, };