Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(connector-fabric-socketio): add functional test, bug fix #1976

Closed
outSH opened this issue Apr 15, 2022 · 0 comments · Fixed by #1977
Closed

test(connector-fabric-socketio): add functional test, bug fix #1976

outSH opened this issue Apr 15, 2022 · 0 comments · Fixed by #1977
Labels
enhancement New feature or request

Comments

@outSH
Copy link
Contributor

outSH commented Apr 15, 2022

Add a functional test to connector-fabric-socketio so it's operations can be checked in CI. Refactor the connector to improve testability, fix any bugs that are revealed by the tests.

@outSH outSH added the enhancement New feature or request label Apr 15, 2022
outSH added a commit to outSH/cactus that referenced this issue Apr 15, 2022
Added functional jest test fabric-socketio-connector.test that can be run during CI process.
It checks evaluate/sending transactions and monitoring for new events.
Connector had to be refactored to be testable,
tests also discovered some bugs that had to be fixed in order to pass.

SocketIOApiClient refactors:
- Added option for supplying validatorKeyValue instead of validatorKeyPath.
- JWT validation function works with key value now (instead of reading the key).
- Validator can now return messages that are not encrypted (it throwed error previously).
- Adjusted unit tests.

connector-fabric-socketio refactors:
- Connector can be run both as a standalone app and loaded as a module (www.js file).
  Caller can use exported startFabricSocketIOConnector function to run the connector.
  Configuration must be supplied in file or in env variable like it's done in functional test.
- All cryptographic data (keys, certificates, etc…) can now be supplied as a value
  (previously it supported only path to a file).
- sendSignedTransaction can now be called synchronously (it had wrong response format before).
- Fixed a bug introduced during my last changes in this component,
  which caused fabric-client session to be disconnected but still reused by follow-up requests.
  I didn't know that gateway disconnects client it operates on.
