Skip to content

Commit 7a92ee2

Browse files
committed
tests and fixes
1 parent 2208089 commit 7a92ee2

26 files changed

+1703
-350
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ sqlx = { version = "0.8.6", default-features = false, features = [
185185
] }
186186
derive-where = { version = "1.2.7", default-features = false }
187187
once_cell = { version = "1.21.3", default-features = false }
188+
paste = { version = "1.0.15" }
188189

189190
# substrate dependencies
190191
frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-stable2506" }

toolkit/data-sources/db-sync/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ tokio-test = "0.4.3"
5656
ctor = "0.4.1"
5757
testcontainers-modules = { version = "0.1.3", features = ["postgres"] }
5858
pretty_assertions = { workspace = true }
59+
paste = { workspace = true }
5960

6061
[features]
6162
default = []

toolkit/data-sources/db-sync/src/block/tests.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use std::str::FromStr;
99
const BLOCK_4_TS_MILLIS: u64 = 1650561570000;
1010
const BLOCK_5_TS_MILLIS: u64 = 1650562570000;
1111

12-
#[sqlx::test(migrations = "./testdata/migrations")]
12+
#[sqlx::test(migrations = "./testdata/migrations-v2")]
1313
async fn get_latest_block_info(pool: PgPool) {
1414
let irrelevant_security_parameter = 1000;
1515
let source = mk_datasource(pool, irrelevant_security_parameter);
@@ -29,7 +29,7 @@ async fn get_latest_block_info(pool: PgPool) {
2929
assert_eq!(block, expected)
3030
}
3131

32-
#[sqlx::test(migrations = "./testdata/migrations")]
32+
#[sqlx::test(migrations = "./testdata/migrations-v2")]
3333
async fn test_get_latest_stable_block(pool: PgPool) {
3434
let security_parameter = 2;
3535
let source = mk_datasource(pool, security_parameter);
@@ -43,7 +43,7 @@ async fn test_get_latest_stable_block(pool: PgPool) {
4343
assert_eq!(block, Some(expected))
4444
}
4545

46-
#[sqlx::test(migrations = "./testdata/migrations")]
46+
#[sqlx::test(migrations = "./testdata/migrations-v2")]
4747
async fn test_get_latest_stable_block_at_filters_out_by_max_slot_boundary(pool: PgPool) {
4848
let security_parameter = 2;
4949
let slots_distance_between_blocks = block_4().slot.0 - block_2().slot.0;
@@ -58,7 +58,7 @@ async fn test_get_latest_stable_block_at_filters_out_by_max_slot_boundary(pool:
5858
assert_eq!(block, None)
5959
}
6060

61-
#[sqlx::test(migrations = "./testdata/migrations")]
61+
#[sqlx::test(migrations = "./testdata/migrations-v2")]
6262
async fn test_get_stable_block_at(pool: PgPool) {
6363
let security_parameter = 2;
6464
let source = mk_datasource(pool, security_parameter);
@@ -70,7 +70,7 @@ async fn test_get_stable_block_at(pool: PgPool) {
7070
assert_eq!(block, Some(block_2()));
7171
}
7272

73-
#[sqlx::test(migrations = "./testdata/migrations")]
73+
#[sqlx::test(migrations = "./testdata/migrations-v2")]
7474
async fn test_get_stable_block_at_returns_block_that_dont_have_k_blocks_on_them_at_given_timestamp(
7575
pool: PgPool,
7676
) {
@@ -85,7 +85,7 @@ async fn test_get_stable_block_at_returns_block_that_dont_have_k_blocks_on_them_
8585
assert_eq!(block, Some(block_2()));
8686
}
8787

88-
#[sqlx::test(migrations = "./testdata/migrations")]
88+
#[sqlx::test(migrations = "./testdata/migrations-v2")]
8989
async fn test_get_stable_block_at_filters_out_by_min_slots_boundary(pool: PgPool) {
9090
let security_parameter = 3;
9191
let slots_distance_between_blocks = block_4().slot.0 - block_2().slot.0;
@@ -104,7 +104,7 @@ async fn test_get_stable_block_at_filters_out_by_min_slots_boundary(pool: PgPool
104104
assert_eq!(block, None);
105105
}
106106

107-
#[sqlx::test(migrations = "./testdata/migrations")]
107+
#[sqlx::test(migrations = "./testdata/migrations-v2")]
108108
async fn test_get_stable_block_at_filters_out_by_max_slots_boundary(pool: PgPool) {
109109
let security_parameter = 2;
110110
let slots_distance_between_blocks = block_4().slot.0 - block_2().slot.0;
@@ -123,7 +123,7 @@ async fn test_get_stable_block_at_filters_out_by_max_slots_boundary(pool: PgPool
123123
assert_eq!(block, None);
124124
}
125125

126-
#[sqlx::test(migrations = "./testdata/migrations")]
126+
#[sqlx::test(migrations = "./testdata/migrations-v2")]
127127
async fn test_get_stable_block_info_by_hash_for_unknown_hash(pool: PgPool) {
128128
let source = mk_datasource(pool, 2);
129129
let unknown_hash =
@@ -135,7 +135,7 @@ async fn test_get_stable_block_info_by_hash_for_unknown_hash(pool: PgPool) {
135135
assert_eq!(result, None)
136136
}
137137

138-
#[sqlx::test(migrations = "./testdata/migrations")]
138+
#[sqlx::test(migrations = "./testdata/migrations-v2")]
139139
async fn test_get_latest_stable_block_with_stability_margin(pool: PgPool) {
140140
let security_parameter = 2;
141141
let stability_margin = 1;
@@ -164,7 +164,7 @@ async fn test_get_latest_stable_block_with_stability_margin(pool: PgPool) {
164164
assert_eq!(block, None);
165165
}
166166

167-
#[sqlx::test(migrations = "./testdata/migrations")]
167+
#[sqlx::test(migrations = "./testdata/migrations-v2")]
168168
async fn test_get_latest_stable_block_with_stability_margin_2(pool: PgPool) {
169169
let security_parameter = 2;
170170
let stability_margin = 0;
@@ -190,7 +190,7 @@ async fn test_get_latest_stable_block_with_stability_margin_2(pool: PgPool) {
190190
assert_eq!(block, Some(block_0()));
191191
}
192192

193-
#[sqlx::test(migrations = "./testdata/migrations")]
193+
#[sqlx::test(migrations = "./testdata/migrations-v2")]
194194
async fn test_get_stable_block_caching(pool: PgPool) {
195195
fn dummy_hash(n: u8) -> McBlockHash {
196196
McBlockHash([n; 32])

0 commit comments

Comments
 (0)