-
Notifications
You must be signed in to change notification settings - Fork 130
Nc 1145 Acceptance test for getTransactionReceipt JSON-RPC method #278
Conversation
…NC-1145 # Conflicts: # acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/eth/EthTransactions.java
public void mustCorrectlyQueryTransactionReceiptFromContractCreationTransaction() { | ||
final Hash transactionHash = minerNode.execute(transactions.createTransfer(recipient, 5)); | ||
cluster.verify(recipient.balanceEquals(5)); | ||
minerNode.verify(eth.getTransactionReceipt(transactionHash.toString())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Naming-wise this would probably be better as:
minerNode.verify(eth.transactionReceiptIsAvailable(transactionHash))
You shouldn't need to call toString()
in the test - the DSL should accept the actual Hash and convert to a string itself if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renamed and moved toString() into DSL
public void mustReturnNullWhenTransactionDoesNotExist() { | ||
minerNode.verify( | ||
eth.getTransactionReceiptNull( | ||
"0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably would be better as minerNode.verify(eth.transactionReceiptNotAvailable("..."))
. Using a string here is probably sensible since the test is simpler that way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renamed test to be more succinct
|
||
import org.web3j.protocol.core.methods.response.TransactionReceipt; | ||
|
||
public class SanityCheckEthGetTransactionReceiptValues implements Condition { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't doing any sanity checking - just checking it's present so probably should just be ExpectEthGetTransactionReceiptPresent
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renamed
return new SanityCheckEthGetTransactionReceiptValues(transactions.getTransactionReceipt(param)); | ||
} | ||
|
||
public Condition getTransactionReceiptNull(final String param) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
param
should have a meaningful name - maybe transactionHash
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renamed
.../pegasys/pantheon/tests/acceptance/dsl/condition/eth/ExpectEthGetTransactionRecieptNull.java
Outdated
Show resolved
Hide resolved
acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Eth.java
Outdated
Show resolved
Hide resolved
...a/tech/pegasys/pantheon/tests/acceptance/jsonrpc/EthGetTransactionReceiptAcceptanceTest.java
Show resolved
Hide resolved
...a/tech/pegasys/pantheon/tests/acceptance/jsonrpc/EthGetTransactionReceiptAcceptanceTest.java
Outdated
Show resolved
Hide resolved
...a/tech/pegasys/pantheon/tests/acceptance/jsonrpc/EthGetTransactionReceiptAcceptanceTest.java
Outdated
Show resolved
Hide resolved
Deleted obsolete test cases added assertion for status code
Deleted obsolete test cases added assertion for status code
# Conflicts: # acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/jsonrpc/EthGetTransactionReceiptAcceptanceTest.java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PR description
Write acceptance test for JSON-RPC method getTransaction Receipt.
Test only attempt to test the method to retrieve the transaction receipt given the transaction hash.
The correctness of the receipt (e.g sender's address, recipient address, gas cost) is not tested here.
Fixed Issue(s)
https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionreceipt