Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adhere to new test naming convention #166

Merged
merged 5 commits into from
Sep 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ For load testing, "reasonable load" and "heavy load" will need to be defined.

The tests can be run with `cargo test` once Ziggurat is properly configured and dependencies (node instance to be tested) are satisfied. See the [README](README.md) for details.

Tests are grouped into the following categories: conformance, performance, and resistance. Each test is named after the category it belongs to, in addition to what's being tested. For example, `c001_handshake_when_node_receives_connection` is the first conformance test and tests the handshake behavior on the receiving end. The full naming convention is: `id_part_t(subtest_no)_(message type)_(extra_test_desc)`.

# Types of Tests

## Conformance
Expand Down Expand Up @@ -242,7 +244,6 @@ The test index makes use of symbolic language in describing connection and messa

The node disconnects for trivial (non-fuzz, non-malicious) cases.

- `Ping` timeout.
- `Pong` with wrong nonce.
- `GetData` with mixed types in inventory list.
- `Inv` with mixed types in inventory list.
Expand Down
4 changes: 2 additions & 2 deletions src/tests/conformance/handshake/complete_handshake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::{
};

#[tokio::test]
async fn when_node_receives_connection() {
async fn c001_handshake_when_node_receives_connection() {
// ZG-CONFORMANCE-001

// Spin up a node instance.
Expand Down Expand Up @@ -34,7 +34,7 @@ async fn when_node_receives_connection() {
}

#[tokio::test]
async fn when_node_initiates_connection() {
async fn c002_handshake_when_node_initiates_connection() {
// ZG-CONFORMANCE-002

// Create a synthetic node and enable handshaking.
Expand Down
66 changes: 44 additions & 22 deletions src/tests/conformance/handshake/ignore_message_inplace_of_verack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,24 @@ mod when_node_receives_connection {
use super::*;

#[tokio::test]
async fn get_addr() {
#[allow(non_snake_case)]
async fn c005_t1_GET_ADDR() {
// zcashd: pass
// zebra: pass
run_test_case(Message::GetAddr).await.unwrap();
}

#[tokio::test]
async fn mempool() {
#[allow(non_snake_case)]
async fn c005_t2_MEMPOOL() {
// zcashd: pass
// zebra: pass
run_test_case(Message::MemPool).await.unwrap();
}

#[tokio::test]
async fn ping() {
#[allow(non_snake_case)]
async fn c005_t3_PING() {
// zcashd: pass
// zebra: pass
run_test_case(Message::Ping(Nonce::default()))
Expand All @@ -45,7 +48,8 @@ mod when_node_receives_connection {
}

#[tokio::test]
async fn pong() {
#[allow(non_snake_case)]
async fn c005_t4_PONG() {
// zcashd: pass
// zebra: pass
run_test_case(Message::Pong(Nonce::default()))
Expand All @@ -54,14 +58,16 @@ mod when_node_receives_connection {
}

#[tokio::test]
async fn addr() {
#[allow(non_snake_case)]
async fn c005_t5_ADDR() {
// zcashd: pass
// zebra: pass
run_test_case(Message::Addr(Addr::empty())).await.unwrap();
}

#[tokio::test]
async fn get_headers() {
#[allow(non_snake_case)]
async fn c005_t6_GET_HEADERS() {
// zcashd: pass
// zebra: pass
let block_hash = Block::testnet_genesis().double_sha256().unwrap();
Expand All @@ -70,7 +76,8 @@ mod when_node_receives_connection {
}

#[tokio::test]
async fn get_blocks() {
#[allow(non_snake_case)]
async fn c005_t7_GET_BLOCKS() {
// zcashd: pass
// zebra: pass
let block_hash = Block::testnet_genesis().double_sha256().unwrap();
Expand All @@ -79,15 +86,17 @@ mod when_node_receives_connection {
}

#[tokio::test]
async fn get_data_block() {
#[allow(non_snake_case)]
async fn c005_t8_GET_DATA_BLOCK() {
// zcashd: pass
// zebra: pass
let block_inv = Inv::new(vec![Block::testnet_genesis().inv_hash()]);
run_test_case(Message::GetData(block_inv)).await.unwrap();
}

#[tokio::test]
async fn get_data_tx() {
#[allow(non_snake_case)]
async fn c005_t9_GET_DATA_TX() {
// zcashd: pass
// zebra: pass
run_test_case(Message::GetData(Inv::new(vec![Block::testnet_genesis()
Expand All @@ -98,15 +107,17 @@ mod when_node_receives_connection {
}

#[tokio::test]
async fn inv() {
#[allow(non_snake_case)]
async fn c005_t10_INV() {
// zcashd: pass
// zebra: pass
let block_inv = Inv::new(vec![Block::testnet_genesis().inv_hash()]);
run_test_case(Message::Inv(block_inv)).await.unwrap();
}

#[tokio::test]
async fn not_found() {
#[allow(non_snake_case)]
async fn c005_t11_NOT_FOUND() {
// zcashd: pass
// zebra: pass
let block_inv = Inv::new(vec![Block::testnet_genesis().inv_hash()]);
Expand Down Expand Up @@ -162,21 +173,24 @@ mod when_node_initiates_connection {
use super::*;

#[tokio::test]
async fn get_addr() {
#[allow(non_snake_case)]
async fn c006_t1_GET_ADDR() {
// zcashd: pass
// zebra: pass
run_test_case(Message::GetAddr).await.unwrap();
}

#[tokio::test]
async fn mempool() {
#[allow(non_snake_case)]
async fn c006_t2_MEMPOOL() {
// zcashd: pass
// zebra: pass
run_test_case(Message::MemPool).await.unwrap();
}

#[tokio::test]
async fn ping() {
#[allow(non_snake_case)]
async fn c006_t3_PING() {
// zcashd: pass
// zebra: pass
run_test_case(Message::Ping(Nonce::default()))
Expand All @@ -185,7 +199,8 @@ mod when_node_initiates_connection {
}

#[tokio::test]
async fn pong() {
#[allow(non_snake_case)]
async fn c006_t4_PONG() {
// zcashd: pass
// zebra: pass
run_test_case(Message::Pong(Nonce::default()))
Expand All @@ -194,14 +209,16 @@ mod when_node_initiates_connection {
}

#[tokio::test]
async fn addr() {
#[allow(non_snake_case)]
async fn c006_t5_ADDR() {
// zcashd: pass
// zebra: pass
run_test_case(Message::Addr(Addr::empty())).await.unwrap();
}

#[tokio::test]
async fn get_headers() {
#[allow(non_snake_case)]
async fn c006_t6_GET_HEADERS() {
// zcashd: pass
// zebra: pass
let block_hash = Block::testnet_genesis().double_sha256().unwrap();
Expand All @@ -210,7 +227,8 @@ mod when_node_initiates_connection {
}

#[tokio::test]
async fn get_blocks() {
#[allow(non_snake_case)]
async fn c006_t7_GET_BLOCKS() {
// zcashd: pass
// zebra: pass
let block_hash = Block::testnet_genesis().double_sha256().unwrap();
Expand All @@ -219,15 +237,17 @@ mod when_node_initiates_connection {
}

#[tokio::test]
async fn get_data_block() {
#[allow(non_snake_case)]
async fn c006_t8_GET_DATA_BLOCK() {
// zcashd: pass
// zebra: pass
let block_inv = Inv::new(vec![Block::testnet_genesis().inv_hash()]);
run_test_case(Message::GetData(block_inv)).await.unwrap();
}

#[tokio::test]
async fn get_data_tx() {
#[allow(non_snake_case)]
async fn c006_t9_GET_DATA_TX() {
// zcashd: pass
// zebra: pass
run_test_case(Message::GetData(Inv::new(vec![Block::testnet_genesis()
Expand All @@ -238,15 +258,17 @@ mod when_node_initiates_connection {
}

#[tokio::test]
async fn inv() {
#[allow(non_snake_case)]
async fn c006_t10_INV() {
// zcashd: pass
// zebra: pass
let block_inv = Inv::new(vec![Block::testnet_genesis().inv_hash()]);
run_test_case(Message::Inv(block_inv)).await.unwrap();
}

#[tokio::test]
async fn not_found() {
#[allow(non_snake_case)]
async fn c006_t11_NOT_FOUND() {
// zcashd: pass
// zebra: pass
let block_inv = Inv::new(vec![Block::testnet_genesis().inv_hash()]);
Expand Down