4
4
import ydb
5
5
6
6
7
- @pytest .mark .skip ("Not implemented yet." )
7
+ # @pytest.mark.skip("Not implemented yet.")
8
8
@pytest .mark .asyncio
9
9
class TestTopicTransactionalReader :
10
10
async def test_commit (self , driver : ydb .aio .Driver , topic_with_messages , topic_consumer ):
@@ -13,8 +13,8 @@ async def test_commit(self, driver: ydb.aio.Driver, topic_with_messages, topic_c
13
13
14
14
async def callee (tx : ydb .aio .QueryTxContext ):
15
15
batch = await wait_for (reader .receive_batch_with_tx (tx , max_messages = 1 ), 1 )
16
- assert len (batch ) == 1
17
- assert batch [0 ].data .decode () == "123"
16
+ assert len (batch . messages ) == 1
17
+ assert batch . messages [0 ].data .decode () == "123"
18
18
19
19
await pool .retry_tx_async (callee )
20
20
@@ -27,8 +27,8 @@ async def test_rollback(self, driver: ydb.aio.Driver, topic_with_messages, topic
27
27
28
28
async def callee (tx : ydb .aio .QueryTxContext ):
29
29
batch = await wait_for (reader .receive_batch_with_tx (tx , max_messages = 1 ), 1 )
30
- assert len (batch ) == 1
31
- assert batch [0 ].data .decode () == "123"
30
+ assert len (batch . messages ) == 1
31
+ assert batch . messages [0 ].data .decode () == "123"
32
32
33
33
await tx .rollback ()
34
34
@@ -38,114 +38,114 @@ async def callee(tx: ydb.aio.QueryTxContext):
38
38
assert msg .data .decode () == "123"
39
39
40
40
41
- class TestTopicTransactionalWriter :
42
- async def test_commit (self , driver : ydb .aio .Driver , topic_path , topic_reader : ydb .TopicReaderAsyncIO ):
43
- async with ydb .aio .QuerySessionPool (driver ) as pool :
41
+ # class TestTopicTransactionalWriter:
42
+ # async def test_commit(self, driver: ydb.aio.Driver, topic_path, topic_reader: ydb.TopicReaderAsyncIO):
43
+ # async with ydb.aio.QuerySessionPool(driver) as pool:
44
44
45
- async def callee (tx : ydb .aio .QueryTxContext ):
46
- tx_writer = driver .topic_client .tx_writer (tx , topic_path )
47
- await tx_writer .write (ydb .TopicWriterMessage (data = "123" .encode ()))
45
+ # async def callee(tx: ydb.aio.QueryTxContext):
46
+ # tx_writer = driver.topic_client.tx_writer(tx, topic_path)
47
+ # await tx_writer.write(ydb.TopicWriterMessage(data="123".encode()))
48
48
49
- await pool .retry_tx_async (callee )
49
+ # await pool.retry_tx_async(callee)
50
50
51
- msg = await wait_for (topic_reader .receive_message (), 0.1 )
52
- assert msg .data .decode () == "123"
51
+ # msg = await wait_for(topic_reader.receive_message(), 0.1)
52
+ # assert msg.data.decode() == "123"
53
53
54
- async def test_rollback (self , driver : ydb .aio .Driver , topic_path , topic_reader : ydb .TopicReaderAsyncIO ):
55
- async with ydb .aio .QuerySessionPool (driver ) as pool :
54
+ # async def test_rollback(self, driver: ydb.aio.Driver, topic_path, topic_reader: ydb.TopicReaderAsyncIO):
55
+ # async with ydb.aio.QuerySessionPool(driver) as pool:
56
56
57
- async def callee (tx : ydb .aio .QueryTxContext ):
58
- tx_writer = driver .topic_client .tx_writer (tx , topic_path )
59
- await tx_writer .write (ydb .TopicWriterMessage (data = "123" .encode ()))
57
+ # async def callee(tx: ydb.aio.QueryTxContext):
58
+ # tx_writer = driver.topic_client.tx_writer(tx, topic_path)
59
+ # await tx_writer.write(ydb.TopicWriterMessage(data="123".encode()))
60
60
61
- await tx .rollback ()
61
+ # await tx.rollback()
62
62
63
- await pool .retry_tx_async (callee )
63
+ # await pool.retry_tx_async(callee)
64
64
65
- with pytest .raises (asyncio .TimeoutError ):
66
- await wait_for (topic_reader .receive_message (), 0.1 )
65
+ # with pytest.raises(asyncio.TimeoutError):
66
+ # await wait_for(topic_reader.receive_message(), 0.1)
67
67
68
- async def test_no_msg_written_in_error_case (
69
- self , driver : ydb .aio .Driver , topic_path , topic_reader : ydb .TopicReaderAsyncIO
70
- ):
71
- async with ydb .aio .QuerySessionPool (driver ) as pool :
68
+ # async def test_no_msg_written_in_error_case(
69
+ # self, driver: ydb.aio.Driver, topic_path, topic_reader: ydb.TopicReaderAsyncIO
70
+ # ):
71
+ # async with ydb.aio.QuerySessionPool(driver) as pool:
72
72
73
- async def callee (tx : ydb .aio .QueryTxContext ):
74
- tx_writer = driver .topic_client .tx_writer (tx , topic_path )
75
- await tx_writer .write (ydb .TopicWriterMessage (data = "123" .encode ()))
73
+ # async def callee(tx: ydb.aio.QueryTxContext):
74
+ # tx_writer = driver.topic_client.tx_writer(tx, topic_path)
75
+ # await tx_writer.write(ydb.TopicWriterMessage(data="123".encode()))
76
76
77
- raise BaseException ("error" )
77
+ # raise BaseException("error")
78
78
79
- with pytest .raises (BaseException ):
80
- await pool .retry_tx_async (callee )
79
+ # with pytest.raises(BaseException):
80
+ # await pool.retry_tx_async(callee)
81
81
82
- with pytest .raises (asyncio .TimeoutError ):
83
- await wait_for (topic_reader .receive_message (), 0.1 )
82
+ # with pytest.raises(asyncio.TimeoutError):
83
+ # await wait_for(topic_reader.receive_message(), 0.1)
84
84
85
- async def test_msg_written_exactly_once_with_retries (
86
- self , driver : ydb .aio .Driver , topic_path , topic_reader : ydb .TopicReaderAsyncIO
87
- ):
88
- error_raised = False
89
- async with ydb .aio .QuerySessionPool (driver ) as pool :
85
+ # async def test_msg_written_exactly_once_with_retries(
86
+ # self, driver: ydb.aio.Driver, topic_path, topic_reader: ydb.TopicReaderAsyncIO
87
+ # ):
88
+ # error_raised = False
89
+ # async with ydb.aio.QuerySessionPool(driver) as pool:
90
90
91
- async def callee (tx : ydb .aio .QueryTxContext ):
92
- nonlocal error_raised
93
- tx_writer = driver .topic_client .tx_writer (tx , topic_path )
94
- await tx_writer .write (ydb .TopicWriterMessage (data = "123" .encode ()))
91
+ # async def callee(tx: ydb.aio.QueryTxContext):
92
+ # nonlocal error_raised
93
+ # tx_writer = driver.topic_client.tx_writer(tx, topic_path)
94
+ # await tx_writer.write(ydb.TopicWriterMessage(data="123".encode()))
95
95
96
- if not error_raised :
97
- error_raised = True
98
- raise ydb .issues .Unavailable ("some retriable error" )
96
+ # if not error_raised:
97
+ # error_raised = True
98
+ # raise ydb.issues.Unavailable("some retriable error")
99
99
100
- await pool .retry_tx_async (callee )
100
+ # await pool.retry_tx_async(callee)
101
101
102
- msg = await wait_for (topic_reader .receive_message (), 0.1 )
103
- assert msg .data .decode () == "123"
102
+ # msg = await wait_for(topic_reader.receive_message(), 0.1)
103
+ # assert msg.data.decode() == "123"
104
104
105
- with pytest .raises (asyncio .TimeoutError ):
106
- await wait_for (topic_reader .receive_message (), 0.1 )
105
+ # with pytest.raises(asyncio.TimeoutError):
106
+ # await wait_for(topic_reader.receive_message(), 0.1)
107
107
108
108
109
- class TestTopicTransactionalWriterSync :
110
- def test_commit (self , driver_sync : ydb .Driver , topic_path , topic_reader_sync : ydb .TopicReader ):
111
- with ydb .QuerySessionPool (driver_sync ) as pool :
109
+ # class TestTopicTransactionalWriterSync:
110
+ # def test_commit(self, driver_sync: ydb.Driver, topic_path, topic_reader_sync: ydb.TopicReader):
111
+ # with ydb.QuerySessionPool(driver_sync) as pool:
112
112
113
- def callee (tx : ydb .QueryTxContext ):
114
- tx_writer = driver_sync .topic_client .tx_writer (tx , topic_path )
115
- tx_writer .write (ydb .TopicWriterMessage (data = "123" .encode ()))
113
+ # def callee(tx: ydb.QueryTxContext):
114
+ # tx_writer = driver_sync.topic_client.tx_writer(tx, topic_path)
115
+ # tx_writer.write(ydb.TopicWriterMessage(data="123".encode()))
116
116
117
- pool .retry_tx_sync (callee )
117
+ # pool.retry_tx_sync(callee)
118
118
119
- msg = topic_reader_sync .receive_message (timeout = 0.1 )
120
- assert msg .data .decode () == "123"
119
+ # msg = topic_reader_sync.receive_message(timeout=0.1)
120
+ # assert msg.data.decode() == "123"
121
121
122
- def test_rollback (self , driver_sync : ydb .aio .Driver , topic_path , topic_reader_sync : ydb .TopicReader ):
123
- with ydb .QuerySessionPool (driver_sync ) as pool :
122
+ # def test_rollback(self, driver_sync: ydb.aio.Driver, topic_path, topic_reader_sync: ydb.TopicReader):
123
+ # with ydb.QuerySessionPool(driver_sync) as pool:
124
124
125
- def callee (tx : ydb .QueryTxContext ):
126
- tx_writer = driver_sync .topic_client .tx_writer (tx , topic_path )
127
- tx_writer .write (ydb .TopicWriterMessage (data = "123" .encode ()))
125
+ # def callee(tx: ydb.QueryTxContext):
126
+ # tx_writer = driver_sync.topic_client.tx_writer(tx, topic_path)
127
+ # tx_writer.write(ydb.TopicWriterMessage(data="123".encode()))
128
128
129
- tx .rollback ()
129
+ # tx.rollback()
130
130
131
- pool .retry_tx_sync (callee )
131
+ # pool.retry_tx_sync(callee)
132
132
133
- with pytest .raises (TimeoutError ):
134
- topic_reader_sync .receive_message (timeout = 0.1 )
133
+ # with pytest.raises(TimeoutError):
134
+ # topic_reader_sync.receive_message(timeout=0.1)
135
135
136
- def test_no_msg_written_in_error_case (
137
- self , driver_sync : ydb .Driver , topic_path , topic_reader_sync : ydb .TopicReaderAsyncIO
138
- ):
139
- with ydb .QuerySessionPool (driver_sync ) as pool :
136
+ # def test_no_msg_written_in_error_case(
137
+ # self, driver_sync: ydb.Driver, topic_path, topic_reader_sync: ydb.TopicReaderAsyncIO
138
+ # ):
139
+ # with ydb.QuerySessionPool(driver_sync) as pool:
140
140
141
- def callee (tx : ydb .QueryTxContext ):
142
- tx_writer = driver_sync .topic_client .tx_writer (tx , topic_path )
143
- tx_writer .write (ydb .TopicWriterMessage (data = "123" .encode ()))
141
+ # def callee(tx: ydb.QueryTxContext):
142
+ # tx_writer = driver_sync.topic_client.tx_writer(tx, topic_path)
143
+ # tx_writer.write(ydb.TopicWriterMessage(data="123".encode()))
144
144
145
- raise BaseException ("error" )
145
+ # raise BaseException("error")
146
146
147
- with pytest .raises (BaseException ):
148
- pool .retry_tx_sync (callee )
147
+ # with pytest.raises(BaseException):
148
+ # pool.retry_tx_sync(callee)
149
149
150
- with pytest .raises (TimeoutError ):
151
- topic_reader_sync .receive_message (timeout = 0.1 )
150
+ # with pytest.raises(TimeoutError):
151
+ # topic_reader_sync.receive_message(timeout=0.1)
0 commit comments