Skip to content

Commit 50bc0af

Browse files
authored
Fix encryption test (#10118)
1 parent 2942896 commit 50bc0af

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

ydb/tests/functional/encryption/test_encryption.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,16 @@ def callee(s):
5858
logger.exception("Error executing transaction")
5959

6060

61-
def simple_write(pool):
62-
for i in range(10000):
63-
simple_write_data(pool, random.randint(0, (1 << 64) - 1))
61+
class Workload:
62+
def __init__(self):
63+
self._stopped = False
64+
65+
def simple_write(self, pool):
66+
while not self._stopped:
67+
simple_write_data(pool, random.randint(0, (1 << 64) - 1))
68+
69+
def stop(self):
70+
self._stopped = True
6471

6572

6673
class TestEncryption(object):
@@ -112,10 +119,14 @@ def test_simple_encryption(self):
112119
for pool in pools:
113120
create_sample_table(pool)
114121

122+
workloads = []
123+
115124
for pool in pools:
125+
workload = Workload()
126+
workloads.append(workload)
116127
threads.append(
117128
threading.Thread(
118-
target=lambda: simple_write(pool),
129+
target=lambda: workload.simple_write(pool),
119130
)
120131
)
121132

@@ -138,6 +149,9 @@ def test_simple_encryption(self):
138149
time.sleep(1)
139150
slot.start()
140151

152+
for workload in workloads:
153+
workload.stop()
154+
141155
for thread in threads:
142156
thread.join()
143157

0 commit comments

Comments
 (0)