diff --git a/.github/workflows/test-network-gateway.yaml b/.github/workflows/test-network-gateway.yaml index 06477397..ce49ae68 100644 --- a/.github/workflows/test-network-gateway.yaml +++ b/.github/workflows/test-network-gateway.yaml @@ -28,8 +28,8 @@ jobs: - name: Set up the test network runtime uses: ./.github/actions/test-network-setup - - name: Run Test Network Off Chain + - name: Run Test working-directory: test-network env: CHAINCODE_LANGUAGE: ${{ matrix.chaincode-language }} - run: ../ci/scripts/run-test-network-gateway.sh \ No newline at end of file + run: ../ci/scripts/run-test-network-gateway.sh diff --git a/asset-transfer-ledger-queries/application-java/src/main/java/application/java/App.java b/asset-transfer-ledger-queries/application-java/src/main/java/application/java/App.java index 5408e069..595d6f33 100644 --- a/asset-transfer-ledger-queries/application-java/src/main/java/application/java/App.java +++ b/asset-transfer-ledger-queries/application-java/src/main/java/application/java/App.java @@ -136,6 +136,7 @@ public class App { } catch(Exception e){ System.err.println(e); + System.exit(1); } } diff --git a/asset-transfer-ledger-queries/application-javascript/app.js b/asset-transfer-ledger-queries/application-javascript/app.js index f10f400f..0aa179a8 100644 --- a/asset-transfer-ledger-queries/application-javascript/app.js +++ b/asset-transfer-ledger-queries/application-javascript/app.js @@ -242,6 +242,7 @@ async function main() { } } catch (error) { console.error(`******** FAILED to run the application: ${error}`); + process.exit(1); } console.log('*** application ending'); diff --git a/asset-transfer-sbe/application-javascript/app.js b/asset-transfer-sbe/application-javascript/app.js index 47adcca5..134f4443 100644 --- a/asset-transfer-sbe/application-javascript/app.js +++ b/asset-transfer-sbe/application-javascript/app.js @@ -192,6 +192,7 @@ async function main() { console.log('*** Result: committed, now asset will only require Org1 to endorse'); } catch (createError) { console.log(`*** Failed: create - ${createError}`); + process.exit(1); } await readAssetByBothOrgs(assetKey, 100, org1, contractOrg1, contractOrg2); @@ -207,6 +208,7 @@ async function main() { console.log('*** Result: committed'); } catch (updateError) { console.log(`*** Failed: update - ${updateError}`); + process.exit(1); } await readAssetByBothOrgs(assetKey, 200, org1, contractOrg1, contractOrg2); @@ -223,6 +225,7 @@ async function main() { console.log('*** Result: committed - because Org1 and Org2 both endorsed, while only the Org1 endorsement was required and checked'); } catch (updateError) { console.log(`*** Failed: update - ${updateError}`); + process.exit(1); } await readAssetByBothOrgs(assetKey, 300, org1, contractOrg1, contractOrg2); @@ -236,6 +239,7 @@ async function main() { console.log('*** Result: committed - because Org1 was on the discovery list, Org2 did not endorse'); } catch (updateError) { console.log(`*** Failed: update - ${updateError}`); + process.exit(1); } await readAssetByBothOrgs(assetKey, 400, org1, contractOrg1, contractOrg2); @@ -263,6 +267,7 @@ async function main() { console.log('*** Result: committed'); } catch (transferError) { console.log(`*** Failed: transfer - ${transferError}`); + process.exit(1); } await readAssetByBothOrgs(assetKey, 400, org2, contractOrg1, contractOrg2); @@ -277,6 +282,7 @@ async function main() { console.log('*** Result: committed'); } catch (updateError) { console.log(`*** Failed: update - ${updateError}`); + process.exit(1); } await readAssetByBothOrgs(assetKey, 600, org2, contractOrg1, contractOrg2); @@ -317,6 +323,7 @@ async function main() { console.log('*** Result: committed'); } catch (deleteError) { console.log(`*** Failed: delete - ${deleteError}`); + process.exit(1); } // The asset should now be deleted, both orgs should not be able to read it diff --git a/asset-transfer-secured-agreement/application-gateway-typescript/src/app.ts b/asset-transfer-secured-agreement/application-gateway-typescript/src/app.ts index a9fd6365..ff68bd96 100644 --- a/asset-transfer-secured-agreement/application-gateway-typescript/src/app.ts +++ b/asset-transfer-secured-agreement/application-gateway-typescript/src/app.ts @@ -73,7 +73,7 @@ async function main(): Promise { try { await contractWrapperOrg2.getAssetPrivateProperties(assetKey, mspIdOrg1); } catch(e) { - console.log(`${RED}*** Failed: getAssetPrivateProperties - ${e}${RESET}`); + console.log(`${RED}*** Successfully caught the failure: getAssetPrivateProperties - ${e}${RESET}`); } // Org1 updates the assets public description. @@ -94,7 +94,7 @@ async function main(): Promise { ownerOrg: mspIdOrg1, publicDescription: `Asset ${assetKey} owned by ${mspIdOrg2} is NOT for sale`}); } catch(e) { - console.log(`${RED}*** Failed: changePublicDescription - ${e}${RESET}`); + console.log(`${RED}*** Successfully caught the failure: changePublicDescription - ${e}${RESET}`); } // Read the public details by org1. @@ -126,14 +126,14 @@ async function main(): Promise { try{ await contractWrapperOrg2.getAssetSalesPrice(assetKey, mspIdOrg1); } catch(e) { - console.log(`${RED}*** Failed: getAssetSalesPrice - ${e}${RESET}`); + console.log(`${RED}*** Successfully caught the failure: getAssetSalesPrice - ${e}${RESET}`); } // Org1 has not agreed to buy so this should fail. try{ await contractWrapperOrg1.getAssetBidPrice(assetKey, mspIdOrg2); } catch(e) { - console.log(`${RED}*** Failed: getAssetBidPrice - ${e}${RESET}`); + console.log(`${RED}*** Successfully caught the failure: getAssetBidPrice - ${e}${RESET}`); } // Org2 should be able to see the price it has agreed. await contractWrapperOrg2.getAssetBidPrice(assetKey, mspIdOrg2); @@ -143,7 +143,7 @@ async function main(): Promise { try{ await contractWrapperOrg1.transferAsset({ assetId: assetKey, price: 110, tradeId: now}, [ mspIdOrg1, mspIdOrg2 ], mspIdOrg1, mspIdOrg2); } catch(e) { - console.log(`${RED}*** Failed: transferAsset - ${e}${RESET}`); + console.log(`${RED}*** Successfully caught the failure: transferAsset - ${e}${RESET}`); } // Agree to a sell by Org1, the seller will agree to the bid price of Org2. await contractWrapperOrg1.agreeToSell({assetId:assetKey, price:100, tradeId:now}); @@ -168,7 +168,7 @@ async function main(): Promise { try{ await contractWrapperOrg2.transferAsset({ assetId: assetKey, price: 100, tradeId: now}, [ mspIdOrg1, mspIdOrg2 ], mspIdOrg1, mspIdOrg2); } catch(e) { - console.log(`${RED}*** Failed: transferAsset - ${e}${RESET}`); + console.log(`${RED}*** Successfully caught the failure: transferAsset - ${e}${RESET}`); } // Org1 will transfer the asset to Org2. @@ -188,7 +188,7 @@ async function main(): Promise { try{ await contractWrapperOrg1.getAssetPrivateProperties(assetKey, mspIdOrg2); } catch(e) { - console.log(`${RED}*** Failed: getAssetPrivateProperties - ${e}${RESET}`); + console.log(`${RED}*** Successfully caught the failure: getAssetPrivateProperties - ${e}${RESET}`); } // This is an update to the public state and requires only the owner to endorse. diff --git a/hardware-security-module/application-typescript/src/hsm-sample.ts b/hardware-security-module/application-typescript/src/hsm-sample.ts index 265fe8a4..5573fb85 100644 --- a/hardware-security-module/application-typescript/src/hsm-sample.ts +++ b/hardware-security-module/application-typescript/src/hsm-sample.ts @@ -165,4 +165,7 @@ function envOrDefault(key: string, defaultValue: string): string { return process.env[key] || defaultValue; } -main().catch(console.error); +main().catch(error => { + console.error('******** FAILED to run the application:', error); + process.exitCode = 1; +});