forked from iotaledger/iri
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include Additional API Tests (iotaledger#45)
* Update gitignore, fix key order for gtta * added getInclusionStates test * Added getBalances test * Added wereAddressesSpentFrom test * Replaced add/remove neighbor test * Improve dynamic api call step * Remove unused test steps * Restructure api call args and features * Refactor inclusion state test * Moved argument preparation to util functions * Added attach/store/find transaction api test * Refactored with new type for api args * Added checkConsistency test * Added interruptAttachToTangle test * Changed static values, removed unnecessary logging * Changed static value for inclusion test * Change host and port pull for neighboring * Remove machine2 duplicate api tests * Fix indentation in machine1 feature * Changed api utility input name * Replaced non behavioural steps for interrupt test * Added comparison utility for api test calls * Added expected response for inclusion test * Added expected balance for getBalance test * Added docstring for check neighbors method * Add bool argument type for test arg lists * Replaced step syntax for threading with parallel * Add description for inconsistent transaction
- Loading branch information
1 parent
7bb4e81
commit 9ca26fc
Showing
8 changed files
with
513 additions
and
247 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,3 +105,6 @@ venv.bak/ | |
|
||
# pyc files | ||
*.pyc | ||
|
||
#Metafiles | ||
.metadata/ |
259 changes: 197 additions & 62 deletions
259
PythonRegression/tests/features/machine1/1_api_tests.feature
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,93 +1,228 @@ | ||
Feature: Test API calls on Machine 1 | ||
Test various api calls to make sure they are responding | ||
correctly | ||
correctly. | ||
|
||
Scenario: GetNodeInfo is called | ||
Given "getNodeInfo" is called on "nodeA" | ||
|
||
#All api calls will be formatted as following, any arguments should be | ||
#listed below the call in table format | ||
#Example: | ||
# "<Api Call name here>" is called on "<insert node name here>" with: | ||
#|keys |values |type | | ||
#|<arg key> |<arg val> |<arg type> | | ||
# | ||
#See tests/features/steps/api_test_steps.py for further details | ||
# | ||
|
||
Given "getNodeInfo" is called on "nodeA" with: | ||
|keys |values |type | | ||
|
||
Then a response with the following is returned: | ||
|keys | | ||
|appName | | ||
|appVersion | | ||
|duration | | ||
|keys | | ||
|appName | | ||
|appVersion | | ||
|duration | | ||
|jreAvailableProcessors | | ||
|jreFreeMemory | | ||
|jreMaxMemory | | ||
|jreTotalMemory | | ||
|jreVersion | | ||
|latestMilestone | | ||
|jreFreeMemory | | ||
|jreMaxMemory | | ||
|jreTotalMemory | | ||
|jreVersion | | ||
|latestMilestone | | ||
|latestMilestoneIndex | | ||
|latestSolidSubtangleMilestone | | ||
|latestSolidSubtangleMilestoneIndex | | ||
|latestSolidSubtangleMilestone | | ||
|latestSolidSubtangleMilestoneIndex | | ||
|milestoneStartIndex | | ||
|neighbors | | ||
|packetsQueueSize | | ||
|time | | ||
|tips | | ||
|neighbors | | ||
|packetsQueueSize | | ||
|time | | ||
|tips | | ||
|transactionsToRequest | | ||
|
||
|
||
Scenario: GetNeighbors is called | ||
Given "getNeighbors" is called on "nodeA" | ||
Given "getNeighbors" is called on "nodeA" with: | ||
|keys |values |type | | ||
|
||
Then a response with the following is returned: | ||
|keys | | ||
|address | | ||
|keys | | ||
|address | | ||
|numberOfAllTransactions | | ||
|numberOfAllTransactionRequests | | ||
|numberOfAllTransactionRequests | | ||
|numberOfNewTransactions | | ||
|numberOfInvalidTransactions | | ||
|numberOfInvalidTransactions | | ||
|numberOfSentTransactions | | ||
|connectionType | | ||
|
||
|
||
|connectionType | | ||
|
||
|
||
Scenario: Add and Remove Neighbors | ||
Adds nodeB as a neighbor to nodeA, and then removes it. | ||
|
||
Given "addNeighbors" is called on "nodeA" with: | ||
|keys |values |type | | ||
|uris |nodeB |nodeAddress | | ||
|
||
Then a response with the following is returned: | ||
|keys | | ||
|addedNeighbors | | ||
|duration | | ||
|
||
|
||
When "removeNeighbors" is called on "nodeA" with: | ||
|keys |values |type | | ||
|uris |nodeB |nodeAddress | | ||
|
||
|
||
Then a response with the following is returned: | ||
|keys | | ||
|duration | | ||
|removedNeighbors | | ||
|
||
|
||
Scenario: GetTips is called | ||
Given "getTips" is called on "nodeA" | ||
Given "getTips" is called on "nodeA" with: | ||
|keys |values |type | | ||
|
||
Then a response with the following is returned: | ||
|keys | | ||
|hashes | | ||
|duration | | ||
|keys | | ||
|hashes | | ||
|duration | | ||
|
||
|
||
Scenario Outline: GetTrytes is called | ||
|
||
|
||
#Values can be found in util/static_vals.py | ||
Scenario Outline: GetTrytes is called | ||
Given getTrytes is called with the hash <hash> | ||
Then the response should be equal to <trytes> | ||
|
||
Examples: | ||
|hash | trytes | | ||
|TEST_HASH | TEST_TRYTES | | ||
|
||
|
||
|hash |trytes | | ||
|TEST_HASH |TEST_TRYTES | | ||
|
||
|
||
|
||
Scenario: GetTransactionsToApprove is called | ||
Given "getTransactionsToApprove" is called on "nodeA" | ||
Given "getTransactionsToApprove" is called on "nodeA" with: | ||
|keys |values |type | | ||
|depth |3 |int | | ||
|
||
Then a response with the following is returned: | ||
|keys | | ||
|trunkTransaction | | ||
|branchTransaction | | ||
|duration | | ||
|keys | | ||
|branchTransaction | | ||
|duration | | ||
|trunkTransaction | | ||
|
||
|
||
### | ||
# To be replaced with a new neighbor test linking nodes within a given topology together | ||
### | ||
# @neighbors | ||
# Scenario: Add and remove Neighbors | ||
# Given 2 neighbors are added with "addNeighbors" on "nodeA" | ||
# When "getNeighbors" is called, it should return the following neighbors: | ||
# |neighbors | | ||
# |178.128.236.6:14600 | | ||
# |167.99.178.3:14600 | | ||
# Then "removeNeighbors" will be called to remove the same neighbors | ||
# And "getNeighbors" should not return the following neighbors: | ||
# |neighbors | | ||
# |178.128.236.6:14600 | | ||
# |167.99.178.3:14600 | | ||
Scenario: CheckConsistency is called | ||
Given "checkConsistency" is called on "nodeA" with: | ||
|keys |values |type | | ||
|tails |TEST_HASH |staticList | | ||
|
||
Then the response for "checkConsistency" should return with: | ||
|keys |values |type | | ||
|state |True |bool | | ||
|
||
When an inconsistent transaction is generated on "nodeA" | ||
|
||
And "checkConsistency" is called on "nodeA" with: | ||
|keys |values |type | | ||
|tails |inconsistentTransactions |responseList | | ||
|
||
Then the response for "checkConsistency" should return with: | ||
|keys |values |type | | ||
|state |False |bool | | ||
|
||
|
||
|
||
#Values can be found in util/static_vals.py | ||
Scenario: GetInclusionStates is called | ||
Given "getInclusionStates" is called on "nodeA" with: | ||
|keys |values |type | | ||
|transactions |TEST_HASH |staticList | | ||
|tips |TEST_TIP_LIST |staticValue | | ||
|
||
Then the response for "getInclusionStates" should return with: | ||
|keys |values |type | | ||
|states |False |bool | | ||
|
||
|
||
#Address can be found in util/static_vals.py | ||
Scenario: GetBalances is called | ||
Given "getBalances" is called on "nodeA" with: | ||
|keys |values |type | | ||
|addresses |TEST_EMPTY_ADDRESS |staticList | | ||
|threshold |100 |int | | ||
|
||
Then the response for "getBalances" should return with: | ||
|keys |values |type | | ||
|balances |0 |int | | ||
|
||
|
||
Scenario: Interrupt attach to tangle | ||
Begins attaching a transaction to the tangle with a high MWM, then issues an interrupt to the node | ||
If the interrupt is successful, the attachToTangle response will return a null tryte list | ||
|
||
Given "attachToTangle" is called in parallel on "nodeA" with: | ||
|keys |values |type | | ||
|trytes |EMPTY_TRANSACTION_TRYTES|staticList | | ||
|trunk_transaction |TEST_HASH |staticValue | | ||
|branch_transaction |TEST_HASH |staticValue | | ||
|min_weight_magnitude |50 |int | | ||
|
||
And "interruptAttachingToTangle" is called in parallel on "nodeA" with: | ||
|keys |values |type | | ||
|
||
# Do not include duration in the return expectations as it will always return a variable amount | ||
Then the "attachToTangle" parallel call should return with: | ||
|keys |values |type | | ||
|trytes |NULL_LIST |staticValue | | ||
|
||
|
||
|
||
Scenario: WereAddressesSpentFrom is called | ||
Given "wereAddressesSpentFrom" is called on "nodeA" with: | ||
|keys |values |type | | ||
|addresses |TEST_EMPTY_ADDRESS |staticList | | ||
|
||
Then a response with the following is returned: | ||
|keys | | ||
|duration | | ||
|states | | ||
|
||
|
||
|
||
Scenario: Create, attach, store and find a transaction | ||
Generate a transaction, attach it to the tangle, and store it locally. Then find | ||
that transaction via its address. | ||
|
||
Given a transaction is generated and attached on "nodeA" with: | ||
|keys |values |type | | ||
|address |TEST_STORE_ADDRESS |staticValue | | ||
|value |0 |int | | ||
|
||
Then a response with the following is returned: | ||
|keys | | ||
|trytes | | ||
|
||
When "storeTransactions" is called on "nodeA" with: | ||
|keys |values |type | | ||
|trytes |TEST_STORE_TRANSACTION |staticValue | | ||
|
||
And "findTransactions" is called on "nodeA" with: | ||
|keys |values |type | | ||
|addresses |TEST_STORE_ADDRESS |staticList | | ||
|
||
Then a response with the following is returned: | ||
|keys | | ||
|hashes | | ||
|
||
|
||
|
||
Scenario: Broadcast a test transacion | ||
Send a test transaction from one node in a machine, and find that transaction | ||
Send a test transaction from one node in a machine with a unique tag, and find that transaction | ||
through a different node in the same machine | ||
|
||
Given "nodeA" and "nodeB" are neighbors | ||
When a transaction with the tag "TEST9TRANSACTION" is sent from "nodeA" | ||
Given "nodeA" and "nodeB" are neighbors | ||
When a transaction with the tag "TEST9TAG9ONE" is sent from "nodeA" | ||
And findTransaction is called with the same tag on "nodeB" | ||
Then the transaction should be found | ||
|
64 changes: 0 additions & 64 deletions
64
PythonRegression/tests/features/machine2/2_api_tests.feature
This file was deleted.
Oops, something went wrong.
Empty file.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.