This is an automated email from the ASF dual-hosted git repository.
duhengforever pushed a commit to branch ctypes
in repository https://gitbox.apache.org/repos/asf/rocketmq-client-python.git
The following commit(s) were added to refs/heads/ctypes by this push:
new 8e8729f test(producer) improve the transaction unit test stability
new 5debfd0 Merge pull request #66 from duhenglucky/unit_test_improve
8e8729f is described below
commit 8e8729f112c5f34ceb2d9b867fd34660ff39d63a
Author: duhenglucky <[email protected]>
AuthorDate: Mon Nov 4 15:19:05 2019 +0800
test(producer) improve the transaction unit test stability
---
samples/producer.py | 2 +-
tests/test_producer.py | 7 +++++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/samples/producer.py b/samples/producer.py
index 83bf976..fda2e9b 100644
--- a/samples/producer.py
+++ b/samples/producer.py
@@ -40,7 +40,7 @@ def send_message_sync(count):
for n in range(count):
msg = create_message()
ret = producer.send_sync(msg)
- print ('send message status: ' + str(ret.status) + ' msgId: ' +
ret.msg_id + ' offset: ' + str(ret.offset))
+ print ('send message status: ' + str(ret.status) + ' msgId: ' +
ret.msg_id)
print ('send sync message done')
producer.shutdown()
producer.destroy()
diff --git a/tests/test_producer.py b/tests/test_producer.py
index 621c841..2921156 100644
--- a/tests/test_producer.py
+++ b/tests/test_producer.py
@@ -18,9 +18,12 @@
# under the License.
import time
import threading
+import sys
from rocketmq.client import Message, SendStatus, TransactionMQProducer,
TransactionStatus
+PY_VERSION = sys.version_info[0]
+
def test_producer_send_sync(producer):
msg = Message('test')
@@ -109,11 +112,11 @@ def test_transaction_producer():
assert msg.id.decode('utf-8') == msgId
return TransactionStatus.COMMIT
- producer = TransactionMQProducer('transactionTestGroup', on_check)
+ producer = TransactionMQProducer('transactionTestGroup' + str(PY_VERSION),
on_check)
producer.set_namesrv_addr('127.0.0.1:9876')
producer.start()
msg = Message('test')
- msg.set_keys('send_orderly')
+ msg.set_keys('transaction')
msg.set_tags('XXX')
msg.set_body('XXXX')
producer.send_message_in_transaction(msg, on_local_execute)