1
0
mirror of https://github.com/bigchaindb/bigchaindb.git synced 2024-06-30 05:32:01 +02:00
bigchaindb/proposals/integration-test-cases.md

103 lines
3.7 KiB
Markdown
Raw Normal View History

2017-12-13 13:33:03 +01:00
# Integration test case suggestions
2017-12-18 17:03:14 +01:00
This document gives an overview of possible integration test cases, provides some useful links and a specification how to write the Python `docstring` for a test case.
2017-12-13 13:33:03 +01:00
## Useful links
2017-12-18 17:03:14 +01:00
- testing advice by [bitcoin](https://github.com/bitcoin/bitcoin/tree/master/test/functional#general-test-writing-advice)
- [tendermint](https://github.com/tendermint/tendermint/tree/master/test) integration tests
2017-12-13 13:33:03 +01:00
## How to structure a test scenario
2017-12-18 17:03:14 +01:00
The following serves as a structure to describe the tests. Each integration test should contain this description in the docstring.
2017-12-13 13:33:03 +01:00
| Keyword | Description |
|-----------------------|---------------------------|
| Name | Name of the test |
| Startup State | Required base settings |
| Test Description | Steps to be executed |
| Output Specification | Expected output |
2017-12-18 17:03:14 +01:00
### Startup State
2017-12-13 13:33:03 +01:00
The startup state specifies the system at the beginning of a test. Some questions that need to be answered:
- How many nodes will be running?
- What is the state of each node?
- Are there any faulty nodes?
- Is there any initial data setup?
- e.g. are there existing transactions?
2017-12-18 17:03:14 +01:00
### Test description
2017-12-13 13:33:03 +01:00
Write down the steps that are executed during the tests.
2017-12-18 17:03:14 +01:00
### Output Specification
2017-12-13 13:33:03 +01:00
This specification describes the state of the system at the end of the test. The questions in the startup state can be used.
2017-12-18 17:03:14 +01:00
### Example Docstring
```
def test_node_count(some_args):
"""
Name: Test Node Count
Startup State: None
Test Description: Start the system with 4 Nodes
Output Specification: Every node has N-1 other peers
"""
```
2017-12-13 13:33:03 +01:00
## Scenario groups and test case suggestions
2017-12-18 17:03:14 +01:00
### Starting
2017-12-13 13:33:03 +01:00
- start n nodes, all are visible -> assert everyone has N-1 other peers
- start n nodes, one crashes, node count changes
- start nodes with different versions of bdb
2017-12-18 17:03:14 +01:00
### Syncing
2017-12-13 13:33:03 +01:00
- start n nodes, get sync, all have the same
- start n nodes, different sync, bft ok
- start n nodes, different sync, bft fails
- start n nodes, give initial blockchain and check if everyone has the correct status
- start n nodes, give initial blockchain, some faulty nodes, check status
- start n nodes, how long should sync take (timeout?)
2017-12-18 17:03:14 +01:00
### Crash nodes
2017-12-13 13:33:03 +01:00
- start n nodes, ones freezes, what is supposed to happen?
- start n nodes, one crashes, comes up, correct sync
- start n nodes, crash all, come up, correct status
2017-12-18 17:03:14 +01:00
### Crash components
2017-12-13 13:33:03 +01:00
- start n nodes, mongodb crashes
- start n nodes, tendermint crashes
- start n nodes, bigchain crashes
- start n nodes, connection crashes
- what else can crash?
- possible crash times
- on startup
- when running and nodes are synced
- on sync
- on send tx
- on new block
- on vote
2017-12-18 17:03:14 +01:00
### System settings
2017-12-13 13:33:03 +01:00
- start n nodes, have different times in nodes (timestamps)
- clock drifting (timejacking)
- start n nodes, have one key not in the keyring
2017-12-18 17:03:14 +01:00
### Transactions
2017-12-13 13:33:03 +01:00
- start n nodes, one sends tx, sync
- start n nodes, n nodes send a tx, sync
- start n nodes, one tries to double spend
- start n nodes, one sends tx, new node up, sees tx
- start n nodes, one sends divisible tx for two other nodes
2017-12-18 17:03:14 +01:00
### Validation
2017-12-13 13:33:03 +01:00
- start n nodes, check app hash
- start n nodes, check app hash, one crashes, gets up, check hash
- nodes validate tx
2017-12-18 17:03:14 +01:00
### Voting
2017-12-13 13:33:03 +01:00
- n nodes vote, bft scenarios
2017-12-18 17:03:14 +01:00
### Blocks
2017-12-13 13:33:03 +01:00
- start n nodes, one creates a block
- start n nodes, check block height, new block, check block height
- have an invalid block (new block, wrong hash?)
- have block bigger than max size
2017-12-18 17:03:14 +01:00
### Query
2017-12-13 13:33:03 +01:00
- start n nodes, let all query for the same block
- query tx
2017-12-18 17:03:14 +01:00
### Malicious nodes
2017-12-13 13:33:03 +01:00
- start n nodes, one manipulates the blockchain
2017-12-18 17:15:01 +01:00
### Events
2017-12-13 13:33:03 +01:00
- start n nodes, let one check for event stream of another