- Increased JWT expiration to 15 minutes to prevent constant JWT expiration error
  (I'm pretty sure 15 minutes is still secure period).
- Minor improvements (logging, formatting, etc…)

fabric-test-ledger-v1 changes:
- Added adminCredentials to have programatic access to admin credentials on currently used ledger
 (unlikely, but can change in the future).

Depends on: hyperledger-cacti#1975

Closes: hyperledger-cacti#1976

Signed-off-by: Michal Bajer <[email protected]>
outSH added a commit to outSH/cactus that referenced this issue Apr 19, 2022
Added functional jest test fabric-socketio-connector.test that can be run during CI process.
It checks evaluate/sending transactions and monitoring for new events.
Connector had to be refactored to be testable,
tests also discovered some bugs that had to be fixed in order to pass.

SocketIOApiClient refactors:
- Added option for supplying validatorKeyValue instead of validatorKeyPath.
- JWT validation function works with key value now (instead of reading the key).
- Validator can now return messages that are not encrypted (it throwed error previously).
- Adjusted unit tests.

connector-fabric-socketio refactors:
- Connector can be run both as a standalone app and loaded as a module (www.js file).
  Caller can use exported startFabricSocketIOConnector function to run the connector.
  Configuration must be supplied in file or in env variable like it's done in functional test.
- All cryptographic data (keys, certificates, etc…) can now be supplied as a value
  (previously it supported only path to a file).
- sendSignedTransaction can now be called synchronously (it had wrong response format before).
- Fixed a bug introduced during my last changes in this component,
  which caused fabric-client session to be disconnected but still reused by follow-up requests.
  I didn't know that gateway disconnects client it operates on.
- Increased JWT expiration to 15 minutes to prevent constant JWT expiration error
  (I'm pretty sure 15 minutes is still secure period).
- Minor improvements (logging, formatting, etc…)

fabric-test-ledger-v1 changes:
- Added adminCredentials to have programatic access to admin credentials on currently used ledger
 (unlikely, but can change in the future).

Depends on: hyperledger-cacti#1975

Closes: hyperledger-cacti#1976

Signed-off-by: Michal Bajer <[email protected]>
outSH added a commit to outSH/cactus that referenced this issue May 11, 2022
Added functional jest test fabric-socketio-connector.test that can be run during CI process.
It checks evaluate/sending transactions and monitoring for new events.
Connector had to be refactored to be testable,
tests also discovered some bugs that had to be fixed in order to pass.

SocketIOApiClient refactors:
- Added option for supplying validatorKeyValue instead of validatorKeyPath.
- JWT validation function works with key value now (instead of reading the key).
- Validator can now return messages that are not encrypted (it throwed error previously).
- Adjusted unit tests.

connector-fabric-socketio refactors:
- Connector can be run both as a standalone app and loaded as a module (www.js file).
  Caller can use exported startFabricSocketIOConnector function to run the connector.
  Configuration must be supplied in file or in env variable like it's done in functional test.
- All cryptographic data (keys, certificates, etc…) can now be supplied as a value
  (previously it supported only path to a file).
- sendSignedTransaction can now be called synchronously (it had wrong response format before).
- Fixed a bug introduced during my last changes in this component,
  which caused fabric-client session to be disconnected but still reused by follow-up requests.
  I didn't know that gateway disconnects client it operates on.
- Increased JWT expiration to 15 minutes to prevent constant JWT expiration error
  (I'm pretty sure 15 minutes is still secure period).
- Minor improvements (logging, formatting, etc…)

fabric-test-ledger-v1 changes:
- Added adminCredentials to have programatic access to admin credentials on currently used ledger
 (unlikely, but can change in the future).

Depends on: hyperledger-cacti#1975

Closes: hyperledger-cacti#1976

Signed-off-by: Michal Bajer <[email protected]>
outSH added a commit to outSH/cactus that referenced this issue May 19, 2022
Added functional jest test fabric-socketio-connector.test that can be run during CI process.
It checks evaluate/sending transactions and monitoring for new events.
Connector had to be refactored to be testable,
tests also discovered some bugs that had to be fixed in order to pass.

SocketIOApiClient refactors:
- Added option for supplying validatorKeyValue instead of validatorKeyPath.
- JWT validation function works with key value now (instead of reading the key).
- Validator can now return messages that are not encrypted (it throwed error previously).
- Adjusted unit tests.

connector-fabric-socketio refactors:
- Connector can be run both as a standalone app and loaded as a module (www.js file).
  Caller can use exported startFabricSocketIOConnector function to run the connector.
  Configuration must be supplied in file or in env variable like it's done in functional test.
- All cryptographic data (keys, certificates, etc…) can now be supplied as a value
  (previously it supported only path to a file).
- sendSignedTransaction can now be called synchronously (it had wrong response format before).
- Fixed a bug introduced during my last changes in this component,
  which caused fabric-client session to be disconnected but still reused by follow-up requests.
  I didn't know that gateway disconnects client it operates on.
- Increased JWT expiration to 15 minutes to prevent constant JWT expiration error
  (I'm pretty sure 15 minutes is still secure period).
- Minor improvements (logging, formatting, etc…)

fabric-test-ledger-v1 changes:
- Added adminCredentials to have programatic access to admin credentials on currently used ledger
 (unlikely, but can change in the future).

Depends on: hyperledger-cacti#1975

Closes: hyperledger-cacti#1976

Signed-off-by: Michal Bajer <[email protected]>
outSH added a commit to outSH/cactus that referenced this issue May 27, 2022
Added functional jest test fabric-socketio-connector.test that can be run during CI process.
It checks evaluate/sending transactions and monitoring for new events.
Connector had to be refactored to be testable,
tests also discovered some bugs that had to be fixed in order to pass.

SocketIOApiClient refactors:
- Added option for supplying validatorKeyValue instead of validatorKeyPath.
- JWT validation function works with key value now (instead of reading the key).
- Validator can now return messages that are not encrypted (it throwed error previously).
- Adjusted unit tests.

connector-fabric-socketio refactors:
- Connector can be run both as a standalone app and loaded as a module (www.js file).
  Caller can use exported startFabricSocketIOConnector function to run the connector.
  Configuration must be supplied in file or in env variable like it's done in functional test.
- All cryptographic data (keys, certificates, etc…) can now be supplied as a value
  (previously it supported only path to a file).
- sendSignedTransaction can now be called synchronously (it had wrong response format before).
- Fixed a bug introduced during my last changes in this component,
  which caused fabric-client session to be disconnected but still reused by follow-up requests.
  I didn't know that gateway disconnects client it operates on.
- Increased JWT expiration to 15 minutes to prevent constant JWT expiration error
  (I'm pretty sure 15 minutes is still secure period).
- Minor improvements (logging, formatting, etc…)

fabric-test-ledger-v1 changes:
- Added adminCredentials to have programatic access to admin credentials on currently used ledger
 (unlikely, but can change in the future).

Depends on: hyperledger-cacti#1975

Closes: hyperledger-cacti#1976

Signed-off-by: Michal Bajer <[email protected]>
petermetz pushed a commit that referenced this issue May 28, 2022
Added functional jest test fabric-socketio-connector.test that can be run during CI process.
It checks evaluate/sending transactions and monitoring for new events.
Connector had to be refactored to be testable,
tests also discovered some bugs that had to be fixed in order to pass.

SocketIOApiClient refactors:
- Added option for supplying validatorKeyValue instead of validatorKeyPath.
- JWT validation function works with key value now (instead of reading the key).
- Validator can now return messages that are not encrypted (it throwed error previously).
- Adjusted unit tests.

connector-fabric-socketio refactors:
- Connector can be run both as a standalone app and loaded as a module (www.js file).
  Caller can use exported startFabricSocketIOConnector function to run the connector.
  Configuration must be supplied in file or in env variable like it's done in functional test.
- All cryptographic data (keys, certificates, etc…) can now be supplied as a value
  (previously it supported only path to a file).
- sendSignedTransaction can now be called synchronously (it had wrong response format before).
- Fixed a bug introduced during my last changes in this component,
  which caused fabric-client session to be disconnected but still reused by follow-up requests.
  I didn't know that gateway disconnects client it operates on.
- Increased JWT expiration to 15 minutes to prevent constant JWT expiration error
  (I'm pretty sure 15 minutes is still secure period).
- Minor improvements (logging, formatting, etc…)

fabric-test-ledger-v1 changes:
- Added adminCredentials to have programatic access to admin credentials on currently used ledger
 (unlikely, but can change in the future).

Depends on: #1975

Closes: #1976

Signed-off-by: Michal Bajer <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant