Add check for unique chaincode names across channels
fixes : issue#228 This pull request introduces a new validation to ensure that chaincode names are unique across different channels. It includes changes to both the test suite and the core configuration extension logic.
New validation for unique chaincode names:
e2e/fabloCommands.test.ts: Added a test case to check for duplicate chaincode names across different channels, ensuring that the validation throws an error when duplicates are found.src/extend-config/extendChaincodesConfig.ts: Introduced thecheckUniqueChaincodeNamesfunction to validate that all chaincode names are unique within the provided configuration. This function is called within theextendChaincodesConfigfunction.
Integration of the new validation:
src/extend-config/extendConfig.ts: Imported thecheckUniqueChaincodeNamesfunction and integrated it into theextendConfigfunction to ensure chaincode names are checked for uniqueness during the configuration extension process.
Hi @IITI-tushar how is it going? Would you like to complete this PR?
@dzikowski Sir my exams are going on, will complete this issue in a few days.
@dzikowski
Sir I added this test case.
in the file /samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml i changed the chaincodes to be same
here's the error output
should i commit the test case??
I would suggest to update the Fablo config file on the fly in test, for instance:
const fabloConfigJson = // read and parse fablo config from file
fabloConfigJson.chaincodes[1].name = fabloConfigJson.chaincodes[0].name;
// save the file to temporary location, and then use it in tests
followed up in #596