Skip to content

Commit 855b362

Browse files
adds 200k block load by hash test
fixup: removed extra teardown
1 parent cb78133 commit 855b362

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

deku-p/src/core/block_storage/tests/block_storage_tests.ml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ let test_200k_block_load env () =
152152
let test_200k_block_load env () =
153153
Eio.Switch.run @@ fun sw ->
154154
let block_storage = make_block_storage env sw in
155-
let (Block { hash; _ } as block) = block ~default_block_size:200_000 in
155+
let (Block { hash; level; _ } as block) = block ~default_block_size:200_000 in
156156
Block_storage.save_block ~block block_storage;
157157
let retrieved_block =
158158
match Block_storage.find_block_by_hash ~block_hash:hash block_storage with
@@ -163,6 +163,16 @@ let test_200k_block_load env () =
163163
~msg:"hash loaded block is equal to saved block" ~expected:block
164164
~actual:retrieved_block;
165165

166+
let retrieved_block =
167+
match Block_storage.find_block_by_level ~level block_storage with
168+
| Some json -> Block.t_of_yojson json
169+
| None -> Genesis.block
170+
in
171+
172+
Alcotest.(check' block_testable)
173+
~msg:"level loaded block is equal to saved block" ~expected:block
174+
~actual:retrieved_block;
175+
166176
(* TODO: Fail the switch and capture the exception instead *)
167177
let (Block_storage.Storage { worker; _ }) = block_storage in
168178
Parallel.Worker.teardown worker

0 commit comments

Comments
 (0)