File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77import pytest
88from common .pool import Pool
99from common .block import Block
10- from common .exceptions import InvalidBlockUUIDError
10+ from common .exceptions import InvalidBlockUUIDError , OutOfPreSharedRandomDataError
1111from common .utils import bytes_to_str
1212
1313
@@ -120,3 +120,13 @@ def test_allocate_success_empty_pool_two_blocks():
120120 assert allocation is not None
121121 assert allocation .data == bytes .fromhex ("0001020304000102" )
122122 assert pool .nr_used_bytes == 8
123+
124+
125+ def test_allocate_failure_insufficient_space ():
126+ """
127+ Attempt to allocate an allocation from a pool. There is not enough unused data in the pool.
128+ """
129+ pool , _blocks = _create_test_pool_and_block ([5 , 5 ])
130+ with pytest .raises (OutOfPreSharedRandomDataError ):
131+ pool .allocate (20 , purpose = "test" )
132+ assert pool .nr_used_bytes == 0
You can’t perform that action at this time.
0 commit comments