Resolve UnhandledRejectionWarning in e2e tests#281
Merged
somniumism merged 2 commits intoCodeChain-io:masterfrom Mar 23, 2020
somniumism:modify.test
Merged
Resolve UnhandledRejectionWarning in e2e tests#281somniumism merged 2 commits intoCodeChain-io:masterfrom somniumism:modify.test
UnhandledRejectionWarning in e2e tests#281somniumism merged 2 commits intoCodeChain-io:masterfrom
somniumism:modify.test
Conversation
Contributor
Author
|
@HoOngEe I tried to check e2e tests to find other However, when I ran ran |
majecty
approved these changes
Mar 23, 2020
majecty
left a comment
There was a problem hiding this comment.
Your PR fixes the UnhandledRejectionWarning error well.
I found that the expect function to check the error message is not working.
I'll create another issue for it.
HoOngEe
approved these changes
Mar 23, 2020
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Some e2e tests are emitting
UnhandledPromiseRejectionWarning. When we run the tests, we can see the following warning:Cause
This warning message has occurred since Remove all sdk functtions from e2e tests was merged. I suspect a small mistake was made in this work of modifying the test code. Fundamentally, the reason for
UnhandledPromiseRejectionWarningoccurring is related to the process state below.In this test, the process state of the node must be
runningstate. Here the node is the object of classCodeChain. If the process state isstoppingor others,Error: CodeChain(3) process state is invalid:occurs. Some logic was misimplemented, so I assumed the state has astoppingstate.I found the problem part, which is as follows:
In normal case,
sendPayTx()should be executed andcreatePayTx()insendPayTx()sholud be executed too. In this case, however,sendPayTx()does not work because it is wrapped byexpect(). Then, another code outside the try block is executed withoutsendPayTx()andcreatePayTx()running. Interestingly, the test ends with a message that the test is completed. After the test,sendPayTx()andcreatePayTx()is run and the node with thestoppingstate fails in the following process oncreatePayTx():Since the node is not
runningstate, an error occurs withUnhandledPromiseRejectionWarningduring this process.Solution
If the problem is modified as follows, no further errors will occur.
resolved #276