-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(connector-fabric): move integration tests to use Fabric v2.5.6 AIO
1. This fixes many flakes that we were suffering from before with the older versions of the AIO image. 2. There could still be other flakes lurking around, but their numbers should definitely be going down with this change due to the increased stability of the new AIO image. Signed-off-by: Peter Somogyvari <[email protected]>
- Loading branch information
Showing
13 changed files
with
123 additions
and
304 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,8 @@ import { | |
DEFAULT_FABRIC_2_AIO_FABRIC_VERSION, | ||
DEFAULT_FABRIC_2_AIO_IMAGE_NAME, | ||
DEFAULT_FABRIC_2_AIO_IMAGE_VERSION, | ||
FABRIC_25_LTS_FABRIC_SAMPLES_ENV_INFO_ORG_1, | ||
FABRIC_25_LTS_FABRIC_SAMPLES_ENV_INFO_ORG_2, | ||
FabricTestLedgerV1, | ||
pruneDockerAllIfGithubAction, | ||
} from "@hyperledger/cactus-test-tooling"; | ||
|
@@ -42,7 +44,7 @@ import { PluginKeychainMemory } from "@hyperledger/cactus-plugin-keychain-memory | |
|
||
const testCase = "deploys Fabric 2.x contract from go source"; | ||
describe(testCase, () => { | ||
const logLevel: LogLevelDesc = "TRACE"; | ||
const logLevel: LogLevelDesc = "INFO"; | ||
const expressApp = express(); | ||
expressApp.use(bodyParser.json({ limit: "250mb" })); | ||
const server = http.createServer(expressApp); | ||
|
@@ -134,50 +136,13 @@ describe(testCase, () => { | |
asLocalhost: true, | ||
}; | ||
|
||
// This is the directory structure of the Fabirc 2.x CLI container (fabric-tools image) | ||
// const orgCfgDir = "/fabric-samples/test-network/organizations/"; | ||
const orgCfgDir = | ||
"/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/"; | ||
|
||
// these below mirror how the fabric-samples sets up the configuration | ||
const org1Env = { | ||
CORE_LOGGING_LEVEL: "debug", | ||
FABRIC_LOGGING_SPEC: "debug", | ||
CORE_PEER_LOCALMSPID: "Org1MSP", | ||
|
||
ORDERER_CA: `${orgCfgDir}ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem`, | ||
|
||
FABRIC_CFG_PATH: "/etc/hyperledger/fabric", | ||
CORE_PEER_TLS_ENABLED: "true", | ||
CORE_PEER_TLS_ROOTCERT_FILE: `${orgCfgDir}peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt`, | ||
CORE_PEER_MSPCONFIGPATH: `${orgCfgDir}peerOrganizations/org1.example.com/users/[email protected]/msp`, | ||
CORE_PEER_ADDRESS: "peer0.org1.example.com:7051", | ||
ORDERER_TLS_ROOTCERT_FILE: `${orgCfgDir}ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem`, | ||
}; | ||
|
||
// these below mirror how the fabric-samples sets up the configuration | ||
const org2Env = { | ||
CORE_LOGGING_LEVEL: "debug", | ||
FABRIC_LOGGING_SPEC: "debug", | ||
CORE_PEER_LOCALMSPID: "Org2MSP", | ||
|
||
FABRIC_CFG_PATH: "/etc/hyperledger/fabric", | ||
CORE_PEER_TLS_ENABLED: "true", | ||
ORDERER_CA: `${orgCfgDir}ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem`, | ||
|
||
CORE_PEER_ADDRESS: "peer0.org2.example.com:9051", | ||
CORE_PEER_MSPCONFIGPATH: `${orgCfgDir}peerOrganizations/org2.example.com/users/[email protected]/msp`, | ||
CORE_PEER_TLS_ROOTCERT_FILE: `${orgCfgDir}peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt`, | ||
ORDERER_TLS_ROOTCERT_FILE: `${orgCfgDir}ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem`, | ||
}; | ||
|
||
const pluginOptions: IPluginLedgerConnectorFabricOptions = { | ||
instanceId: uuidv4(), | ||
dockerBinary: "/usr/local/bin/docker", | ||
peerBinary: "/fabric-samples/bin/peer", | ||
goBinary: "/usr/local/go/bin/go", | ||
pluginRegistry, | ||
cliContainerEnv: org1Env, | ||
cliContainerEnv: FABRIC_25_LTS_FABRIC_SAMPLES_ENV_INFO_ORG_1, | ||
sshConfig, | ||
logLevel, | ||
connectionProfile, | ||
|
@@ -259,8 +224,12 @@ describe(testCase, () => { | |
], | ||
collectionsConfigFile: privateDataCollectionName, | ||
ccName: contractName, | ||
targetOrganizations: [org1Env, org2Env], | ||
caFile: `${orgCfgDir}ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem`, | ||
targetOrganizations: [ | ||
FABRIC_25_LTS_FABRIC_SAMPLES_ENV_INFO_ORG_1, | ||
FABRIC_25_LTS_FABRIC_SAMPLES_ENV_INFO_ORG_2, | ||
], | ||
caFile: | ||
FABRIC_25_LTS_FABRIC_SAMPLES_ENV_INFO_ORG_1.ORDERER_TLS_ROOTCERT_FILE, | ||
ccLabel: "basic-asset-transfer-2", | ||
ccLang: ChainCodeProgrammingLanguage.Golang, | ||
ccSequence: 1, | ||
|
@@ -306,13 +275,6 @@ describe(testCase, () => { | |
Checks.truthy(packaging, `packaging truthy OK`); | ||
Checks.truthy(queryCommitted, `queryCommitted truthy OK`); | ||
|
||
// FIXME - without this wait it randomly fails with an error claiming that | ||
// the endorsement was impossible to be obtained. The fabric-samples script | ||
// does the same thing, it just waits 10 seconds for good measure so there | ||
// might not be a way for us to avoid doing this, but if there is a way we | ||
// absolutely should not have timeouts like this, anywhere... | ||
await new Promise((resolve) => setTimeout(resolve, 10000)); | ||
|
||
const assetId = uuidv4(); | ||
const assetType = "asset"; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,8 +11,10 @@ import bodyParser from "body-parser"; | |
|
||
import { | ||
Containers, | ||
DEFAULT_FABRIC_2_AIO_FABRIC_VERSION, | ||
DEFAULT_FABRIC_2_AIO_IMAGE_VERSION, | ||
FABRIC_25_LTS_AIO_FABRIC_VERSION, | ||
FABRIC_25_LTS_AIO_IMAGE_VERSION, | ||
FABRIC_25_LTS_FABRIC_SAMPLES_ENV_INFO_ORG_1, | ||
FABRIC_25_LTS_FABRIC_SAMPLES_ENV_INFO_ORG_2, | ||
FabricTestLedgerV1, | ||
pruneDockerAllIfGithubAction, | ||
} from "@hyperledger/cactus-test-tooling"; | ||
|
@@ -42,7 +44,7 @@ import { Configuration } from "@hyperledger/cactus-core-api"; | |
import { DEFAULT_FABRIC_2_AIO_IMAGE_NAME } from "@hyperledger/cactus-test-tooling"; | ||
|
||
const testCase = "deploys Fabric 2.x contract from go source"; | ||
const logLevel: LogLevelDesc = "TRACE"; | ||
const logLevel: LogLevelDesc = "INFO"; | ||
|
||
test("BEFORE " + testCase, async (t: Test) => { | ||
const pruning = pruneDockerAllIfGithubAction({ logLevel }); | ||
|
@@ -62,8 +64,8 @@ test(testCase, async (t: Test) => { | |
emitContainerLogs: true, | ||
publishAllPorts: true, | ||
imageName: DEFAULT_FABRIC_2_AIO_IMAGE_NAME, | ||
imageVersion: DEFAULT_FABRIC_2_AIO_IMAGE_VERSION, | ||
envVars: new Map([["FABRIC_VERSION", DEFAULT_FABRIC_2_AIO_FABRIC_VERSION]]), | ||
imageVersion: FABRIC_25_LTS_AIO_IMAGE_VERSION, | ||
envVars: new Map([["FABRIC_VERSION", FABRIC_25_LTS_AIO_FABRIC_VERSION]]), | ||
logLevel, | ||
}); | ||
|
||
|
@@ -106,50 +108,13 @@ test(testCase, async (t: Test) => { | |
asLocalhost: true, | ||
}; | ||
|
||
// This is the directory structure of the Fabirc 2.x CLI container (fabric-tools image) | ||
// const orgCfgDir = "/fabric-samples/test-network/organizations/"; | ||
const orgCfgDir = | ||
"/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/"; | ||
|
||
// these below mirror how the fabric-samples sets up the configuration | ||
const org1Env = { | ||
CORE_LOGGING_LEVEL: "debug", | ||
FABRIC_LOGGING_SPEC: "debug", | ||
CORE_PEER_LOCALMSPID: "Org1MSP", | ||
|
||
ORDERER_CA: `${orgCfgDir}ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem`, | ||
|
||
FABRIC_CFG_PATH: "/etc/hyperledger/fabric", | ||
CORE_PEER_TLS_ENABLED: "true", | ||
CORE_PEER_TLS_ROOTCERT_FILE: `${orgCfgDir}peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt`, | ||
CORE_PEER_MSPCONFIGPATH: `${orgCfgDir}peerOrganizations/org1.example.com/users/[email protected]/msp`, | ||
CORE_PEER_ADDRESS: "peer0.org1.example.com:7051", | ||
ORDERER_TLS_ROOTCERT_FILE: `${orgCfgDir}ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem`, | ||
}; | ||
|
||
// these below mirror how the fabric-samples sets up the configuration | ||
const org2Env = { | ||
CORE_LOGGING_LEVEL: "debug", | ||
FABRIC_LOGGING_SPEC: "debug", | ||
CORE_PEER_LOCALMSPID: "Org2MSP", | ||
|
||
FABRIC_CFG_PATH: "/etc/hyperledger/fabric", | ||
CORE_PEER_TLS_ENABLED: "true", | ||
ORDERER_CA: `${orgCfgDir}ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem`, | ||
|
||
CORE_PEER_ADDRESS: "peer0.org2.example.com:9051", | ||
CORE_PEER_MSPCONFIGPATH: `${orgCfgDir}peerOrganizations/org2.example.com/users/[email protected]/msp`, | ||
CORE_PEER_TLS_ROOTCERT_FILE: `${orgCfgDir}peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt`, | ||
ORDERER_TLS_ROOTCERT_FILE: `${orgCfgDir}ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem`, | ||
}; | ||
|
||
const pluginOptions: IPluginLedgerConnectorFabricOptions = { | ||
instanceId: uuidv4(), | ||
dockerBinary: "/usr/local/bin/docker", | ||
peerBinary: "/fabric-samples/bin/peer", | ||
goBinary: "/usr/local/go/bin/go", | ||
pluginRegistry, | ||
cliContainerEnv: org1Env, | ||
cliContainerEnv: FABRIC_25_LTS_FABRIC_SAMPLES_ENV_INFO_ORG_1, | ||
sshConfig, | ||
logLevel, | ||
connectionProfile, | ||
|
@@ -225,8 +190,12 @@ test(testCase, async (t: Test) => { | |
// constructorArgs: { Args: ["john", "99"] }, | ||
sourceFiles: [assetTransferGo, smartContractGo, goMod, goSum], | ||
ccName: contractName, | ||
targetOrganizations: [org1Env, org2Env], | ||
caFile: `${orgCfgDir}ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem`, | ||
targetOrganizations: [ | ||
FABRIC_25_LTS_FABRIC_SAMPLES_ENV_INFO_ORG_1, | ||
FABRIC_25_LTS_FABRIC_SAMPLES_ENV_INFO_ORG_2, | ||
], | ||
caFile: | ||
FABRIC_25_LTS_FABRIC_SAMPLES_ENV_INFO_ORG_1.ORDERER_TLS_ROOTCERT_FILE, | ||
ccLabel: "basic-asset-transfer-2", | ||
ccLang: ChainCodeProgrammingLanguage.Golang, | ||
ccSequence: 1, | ||
|
@@ -273,13 +242,6 @@ test(testCase, async (t: Test) => { | |
Checks.truthy(packaging, `packaging truthy OK`); | ||
Checks.truthy(queryCommitted, `queryCommitted truthy OK`); | ||
|
||
// FIXME - without this wait it randomly fails with an error claiming that | ||
// the endorsement was impossible to be obtained. The fabric-samples script | ||
// does the same thing, it just waits 10 seconds for good measure so there | ||
// might not be a way for us to avoid doing this, but if there is a way we | ||
// absolutely should not have timeouts like this, anywhere... | ||
await new Promise((resolve) => setTimeout(resolve, 10000)); | ||
|
||
const assetId = uuidv4(); | ||
const assetOwner = uuidv4(); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,9 +11,11 @@ import bodyParser from "body-parser"; | |
|
||
import { | ||
Containers, | ||
DEFAULT_FABRIC_2_AIO_FABRIC_VERSION, | ||
DEFAULT_FABRIC_2_AIO_IMAGE_NAME, | ||
DEFAULT_FABRIC_2_AIO_IMAGE_VERSION, | ||
FABRIC_25_LTS_AIO_FABRIC_VERSION, | ||
FABRIC_25_LTS_AIO_IMAGE_VERSION, | ||
FABRIC_25_LTS_FABRIC_SAMPLES_ENV_INFO_ORG_1, | ||
FABRIC_25_LTS_FABRIC_SAMPLES_ENV_INFO_ORG_2, | ||
FabricTestLedgerV1, | ||
pruneDockerAllIfGithubAction, | ||
} from "@hyperledger/cactus-test-tooling"; | ||
|
@@ -65,8 +67,8 @@ test(testCase, async (t: Test) => { | |
emitContainerLogs: true, | ||
publishAllPorts: true, | ||
imageName: DEFAULT_FABRIC_2_AIO_IMAGE_NAME, | ||
imageVersion: DEFAULT_FABRIC_2_AIO_IMAGE_VERSION, | ||
envVars: new Map([["FABRIC_VERSION", DEFAULT_FABRIC_2_AIO_FABRIC_VERSION]]), | ||
imageVersion: FABRIC_25_LTS_AIO_IMAGE_VERSION, | ||
envVars: new Map([["FABRIC_VERSION", FABRIC_25_LTS_AIO_FABRIC_VERSION]]), | ||
logLevel, | ||
}); | ||
const tearDown = async () => { | ||
|
@@ -108,50 +110,13 @@ test(testCase, async (t: Test) => { | |
asLocalhost: true, | ||
}; | ||
|
||
// This is the directory structure of the Fabirc 2.x CLI container (fabric-tools image) | ||
// const orgCfgDir = "/fabric-samples/test-network/organizations/"; | ||
const orgCfgDir = | ||
"/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/"; | ||
|
||
// these below mirror how the fabric-samples sets up the configuration | ||
const org1Env = { | ||
CORE_LOGGING_LEVEL: "debug", | ||
FABRIC_LOGGING_SPEC: "debug", | ||
CORE_PEER_LOCALMSPID: "Org1MSP", | ||
|
||
ORDERER_CA: `${orgCfgDir}ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem`, | ||
|
||
FABRIC_CFG_PATH: "/etc/hyperledger/fabric", | ||
CORE_PEER_TLS_ENABLED: "true", | ||
CORE_PEER_TLS_ROOTCERT_FILE: `${orgCfgDir}peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt`, | ||
CORE_PEER_MSPCONFIGPATH: `${orgCfgDir}peerOrganizations/org1.example.com/users/[email protected]/msp`, | ||
CORE_PEER_ADDRESS: "peer0.org1.example.com:7051", | ||
ORDERER_TLS_ROOTCERT_FILE: `${orgCfgDir}ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem`, | ||
}; | ||
|
||
// these below mirror how the fabric-samples sets up the configuration | ||
const org2Env = { | ||
CORE_LOGGING_LEVEL: "debug", | ||
FABRIC_LOGGING_SPEC: "debug", | ||
CORE_PEER_LOCALMSPID: "Org2MSP", | ||
|
||
FABRIC_CFG_PATH: "/etc/hyperledger/fabric", | ||
CORE_PEER_TLS_ENABLED: "true", | ||
ORDERER_CA: `${orgCfgDir}ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem`, | ||
|
||
CORE_PEER_ADDRESS: "peer0.org2.example.com:9051", | ||
CORE_PEER_MSPCONFIGPATH: `${orgCfgDir}peerOrganizations/org2.example.com/users/[email protected]/msp`, | ||
CORE_PEER_TLS_ROOTCERT_FILE: `${orgCfgDir}peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt`, | ||
ORDERER_TLS_ROOTCERT_FILE: `${orgCfgDir}ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem`, | ||
}; | ||
|
||
const pluginOptions: IPluginLedgerConnectorFabricOptions = { | ||
instanceId: uuidv4(), | ||
dockerBinary: "/usr/local/bin/docker", | ||
peerBinary: "/fabric-samples/bin/peer", | ||
goBinary: "/usr/local/go/bin/go", | ||
pluginRegistry, | ||
cliContainerEnv: org1Env, | ||
cliContainerEnv: FABRIC_25_LTS_FABRIC_SAMPLES_ENV_INFO_ORG_1, | ||
sshConfig, | ||
logLevel, | ||
connectionProfile, | ||
|
@@ -235,8 +200,12 @@ test(testCase, async (t: Test) => { | |
// constructorArgs: { Args: ["john", "99"] }, | ||
sourceFiles, | ||
ccName: contractName, | ||
targetOrganizations: [org1Env, org2Env], | ||
caFile: `${orgCfgDir}ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem`, | ||
targetOrganizations: [ | ||
FABRIC_25_LTS_FABRIC_SAMPLES_ENV_INFO_ORG_1, | ||
FABRIC_25_LTS_FABRIC_SAMPLES_ENV_INFO_ORG_2, | ||
], | ||
caFile: | ||
FABRIC_25_LTS_FABRIC_SAMPLES_ENV_INFO_ORG_1.ORDERER_TLS_ROOTCERT_FILE, | ||
ccLabel: "basic-asset-transfer-2", | ||
ccLang: ChainCodeProgrammingLanguage.Javascript, | ||
ccSequence: 1, | ||
|
@@ -282,13 +251,6 @@ test(testCase, async (t: Test) => { | |
Checks.truthy(packaging, `packaging truthy OK`); | ||
Checks.truthy(queryCommitted, `queryCommitted truthy OK`); | ||
|
||
// FIXME - without this wait it randomly fails with an error claiming that | ||
// the endorsement was impossible to be obtained. The fabric-samples script | ||
// does the same thing, it just waits 10 seconds for good measure so there | ||
// might not be a way for us to avoid doing this, but if there is a way we | ||
// absolutely should not have timeouts like this, anywhere... | ||
await new Promise((resolve) => setTimeout(resolve, 30000)); | ||
|
||
const assetId = uuidv4(); | ||
const assetOwner = uuidv4(); | ||
|
||
|
Oops, something went wrong.