Skip to content
This repository has been archived by the owner on Mar 30, 2018. It is now read-only.

Fix Issue #809 - Add Error Logging for Development Chaincode #2190

Merged
merged 6 commits into from
Jul 26, 2016

Conversation

juliancarrivick-ibm
Copy link
Contributor

@juliancarrivick-ibm juliancarrivick-ibm commented Jul 13, 2016

Description

Add Error message when a user attempts an action other than deploy when they are running their own chaincode and in Developer Mode

Motivation and Context

Fixes #809
The existing log messages were misleading for developers when they forgot to deploy chaincode before invoking or querying. This will flag that situation in the logs.

How Has This Been Tested?

I have manually verified that an error message is generated when invoke is called on Chaincode that has not been deployed yet:

07:05:49.481 [chaincode] Launch -> DEBU 053 Container not in READY state(established)...send init/ready
07:05:49.483 [chaincode] Launch -> ERRO 054 You are attempting to perform an action other than Deploy on Chaincode that is not ready and you are in developer mode. Did you forget to Deploy your chaincode?

Unit testing this change looks overwhelming given the size of the function this is in and the lack of a mocking framework (not to mention the lack of any tests for this file at all). I am willing to try and get something in place if it is essential, otherwise I suggest testing this file should be done in another pull request.

Checklist:

  • I have added a Signed-off-by.
  • I have either added documentation to cover my changes or this change requires no new documentation.
  • I have either added unit tests to cover my changes or this change requires no new tests.
  • I have run golint and have fixed valid warnings in code I have added or modified. This tool generates false positives so you may choose to ignore some warnings. The goal is clean, consistent, and readable code.

Signed-off-by: Julian Carrivick [email protected]

Add Error message when a user attempts an action other than deploy when they are running their own chaincode and in Developer Mode
@dco-bot
Copy link

dco-bot commented Jul 13, 2016

Hi juliancarrivick-ibm,

Thanks for submitting this pull request!

I can confirm that the DCO1.1 sign-off has been included. It is okay to process this pull request.

dco-bot

@gabre
Copy link
Contributor

gabre commented Jul 13, 2016

Is it possible to write a bdd test for this? It would be cool. E.g. searching the peer output for an error message like this when one has no chain code deployed.

@juliancarrivick-ibm
Copy link
Contributor Author

@gabre I'll give it a shot :)

@juliancarrivick-ibm
Copy link
Contributor Author

I'm not going to finish this today (I've had to learn all about the wonderful world of Behaviour Driven Tests). I'm also away until next Tuesday. I'll push what I've done so far (written the tests, need to implement the logic) and hopefully finish it on Tuesday.

@juliancarrivick-ibm juliancarrivick-ibm changed the title Fix Issue #809 - Add Error Logging for Development Chaincode [WIP] Fix Issue #809 - Add Error Logging for Development Chaincode Jul 19, 2016
…r final 2 tests

Implemented deploy chaincode by name in BDD step

Move other deploy steps to use refactored deploy code

Refactored test util to be able to return full container name from peer name

Log checking implemented, need to tweak logic to make tests pass

Ensure first 2 logging tests pass
@juliancarrivick-ibm juliancarrivick-ibm force-pushed the issue-809 branch 16 times, most recently from 31ddeb3 to 2fa55a8 Compare July 21, 2016 02:40
@juliancarrivick-ibm juliancarrivick-ibm changed the title [WIP] Fix Issue #809 - Add Error Logging for Development Chaincode Fix Issue #809 - Add Error Logging for Development Chaincode Jul 21, 2016
@juliancarrivick-ibm
Copy link
Contributor Author

Ready to be looked at, please note also incorporates changes from #2267 so that new tests will run.

@srderson
Copy link
Contributor

LGTM, thanks!

@srderson srderson merged commit 08c2d2a into hyperledger-archives:master Jul 26, 2016
@juliancarrivick-ibm juliancarrivick-ibm deleted the issue-809 branch July 26, 2016 02:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

"Container not in READY state" message not clear
4 participants