AMQPStorm 3.1__tar.gz → 3.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {amqpstorm-3.1 → amqpstorm-3.1.2}/AMQPStorm.egg-info/PKG-INFO +1 -1
- {amqpstorm-3.1 → amqpstorm-3.1.2}/CHANGELOG.rst +27 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/PKG-INFO +1 -1
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/__init__.py +1 -1
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/channel.py +10 -5
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/connection.py +1 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/io.py +12 -5
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/rpc.py +7 -5
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/__init__.py +2 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/functional/management/test_api.py +15 -4
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/functional/management/test_healthcheck.py +5 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/functional/management/test_queue.py +5 -2
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/functional/management/test_user.py +2 -2
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/functional/test_tx.py +2 -4
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/unit/channel/test_channel_message_handling.py +28 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/unit/connection/test_connection.py +1 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/unit/io/test_io_exception.py +17 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/unit/test_rpc.py +12 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/AMQPStorm.egg-info/SOURCES.txt +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/AMQPStorm.egg-info/dependency_links.txt +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/AMQPStorm.egg-info/requires.txt +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/AMQPStorm.egg-info/top_level.txt +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/LICENSE +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/MANIFEST.in +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/README.rst +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/base.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/basic.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/channel0.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/compatibility.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/exception.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/exchange.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/heartbeat.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/management/__init__.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/management/api.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/management/base.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/management/basic.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/management/channel.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/management/connection.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/management/exception.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/management/exchange.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/management/healthchecks.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/management/http_client.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/management/queue.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/management/user.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/management/virtual_host.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/message.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/py.typed +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/queue.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/functional/__init__.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/functional/management/__init__.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/functional/management/test_basic.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/functional/management/test_channel.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/functional/management/test_connection.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/functional/management/test_exchange.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/functional/management/test_virtual_host.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/functional/ssl/__init__.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/functional/ssl/test_reliability.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/functional/test_basic.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/functional/test_exchange.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/functional/test_generic.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/functional/test_legacy.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/functional/test_queue.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/functional/test_reliability.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/functional/test_web_based.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/functional/utility.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/unit/__init__.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/unit/base/__init__.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/unit/base/test_base_channel.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/unit/base/test_stateful.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/unit/basic/__init__.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/unit/basic/test_basic.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/unit/basic/test_basic_exception.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/unit/channel/__init__.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/unit/channel/test_channel.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/unit/channel/test_channel_exception.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/unit/channel/test_channel_frame.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/unit/channel0/__init__.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/unit/channel0/test_channel0.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/unit/channel0/test_channel0_frame.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/unit/connection/__init__.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/unit/connection/test_connection_exception.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/unit/exchange/__init__.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/unit/exchange/test_exchange.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/unit/exchange/test_exchange_exception.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/unit/io/__init__.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/unit/io/test_io.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/unit/management/__init__.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/unit/management/test_api.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/unit/management/test_basic.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/unit/management/test_exception.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/unit/management/test_http_client.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/unit/queue/__init__.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/unit/queue/test_queue_exception.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/unit/test_compatibility.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/unit/test_exception.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/unit/test_heartbeat.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/unit/test_message.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/unit/test_tx.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/unit/uri_connection/__init__.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/unit/uri_connection/test_uri_connection.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/unit/uri_connection/test_uri_connection_exception.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/utility.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tx.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/uri_connection.py +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/pyproject.toml +0 -0
- {amqpstorm-3.1 → amqpstorm-3.1.2}/setup.cfg +0 -0
|
@@ -1,6 +1,33 @@
|
|
|
1
1
|
Changelog
|
|
2
2
|
=========
|
|
3
3
|
|
|
4
|
+
Version 3.1.2
|
|
5
|
+
-------------
|
|
6
|
+
- The AMQP protocol header is now sent before the inbound reader
|
|
7
|
+
thread is started, so the initial socket write no longer races the
|
|
8
|
+
reader on the same TLS socket. This fixes intermittent
|
|
9
|
+
``connection closed by server`` errors during the handshake against
|
|
10
|
+
brokers that send data immediately after the TLS handshake (for
|
|
11
|
+
example TLS 1.3 session tickets). ``IO.open`` now only connects and
|
|
12
|
+
prepares the poller; the reader is started separately via the new
|
|
13
|
+
``IO.start_inbound``.
|
|
14
|
+
- ``Rpc.on_frame`` no longer tears down the connection when the
|
|
15
|
+
matching request or response has already been removed (for example
|
|
16
|
+
when an RPC call times out); the stray frame is ignored instead.
|
|
17
|
+
- Fixed a large-message consume throughput regression in
|
|
18
|
+
``Channel.build_inbound_messages`` (#154).
|
|
19
|
+
- Added LavinMQ compatibility for the management API client; the
|
|
20
|
+
functional and management test suites now run against LavinMQ.
|
|
21
|
+
- Testing: added an end-to-end LavinMQ CI job and modernized the test
|
|
22
|
+
certificate generation to ECDSA P-384 with standards-compliant
|
|
23
|
+
end-entity certificates.
|
|
24
|
+
|
|
25
|
+
Version 3.1.1
|
|
26
|
+
-------------
|
|
27
|
+
- Connection close is now resilient to ``IO.socket`` being cleared
|
|
28
|
+
partway through ``_close_socket``; the socket reference is captured
|
|
29
|
+
once and reused for the shutdown/close calls.
|
|
30
|
+
|
|
4
31
|
Version 3.1
|
|
5
32
|
-----------
|
|
6
33
|
- Added inline type hints across the public API and shipped ``py.typed``
|
|
@@ -156,11 +156,14 @@ class Channel(BaseChannel):
|
|
|
156
156
|
:param bool break_on_empty: Should we break the loop when there are
|
|
157
157
|
no more messages in our inbound queue.
|
|
158
158
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
159
|
+
While a consumer is active, to avoid
|
|
160
|
+
breaking out while messages are still in
|
|
161
|
+
flight from RabbitMQ, the loop only exits
|
|
162
|
+
after the inbound queue has been
|
|
163
|
+
continuously empty for at least one
|
|
164
|
+
second. With no active consumer there is
|
|
165
|
+
nothing in flight, so the loop breaks as
|
|
166
|
+
soon as the queue is empty.
|
|
164
167
|
:param bool to_tuple: Should incoming messages be converted to a
|
|
165
168
|
tuple before delivery.
|
|
166
169
|
:param bool auto_decode: Auto-decode strings when possible.
|
|
@@ -205,6 +208,8 @@ class Channel(BaseChannel):
|
|
|
205
208
|
raise
|
|
206
209
|
time.sleep(IDLE_WAIT)
|
|
207
210
|
if break_on_empty and not self._inbound:
|
|
211
|
+
if not self.consumer_tags:
|
|
212
|
+
break
|
|
208
213
|
if empty_since is None:
|
|
209
214
|
empty_since = time.monotonic()
|
|
210
215
|
elif time.monotonic() - empty_since >= 1.0:
|
|
@@ -271,6 +271,7 @@ class Connection(Stateful):
|
|
|
271
271
|
self._user_closed = False
|
|
272
272
|
self._io.open()
|
|
273
273
|
self._send_handshake()
|
|
274
|
+
self._io.start_inbound()
|
|
274
275
|
self._wait_for_connection_state(state=Stateful.OPEN)
|
|
275
276
|
self.heartbeat.start(self._exceptions)
|
|
276
277
|
LOGGER.debug('Connection Opened')
|
|
@@ -152,7 +152,13 @@ class IO:
|
|
|
152
152
|
self.poller = Poller(self.socket.fileno(), self._exceptions)
|
|
153
153
|
else:
|
|
154
154
|
self.poller = SelectPoller(self.socket.fileno(), self._exceptions)
|
|
155
|
-
|
|
155
|
+
|
|
156
|
+
def start_inbound(self) -> None:
|
|
157
|
+
"""Start the inbound thread that reads incoming socket data.
|
|
158
|
+
|
|
159
|
+
:return:
|
|
160
|
+
"""
|
|
161
|
+
self._inbound_thread = self._create_inbound_thread()
|
|
156
162
|
|
|
157
163
|
def write_to_socket(self, frame_data: bytes) -> None:
|
|
158
164
|
"""Write data to the socket.
|
|
@@ -187,18 +193,19 @@ class IO:
|
|
|
187
193
|
|
|
188
194
|
:return:
|
|
189
195
|
"""
|
|
190
|
-
|
|
196
|
+
sock = self.socket
|
|
197
|
+
if sock is None:
|
|
191
198
|
return
|
|
192
199
|
try:
|
|
193
200
|
if self.poller:
|
|
194
201
|
self.poller.close()
|
|
195
202
|
if self.use_ssl:
|
|
196
|
-
|
|
197
|
-
|
|
203
|
+
sock.unwrap() # type: ignore[attr-defined]
|
|
204
|
+
sock.shutdown(socket.SHUT_RDWR)
|
|
198
205
|
except (OSError, ValueError):
|
|
199
206
|
pass
|
|
200
207
|
|
|
201
|
-
|
|
208
|
+
sock.close()
|
|
202
209
|
|
|
203
210
|
def _get_socket_addresses(self) -> list[Any]:
|
|
204
211
|
"""Get Socket address information.
|
|
@@ -37,13 +37,15 @@ class Rpc:
|
|
|
37
37
|
"""On RPC Frame.
|
|
38
38
|
|
|
39
39
|
:param specification.Frame frame_in: Amqp frame.
|
|
40
|
-
:return:
|
|
40
|
+
:return: True if the frame was delivered to a waiting request.
|
|
41
41
|
"""
|
|
42
|
-
|
|
42
|
+
uuid = self._request.get(frame_in.name)
|
|
43
|
+
if uuid is None:
|
|
43
44
|
return False
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
response = self._response.get(uuid)
|
|
46
|
+
if response is None:
|
|
47
|
+
return False
|
|
48
|
+
response.append(frame_in)
|
|
47
49
|
return True
|
|
48
50
|
|
|
49
51
|
def register_request(self, valid_responses: list[str]) -> str:
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
|
|
1
3
|
from amqpstorm.management import ManagementApi
|
|
2
4
|
from amqpstorm.management.exception import ApiConnectionError
|
|
3
5
|
from amqpstorm.management.exception import ApiError
|
|
6
|
+
from amqpstorm.tests import BROKER
|
|
4
7
|
from amqpstorm.tests import CAFILE
|
|
5
8
|
from amqpstorm.tests import HTTP_URL
|
|
6
9
|
from amqpstorm.tests import HTTPS_URL
|
|
@@ -40,6 +43,8 @@ class ApiFunctionalTests(TestFunctionalFramework):
|
|
|
40
43
|
api.aliveness_test
|
|
41
44
|
)
|
|
42
45
|
|
|
46
|
+
@unittest.skipIf(BROKER == 'lavinmq',
|
|
47
|
+
'LavinMQ does not expose an HTTPS management listener')
|
|
43
48
|
def test_api_ssl_test(self):
|
|
44
49
|
api = ManagementApi(HTTPS_URL, USERNAME, PASSWORD,
|
|
45
50
|
verify=CAFILE)
|
|
@@ -59,8 +64,12 @@ class ApiFunctionalTests(TestFunctionalFramework):
|
|
|
59
64
|
|
|
60
65
|
self.assertIsInstance(result, dict)
|
|
61
66
|
self.assertIn('node', result)
|
|
62
|
-
self.
|
|
67
|
+
self.assertTrue(
|
|
68
|
+
'management_version' in result or 'lavinmq_version' in result
|
|
69
|
+
)
|
|
63
70
|
|
|
71
|
+
@unittest.skipIf(BROKER == 'lavinmq',
|
|
72
|
+
'LavinMQ does not implement the cluster-name endpoint')
|
|
64
73
|
def test_api_cluster_name(self):
|
|
65
74
|
api = ManagementApi(HTTP_URL, USERNAME, PASSWORD)
|
|
66
75
|
result = api.cluster_name()
|
|
@@ -75,15 +84,17 @@ class ApiFunctionalTests(TestFunctionalFramework):
|
|
|
75
84
|
|
|
76
85
|
self.assertIsInstance(result, list)
|
|
77
86
|
self.assertTrue(result)
|
|
78
|
-
self.
|
|
87
|
+
self.assertIn('name', result[0])
|
|
88
|
+
self.assertTrue(result[0]['name'])
|
|
79
89
|
|
|
80
90
|
def test_api_node(self):
|
|
81
91
|
api = ManagementApi(HTTP_URL, USERNAME, PASSWORD)
|
|
82
|
-
|
|
92
|
+
node_name = api.nodes()[0]['name']
|
|
93
|
+
result = api.node(node_name)
|
|
83
94
|
|
|
84
95
|
self.assertIsInstance(result, dict)
|
|
85
96
|
self.assertTrue(result)
|
|
86
|
-
self.assertEqual(
|
|
97
|
+
self.assertEqual(node_name, result['name'])
|
|
87
98
|
|
|
88
99
|
def test_api_whoami(self):
|
|
89
100
|
api = ManagementApi(HTTP_URL, USERNAME, PASSWORD)
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
|
|
1
3
|
from amqpstorm.management import ManagementApi
|
|
4
|
+
from amqpstorm.tests import BROKER
|
|
2
5
|
from amqpstorm.tests import HTTP_URL
|
|
3
6
|
from amqpstorm.tests import PASSWORD
|
|
4
7
|
from amqpstorm.tests import USERNAME
|
|
@@ -6,6 +9,8 @@ from amqpstorm.tests.functional.utility import TestFunctionalFramework
|
|
|
6
9
|
from amqpstorm.tests.functional.utility import setup
|
|
7
10
|
|
|
8
11
|
|
|
12
|
+
@unittest.skipIf(BROKER == 'lavinmq',
|
|
13
|
+
'LavinMQ does not implement the healthchecks endpoint')
|
|
9
14
|
class ApiHealthchecksFunctionalTests(TestFunctionalFramework):
|
|
10
15
|
@setup()
|
|
11
16
|
def test_healthtests_get(self):
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from amqpstorm.management import ApiError
|
|
2
2
|
from amqpstorm.management import ManagementApi
|
|
3
|
+
from amqpstorm.tests import BROKER
|
|
3
4
|
from amqpstorm.tests import HTTP_URL
|
|
4
5
|
from amqpstorm.tests import PASSWORD
|
|
5
6
|
from amqpstorm.tests import USERNAME
|
|
@@ -34,7 +35,8 @@ class ApiQueueFunctionalTests(TestFunctionalFramework):
|
|
|
34
35
|
self.assertIsInstance(queue, dict)
|
|
35
36
|
self.assertIn('name', queue)
|
|
36
37
|
self.assertIn('vhost', queue)
|
|
37
|
-
|
|
38
|
+
if BROKER != 'lavinmq':
|
|
39
|
+
self.assertIn('node', queue)
|
|
38
40
|
self.assertIn('durable', queue)
|
|
39
41
|
self.assertIn('arguments', queue)
|
|
40
42
|
self.assertIn('auto_delete', queue)
|
|
@@ -159,7 +161,8 @@ class ApiQueueFunctionalTests(TestFunctionalFramework):
|
|
|
159
161
|
self.assertIsInstance(queue, dict)
|
|
160
162
|
self.assertIn('name', queue)
|
|
161
163
|
self.assertIn('vhost', queue)
|
|
162
|
-
|
|
164
|
+
if BROKER != 'lavinmq':
|
|
165
|
+
self.assertIn('node', queue)
|
|
163
166
|
self.assertIn('durable', queue)
|
|
164
167
|
self.assertIn('arguments', queue)
|
|
165
168
|
self.assertIn('auto_delete', queue)
|
|
@@ -43,7 +43,7 @@ class ApiUserFunctionalTests(TestFunctionalFramework):
|
|
|
43
43
|
|
|
44
44
|
try:
|
|
45
45
|
self.assertIsNone(
|
|
46
|
-
api.user.create(username, password, tags='
|
|
46
|
+
api.user.create(username, password, tags='monitoring'))
|
|
47
47
|
user = api.user.get(username)
|
|
48
48
|
self.assertEqual(user['name'], username)
|
|
49
49
|
|
|
@@ -52,7 +52,7 @@ class ApiUserFunctionalTests(TestFunctionalFramework):
|
|
|
52
52
|
tag = user['tags'][0]
|
|
53
53
|
else:
|
|
54
54
|
tag = user['tags']
|
|
55
|
-
self.assertEqual('
|
|
55
|
+
self.assertEqual('monitoring', tag)
|
|
56
56
|
finally:
|
|
57
57
|
api.user.delete(username)
|
|
58
58
|
self.assertRaises(ApiError, api.user.get, username)
|
|
@@ -60,8 +60,7 @@ class TxFunctionalTests(TestFunctionalFramework):
|
|
|
60
60
|
def test_functional_tx_commit_without_select(self):
|
|
61
61
|
self.assertRaisesRegex(
|
|
62
62
|
AMQPChannelError,
|
|
63
|
-
'Channel 1 was closed by remote server: '
|
|
64
|
-
'PRECONDITION_FAILED - channel is not transactional',
|
|
63
|
+
'Channel 1 was closed by remote server: PRECONDITION_FAILED',
|
|
65
64
|
self.channel.tx.commit
|
|
66
65
|
)
|
|
67
66
|
|
|
@@ -96,7 +95,6 @@ class TxFunctionalTests(TestFunctionalFramework):
|
|
|
96
95
|
def test_functional_tx_rollback_without_select(self):
|
|
97
96
|
self.assertRaisesRegex(
|
|
98
97
|
AMQPChannelError,
|
|
99
|
-
'Channel 1 was closed by remote server: '
|
|
100
|
-
'PRECONDITION_FAILED - channel is not transactional',
|
|
98
|
+
'Channel 1 was closed by remote server: PRECONDITION_FAILED',
|
|
101
99
|
self.channel.tx.rollback
|
|
102
100
|
)
|
{amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/unit/channel/test_channel_message_handling.py
RENAMED
|
@@ -207,6 +207,8 @@ class ChannelBuildMessageTests(TestFramework):
|
|
|
207
207
|
channel = Channel(0, FakeConnection(), 360)
|
|
208
208
|
channel.set_state(Channel.OPEN)
|
|
209
209
|
channel._inbound = collections.deque()
|
|
210
|
+
# An active consumer keeps the empty-timer in effect.
|
|
211
|
+
channel.add_consumer_tag('travis-ci')
|
|
210
212
|
|
|
211
213
|
monotonic = mock.Mock(side_effect=[0.0, 1.5])
|
|
212
214
|
|
|
@@ -225,6 +227,8 @@ class ChannelBuildMessageTests(TestFramework):
|
|
|
225
227
|
channel = Channel(0, FakeConnection(), 360)
|
|
226
228
|
channel.set_state(Channel.OPEN)
|
|
227
229
|
channel._inbound = collections.deque()
|
|
230
|
+
# An active consumer keeps the empty-timer in effect.
|
|
231
|
+
channel.add_consumer_tag('travis-ci')
|
|
228
232
|
|
|
229
233
|
message = self.message.encode('utf-8')
|
|
230
234
|
message_len = len(message)
|
|
@@ -251,6 +255,30 @@ class ChannelBuildMessageTests(TestFramework):
|
|
|
251
255
|
self.assertIsInstance(messages[0], Message)
|
|
252
256
|
self.assertEqual(monotonic.call_count, 3)
|
|
253
257
|
|
|
258
|
+
def test_channel_build_inbound_messages_break_on_empty_no_consumer_breaks(
|
|
259
|
+
self,
|
|
260
|
+
):
|
|
261
|
+
channel = Channel(0, FakeConnection(), 360)
|
|
262
|
+
channel.set_state(Channel.OPEN)
|
|
263
|
+
channel._inbound = collections.deque()
|
|
264
|
+
|
|
265
|
+
# With no active consumer there is nothing in flight from RabbitMQ,
|
|
266
|
+
# so break_on_empty must break immediately instead of waiting on the
|
|
267
|
+
# empty-timer.
|
|
268
|
+
self.assertEqual(channel.consumer_tags, [])
|
|
269
|
+
|
|
270
|
+
monotonic = mock.Mock(side_effect=[0.0, 1.5])
|
|
271
|
+
|
|
272
|
+
with mock.patch('amqpstorm.channel.time.monotonic', monotonic), \
|
|
273
|
+
mock.patch('amqpstorm.channel.time.sleep'):
|
|
274
|
+
messages = list(
|
|
275
|
+
channel.build_inbound_messages(break_on_empty=True)
|
|
276
|
+
)
|
|
277
|
+
|
|
278
|
+
self.assertEqual(messages, [])
|
|
279
|
+
# The empty-timer must not be consulted when there is no consumer.
|
|
280
|
+
monotonic.assert_not_called()
|
|
281
|
+
|
|
254
282
|
def test_channel_build_no_message_but_inbound_not_empty(self):
|
|
255
283
|
channel = Channel(0, FakeConnection(), 360)
|
|
256
284
|
channel.set_state(Channel.OPEN)
|
|
@@ -303,6 +303,7 @@ class ConnectionTests(TestFramework):
|
|
|
303
303
|
connection.set_state(connection.OPEN)
|
|
304
304
|
|
|
305
305
|
connection._io.open = open
|
|
306
|
+
connection._io.start_inbound = lambda: None
|
|
306
307
|
connection._io.write_to_socket = on_write_to_socket
|
|
307
308
|
|
|
308
309
|
self.assertTrue(connection.is_closed)
|
|
@@ -25,6 +25,23 @@ class IOExceptionTests(TestFramework):
|
|
|
25
25
|
io.socket.shutdown.side_effect = OSError()
|
|
26
26
|
io._close_socket()
|
|
27
27
|
|
|
28
|
+
def test_io_close_socket_nullified_mid_call(self):
|
|
29
|
+
connection = FakeConnection()
|
|
30
|
+
|
|
31
|
+
io = IO(connection.parameters)
|
|
32
|
+
io._exceptions = []
|
|
33
|
+
sock = mock.Mock(name='socket', spec=socket.socket)
|
|
34
|
+
|
|
35
|
+
def clear_socket(*_):
|
|
36
|
+
io.socket = None
|
|
37
|
+
|
|
38
|
+
sock.shutdown.side_effect = clear_socket
|
|
39
|
+
io.socket = sock
|
|
40
|
+
|
|
41
|
+
io._close_socket()
|
|
42
|
+
|
|
43
|
+
sock.close.assert_called_once()
|
|
44
|
+
|
|
28
45
|
def test_io_receive_raises_socket_error(self):
|
|
29
46
|
connection = FakeConnection()
|
|
30
47
|
|
|
@@ -147,6 +147,18 @@ class RpcTests(TestFramework):
|
|
|
147
147
|
rpc.on_frame(FakePayload(name='travis-ci'))
|
|
148
148
|
self.assertIsInstance(rpc._response[uuid][0], FakePayload)
|
|
149
149
|
|
|
150
|
+
def test_rpc_on_frame_request_removed(self):
|
|
151
|
+
rpc = Rpc(FakeConnection())
|
|
152
|
+
uuid = rpc.register_request(['travis-ci'])
|
|
153
|
+
rpc.remove(uuid)
|
|
154
|
+
self.assertFalse(rpc.on_frame(FakePayload(name='travis-ci')))
|
|
155
|
+
|
|
156
|
+
def test_rpc_on_frame_response_removed_mid_delivery(self):
|
|
157
|
+
rpc = Rpc(FakeConnection())
|
|
158
|
+
uuid = rpc.register_request(['travis-ci'])
|
|
159
|
+
del rpc._response[uuid]
|
|
160
|
+
self.assertFalse(rpc.on_frame(FakePayload(name='travis-ci')))
|
|
161
|
+
|
|
150
162
|
def test_rpc_on_multiple_frames(self):
|
|
151
163
|
rpc = Rpc(FakeConnection())
|
|
152
164
|
uuid = rpc.register_request(['travis-ci'])
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/functional/management/test_virtual_host.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/unit/connection/test_connection_exception.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{amqpstorm-3.1 → amqpstorm-3.1.2}/amqpstorm/tests/unit/uri_connection/test_uri_connection.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|