Skip to content

Commit

Permalink
test(connector-fabric): fix module requires Go 1.17 hyperledger#914
Browse files Browse the repository at this point in the history
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 hyperledger#914

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
  • Loading branch information
petermetz committed May 21, 2021
1 parent 59ef093 commit 10eae46
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,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);

Expand Down
17 changes: 10 additions & 7 deletions packages/cactus-plugin-ledger-connector-fabric/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand All @@ -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,
};
Expand Down Expand Up @@ -108,7 +111,7 @@ docker run \
"discoveryOptions": {
"enabled": true,
"asLocalhost: true"
}
}
}}}]' \
cplcb
```
Expand All @@ -134,7 +137,7 @@ docker run \
"discoveryOptions": {
"enabled": true,
"asLocalhost: true"
}
}
}}}]'
```

Expand All @@ -154,7 +157,7 @@ echo '[{"packageName": "@hyperledger/cactus-plugin-ledger-connector-fabric", "ty
"discoveryOptions": {
"enabled": true,
"asLocalhost: true"
}
}
}}}]' > cactus.json

docker run \
Expand Down Expand Up @@ -196,7 +199,7 @@ docker run \
"discoveryOptions": {
"enabled": true,
"asLocalhost: true"
}
}
}}}]' \
cplcb
```
Expand Down Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,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",
});
await ledger.start();
t.doesNotThrow(() => ledger.getContainer(), "Container is set OK");
Expand Down Expand Up @@ -169,7 +171,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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down

0 comments on commit 10eae46

Please sign in to comment.