diff --git a/src/tests/amqp_imposter/README.md b/src/tests/amqp_imposter/README.md index 6f7dc2a4..500da142 100644 --- a/src/tests/amqp_imposter/README.md +++ b/src/tests/amqp_imposter/README.md @@ -53,7 +53,7 @@ def test_my_client(seed: int) -> None: The runs above each spawn their own imposter process, so they can be parallelised, for example using `pytest-xdist`. If running serially, calling `imposter.configure(config)` will disconnect the client and prepare a new session on the same imposter process. -Optionally tune the behaviour of the imposter with weights and scripts. +Optionally tune the behaviour of the imposter with `weights` and `script`: ```py from amqp_imposter.control.client import ( @@ -74,6 +74,12 @@ config = pb.SessionConfig(script=script, weights=weights, seed=seed) ``` +Configure the handshake with `negotiation_options`. +The following capabilities are offered by default: +- `publisher_confirms` +- `basic.nack` +- `consumer_cancel_notify` + ### Other languages Run the imposter as a foreground process from a command line: @@ -218,6 +224,7 @@ For example, in the imposter, publishing to an undeclared exchange will not dete In practice, vhosts are shared resources and their topologies volatile. All those states -- existence and non-existence, changed arguments, changed message counts, etc. -- need to be represented by the model, so it does not need to track past declarations and bindings. +For more detail, and notes on exclusive queues, see [model/docs/TOPOLOGY.md](amqp_imposter/model/docs/TOPOLOGY.md). ### Decision register diff --git a/src/tests/amqp_imposter/amqp_imposter/amqp/method_framing.py b/src/tests/amqp_imposter/amqp_imposter/amqp/method_framing.py index 8fc8285e..4dd9ff4b 100644 --- a/src/tests/amqp_imposter/amqp_imposter/amqp/method_framing.py +++ b/src/tests/amqp_imposter/amqp_imposter/amqp/method_framing.py @@ -15,7 +15,7 @@ import calendar import struct -from collections.abc import Callable, Mapping +from collections.abc import Callable, Iterator from dataclasses import dataclass from datetime import UTC, datetime from decimal import Decimal @@ -34,11 +34,6 @@ PROTOCOL_HEADER_091 = b"AMQP\x00\x00\x09\x01" AMQP_TUPLE_DELIMITER = " " -CAPABILITIES = "capabilities" -PUBLISHER_CONFIRMS = "publisher_confirms" -BASIC_NACK = "basic.nack" -CONSUMER_CANCEL_NOTIFY = "consumer_cancel_notify" - @dataclass(frozen=True, slots=True) class ProtocolHeader: @@ -142,14 +137,6 @@ def from_amqp_tuple(value: str | bytes | None) -> tuple[str, ...]: return tuple(text.split(AMQP_TUPLE_DELIMITER)) if text else () -def capabilities_of(spec: Any) -> Mapping[str, Any]: - match (spec.server_properties or {}).get(CAPABILITIES): - case Mapping() as capabilities: - return capabilities - case _: - return {} - - def to_pika_properties(properties: mf.MessageProperties) -> ps.BasicProperties: return ps.BasicProperties( content_type=properties.content_type, @@ -203,17 +190,9 @@ def to_pika(method: m.Method) -> Any: return ps.Connection.Start( version_major=mf.assert_concrete(method.version_major), version_minor=mf.assert_concrete(method.version_minor), - server_properties={ - CAPABILITIES: { - PUBLISHER_CONFIRMS: mf.assert_concrete( - method.publisher_confirms - ), - BASIC_NACK: mf.assert_concrete(method.basic_nack), - CONSUMER_CANCEL_NOTIFY: mf.assert_concrete( - method.consumer_cancel_notify - ), - } - }, + server_properties=to_pika_value( + mf.assert_concrete(method.server_properties) + ), mechanisms=AMQP_TUPLE_DELIMITER.join( mf.assert_concrete(method.mechanisms) ), @@ -221,6 +200,9 @@ def to_pika(method: m.Method) -> Any: ) case m.ConnectionStartOk(): return ps.Connection.StartOk( + client_properties=to_pika_value( + mf.assert_concrete(method.client_properties) + ), mechanism=mf.assert_concrete(method.mechanism), locale=mf.assert_concrete(method.locale), response=mf.assert_concrete(method.response), @@ -413,21 +395,16 @@ def from_pika( ) -> m.Method | None: match spec: case ps.Connection.Start(): - capabilities = capabilities_of(spec) - return m.ConnectionStart( version_major=d.Octet(spec.version_major), version_minor=d.Octet(spec.version_minor), + server_properties=from_pika_value(spec.server_properties or {}), mechanisms=from_amqp_tuple(spec.mechanisms), locales=from_amqp_tuple(spec.locales), - publisher_confirms=bool(capabilities.get(PUBLISHER_CONFIRMS, False)), - basic_nack=bool(capabilities.get(BASIC_NACK, False)), - consumer_cancel_notify=bool( - capabilities.get(CONSUMER_CANCEL_NOTIFY, False) - ), ) case ps.Connection.StartOk(): return m.ConnectionStartOk( + client_properties=from_pika_value(spec.client_properties or {}), mechanism=d.ShortStr(spec.mechanism), locale=d.ShortStr(spec.locale), response=to_text(spec.response), @@ -630,23 +607,23 @@ def encode(egress: Egress, frame_max: int) -> bytes: case MethodOnChannel(channel, partial_method): method, _ = mu.concretise(partial_method, DEFAULT_GEN_STATE) - encoded = cast(bytes, pf.Method(channel, to_pika(method)).marshal()) + frames = cast(bytes, pf.Method(channel, to_pika(method)).marshal()) if not is_content_method(method): - return encoded + return frames body = mf.assert_concrete(method.body) properties = to_pika_properties(mf.assert_concrete(method.properties)) - encoded += cast(bytes, pf.Header(channel, len(body), properties).marshal()) - limit = frame_max - ps.FRAME_HEADER_SIZE - ps.FRAME_END_SIZE + frames += cast(bytes, pf.Header(channel, len(body), properties).marshal()) + limit = (frame_max or d.Long.MAX) - ps.FRAME_HEADER_SIZE - ps.FRAME_END_SIZE for start in range(0, len(body), limit): - encoded += cast( + frames += cast( bytes, pf.Body(channel, body[start : start + limit]).marshal() ) - return encoded + return frames def validate_buffer_length(buffer: bytes, max_buffer: int) -> Undecodable | None: @@ -655,7 +632,26 @@ def validate_buffer_length(buffer: bytes, max_buffer: int) -> Undecodable | None return None -def decode_pika_frame(buffer: bytes) -> tuple[int, Any]: +def validate_frame_size(buffer: bytes, frame_max: int) -> InvalidFrameError | None: + if ( + frame_max == 0 + or len(buffer) < ps.FRAME_HEADER_SIZE + or buffer.startswith(b"AMQP") + ): + return None + + _, _, payload_size = struct.unpack_from(">BHI", buffer) + frame_size = ps.FRAME_HEADER_SIZE + payload_size + ps.FRAME_END_SIZE + + if frame_size > frame_max: + return InvalidFrameError(f"frame of {frame_size} bytes exceeds {frame_max}") + return None + + +def decode_pika_frame(buffer: bytes, frame_max: int) -> tuple[int, Any]: + if (oversized := validate_frame_size(buffer, frame_max)) is not None: + raise oversized + try: return cast(tuple[int, Any], pf.decode_frame(buffer)) except (KeyError, struct.error) as bad: @@ -663,9 +659,9 @@ def decode_pika_frame(buffer: bytes) -> tuple[int, Any]: def decode_content_method( - buffer: bytes, offset: int, frame: Any, max_buffer: int + buffer: bytes, offset: int, frame: Any, frame_max: int, max_buffer: int ) -> tuple[Ingress | None, int]: - consumed, header = decode_pika_frame(buffer[offset:]) + len_consumed, header = decode_pika_frame(buffer[offset:], frame_max) if header is None: return validate_buffer_length(buffer, max_buffer), len(buffer) @@ -673,11 +669,11 @@ def decode_content_method( if not isinstance(header, pf.Header): return Undecodable("expected a content header"), len(buffer) - offset += consumed + offset += len_consumed body = b"" while len(body) < header.body_size: - consumed, fragment = decode_pika_frame(buffer[offset:]) + len_consumed, fragment = decode_pika_frame(buffer[offset:], frame_max) if fragment is None: return validate_buffer_length(buffer, max_buffer), len(buffer) @@ -686,7 +682,7 @@ def decode_content_method( return Undecodable("expected a content body"), len(buffer) body += fragment.fragment - offset += consumed + offset += len_consumed return decoded(frame, from_pika(frame.method, header.properties, body), offset) @@ -699,27 +695,29 @@ def decoded(frame: Any, method: m.Method | None, offset: int) -> tuple[Ingress, def decode_method( - buffer: bytes, offset: int, frame: Any, max_buffer: int + buffer: bytes, offset: int, frame: Any, frame_max: int, max_buffer: int ) -> tuple[Ingress | None, int]: if is_pika_content_method(frame.method): - return decode_content_method(buffer, offset, frame, max_buffer) + return decode_content_method(buffer, offset, frame, frame_max, max_buffer) return decoded(frame, from_pika(frame.method), offset) -def decode_one(buffer: bytes, max_buffer: int) -> tuple[Ingress | None, int]: +def decode_one( + buffer: bytes, frame_max: int, max_buffer: int +) -> tuple[Ingress | None, int]: try: - consumed, frame = decode_pika_frame(buffer) + len_consumed, frame = decode_pika_frame(buffer, frame_max) match frame: case None: return validate_buffer_length(buffer, max_buffer), len(buffer) case pf.ProtocolHeader(): - return ProtocolHeader(buffer[:consumed]), consumed + return ProtocolHeader(buffer[:len_consumed]), len_consumed case pf.Heartbeat(): - return Heartbeat(), consumed + return Heartbeat(), len_consumed case pf.Method(): - return decode_method(buffer, consumed, frame, max_buffer) + return decode_method(buffer, len_consumed, frame, frame_max, max_buffer) case _: reason = f"unexpected frame: {type(frame).__name__}" return Undecodable(reason), len(buffer) @@ -728,17 +726,18 @@ def decode_one(buffer: bytes, max_buffer: int) -> tuple[Ingress | None, int]: return Undecodable(str(bad)), len(buffer) -def decode(buffer: bytes, max_buffer: int) -> tuple[tuple[Ingress, ...], bytes]: - items: list[Ingress] = [] - rest = buffer +def decode_many( + buffer: bytes, frame_max: Callable[[], int], max_buffer: int +) -> Iterator[tuple[Ingress, bytes]]: + while True: + item, len_consumed = decode_one(buffer, frame_max(), max_buffer) - while rest: - item, consumed = decode_one(rest, max_buffer) - - if item is None: - return tuple(items), rest - - items.append(item) - rest = b"" if isinstance(item, Undecodable) else rest[consumed:] - - return tuple(items), rest + match item: + case None: + return + case Undecodable(): + yield item, b"" + return + case _: + buffer = buffer[len_consumed:] + yield item, buffer diff --git a/src/tests/amqp_imposter/amqp_imposter/amqp/server.py b/src/tests/amqp_imposter/amqp_imposter/amqp/server.py index b40a9f8a..26478008 100644 --- a/src/tests/amqp_imposter/amqp_imposter/amqp/server.py +++ b/src/tests/amqp_imposter/amqp_imposter/amqp/server.py @@ -14,6 +14,7 @@ # limitations under the License. import asyncio +import math from collections.abc import AsyncGenerator from contextlib import asynccontextmanager, suppress from dataclasses import dataclass, field @@ -25,6 +26,20 @@ READ_BYTES = 64 * 1024 +def server_heartbeat_period_s(heartbeat_interval_s: int) -> float: + if heartbeat_interval_s == 0: + return math.inf + + return heartbeat_interval_s / 2 + + +def client_heartbeat_timeout_s(heartbeat_interval_s: int) -> float: + if heartbeat_interval_s == 0: + return math.inf + + return heartbeat_interval_s * 2 + + @dataclass(slots=True) class AmqpServer: session: Session @@ -91,13 +106,10 @@ async def do_actions( return False async def timebound_read( - self, reader: asyncio.StreamReader, time_s: float + self, reader: asyncio.StreamReader, deadline: float ) -> bytes | None: - if time_s <= 0.0: - return None - try: - async with asyncio.timeout(time_s): + async with asyncio.timeout_at(deadline): return await reader.read(READ_BYTES) except TimeoutError: return None @@ -108,27 +120,44 @@ async def loop( self, reader: asyncio.StreamReader, writer: asyncio.StreamWriter ) -> None: loop = asyncio.get_running_loop() - idle = self.session.config.idle_millis / 1_000.0 - deadline = loop.time() + idle + + idle_s = self.session.config.idle_millis / 1_000.0 + + t_idle_last = loop.time() + t_hearts_last = loop.time() + t_ingress_last = loop.time() while True: - match await self.timebound_read(reader, deadline - loop.time()): + heart_s = self.session.effective_tunables().heartbeat + + t_idle_next = t_idle_last + idle_s + t_hearts_next = t_hearts_last + server_heartbeat_period_s(heart_s) + t_heartc_next = t_ingress_last + client_heartbeat_timeout_s(heart_s) + + deadline = min(t_idle_next, t_hearts_next, t_heartc_next) + + match await self.timebound_read(reader, deadline): + case None if deadline == t_heartc_next: + actions = self.session.on_client_heartbeat_deadline() + case None if deadline == t_hearts_next: + t_hearts_last = loop.time() + actions = self.session.on_server_heartbeat_deadline() case None: + t_idle_last = loop.time() actions = self.session.on_idle() - refreshed = True case b"": # EOF return case chunk: + t_ingress_last = loop.time() before = self.session.total_ingress_methods actions = self.session.on_ingress(chunk) - refreshed = self.session.total_ingress_methods > before + + if self.session.total_ingress_methods > before: + t_idle_last = t_ingress_last if await self.do_actions(actions, writer): return - if refreshed: - deadline = loop.time() + idle - async def serve( self, reader: asyncio.StreamReader, writer: asyncio.StreamWriter ) -> None: diff --git a/src/tests/amqp_imposter/amqp_imposter/amqp/session.py b/src/tests/amqp_imposter/amqp_imposter/amqp/session.py index 07076984..8e4503e9 100644 --- a/src/tests/amqp_imposter/amqp_imposter/amqp/session.py +++ b/src/tests/amqp_imposter/amqp_imposter/amqp/session.py @@ -14,12 +14,13 @@ # limitations under the License. import time -from dataclasses import dataclass, field +from dataclasses import dataclass, field, replace from ..model import generators as g from ..model import method_fields as mf from ..model import methods as m from ..model import model_state as ms +from ..model.domains import Short from ..model.generators import DEFAULT_GEN_STATE from ..model.method_sampling import DEFAULT_MAX_BURST_LENGTH from ..model.method_scripts import ScriptRule @@ -32,6 +33,7 @@ from ..model.negotiation_options import ( DEFAULT_NEGOTIATION_OPTIONS, NegotiationOptions, + Tunables, ) from . import method_framing as fr from .transcript import ( @@ -46,15 +48,17 @@ GLOBAL_CHANNEL = 0 -REASON_SIMULTANEOUS_CONNECTION = "a connection is already active" -REASON_DUPE_PROTOCOL_HEADER = "the protocol header was already given" +REASON_SIMULTANEOUS_CONNECTION = "simultaneous connections are not supported" +REASON_DUPE_PROTOCOL_HEADER = "duplicate protocol header" REASON_UNSUPPORTED_PROTOCOL = "only AMQP 0-9-1 is supported" -REASON_NOT_GREETED = "no protocol header was given" -REASON_CONNECTION_NOT_ON_GLOBAL = "a connection method must be on the global channel" -REASON_CHANNEL_ON_GLOBAL = "a channel method cannot be on the global channel" -REASON_SIMULTANOUS_CHANNELS = "another channel is already open" -REASON_UNREPRESENTABLE = "the model does not represent the requested state transition" -REASON_NO_AMQP_CONNECTION = "the connection is closed" +REASON_NOT_GREETED = "missing protocol header" +REASON_CONNECTION_NOT_ON_GLOBAL = "method must be on the global channel" +REASON_CHANNEL_ON_GLOBAL = "method cannot be on the global channel" +REASON_CHANNEL_MAX_EXCEEDED = "channel number exceeds the negotiated channel-max" +REASON_SIMULTANOUS_CHANNELS = "simultaneous channels are not supported" +REASON_UNREPRESENTABLE = "model does not represent the requested state transition" +REASON_NO_AMQP_CONNECTION = "connection is closed" +REASON_HEARTBEAT_TIMEOUT = "client heartbeat timeout" @dataclass(frozen=True, slots=True) @@ -110,11 +114,6 @@ class Session: def __post_init__(self) -> None: self.start(self.config) - def fresh_model(self, gen_state: g.GenState) -> ModelServer: - return ModelServer( - negotiation_options=self.config.negotiation_options, gen_state=gen_state - ) - def transcribe( self, event: TranscriptEvent, @@ -139,7 +138,10 @@ def reset(self, config: SessionConfig | None = None) -> None: def start(self, config: SessionConfig) -> None: self.config = config - self.model = self.fresh_model(g.GenState(self.config.seed)) + self.model = ModelServer( + negotiation_options=config.negotiation_options, + gen_state=g.GenState(config.seed), + ) self.transcript = Transcript(lines_max=self.config.max_transcript_lines) self.buffer = b"" self.channel = None @@ -165,14 +167,14 @@ def on_rejected(self) -> tuple[SocketAction, ...]: def on_disconnected(self) -> tuple[SocketAction, ...]: self.transcribe(TranscriptEvent.TCP_DOWN) - self.model = self.fresh_model(self.model.gen_state) + self.model.receive_hard_disconnect() self.buffer = b"" self.channel = None self.greeted = False return () def on_idle(self) -> tuple[SocketAction, ...]: - methods = self.sample_method_burst( + methods, frame_max = self.sample_method_burst( (*self.config.idle_weights, *self.config.weights) ) if methods: @@ -180,13 +182,29 @@ def on_idle(self) -> tuple[SocketAction, ...]: # if someone really wants to they can predict where the no-op timeouts are anyway self.transcribe(TranscriptEvent.IDLE_TIMEOUT) - return self.egress(methods) + return self.egress(methods, frame_max) + + def on_client_heartbeat_deadline(self) -> tuple[SocketAction, ...]: + self.transcribe( + TranscriptEvent.HEARTBEAT_TIMEOUT, detail=REASON_HEARTBEAT_TIMEOUT + ) + return (SocketClose(REASON_HEARTBEAT_TIMEOUT),) + + def on_server_heartbeat_deadline(self) -> tuple[SocketAction, ...]: + wire_bytes = fr.encode(fr.Heartbeat(), self.effective_tunables().frame_max) + self.transcribe(TranscriptEvent.HEARTBEAT_EGRESS, wire_bytes=wire_bytes) + return (SocketWrite(wire_bytes),) def on_ingress(self, chunk: bytes) -> tuple[SocketAction, ...]: - items, self.buffer = fr.decode(self.buffer + chunk, self.config.max_buffer) + self.buffer += chunk actions: list[SocketAction] = [] - for item in items: + for item, rest in fr.decode_many( + self.buffer, + lambda: self.effective_tunables().frame_max, + self.config.max_buffer, + ): + self.buffer = rest actions.extend(self.on_item(item)) if any(isinstance(action, SocketClose) for action in actions): @@ -199,7 +217,7 @@ def on_item(self, item: fr.Ingress) -> tuple[SocketAction, ...]: case fr.ProtocolHeader(wire_bytes): return self.on_protocol_header(wire_bytes) case fr.Heartbeat(): - self.transcribe(TranscriptEvent.FRAME_HEARTBEAT) + self.transcribe(TranscriptEvent.HEARTBEAT_INGRESS) return () case fr.Undecodable(reason): self.transcribe(TranscriptEvent.FRAME_MALFORMED, detail=reason) @@ -235,9 +253,9 @@ def on_protocol_header(self, wire_bytes: bytes) -> tuple[SocketAction, ...]: return (SocketClose(REASON_UNREPRESENTABLE),) self.greeted = True - methods = self.sample_method_burst(self.config.weights) + methods, frame_max = self.sample_method_burst(self.config.weights) - return self.egress(methods) + return self.egress(methods, frame_max) def validate_channel(self, channel: int, method: m.Method) -> str | None: if not self.greeted: @@ -252,6 +270,9 @@ def validate_channel(self, channel: int, method: m.Method) -> str | None: if channel == GLOBAL_CHANNEL: return REASON_CHANNEL_ON_GLOBAL + if 0 < self.effective_tunables().channel_max < channel: + return REASON_CHANNEL_MAX_EXCEEDED + if self.channel is not None and channel != self.channel: return REASON_SIMULTANOUS_CHANNELS @@ -282,18 +303,28 @@ def on_method(self, channel: int, method: m.Method) -> tuple[SocketAction, ...]: if channel != GLOBAL_CHANNEL: self.channel = channel - methods = self.sample_method_burst(self.config.weights) - actions = self.egress(methods) + methods, frame_max = self.sample_method_burst(self.config.weights) + actions = self.egress(methods, frame_max) # maybe release the real channel according to the model state self.maybe_release_channel() - if self.finished(): + if self.is_finished(): return (*actions, SocketClose(REASON_NO_AMQP_CONNECTION)) return actions - def finished(self) -> bool: + def effective_tunables(self) -> Tunables: + match self.model.negotiated_tunables(): + case None: + # no heartbeats before negotiating + return replace( + self.config.negotiation_options.tunables, heartbeat=Short(0) + ) + case tunables: + return tunables + + def is_finished(self) -> bool: return self.greeted and isinstance( self.model.model_state.connection_state, ms.ClosedConnectionState ) @@ -315,25 +346,29 @@ def egress_channel(self, method: m.Method) -> int: def sample_method_burst( self, weighted_selectors: tuple[WeightedSelector, ...] - ) -> list[m.Method]: - return self.model.send_gens( + ) -> tuple[list[m.Method], int]: + # remember frame max in case we pull close-ok and reset + frame_max = self.effective_tunables().frame_max + methods = self.model.send_gens( self.config.script, weighted_selectors, self.config.stop_weight, self.config.max_burst_length, ) + return methods, frame_max - def egress(self, methods: list[m.Method]) -> tuple[SocketAction, ...]: + def egress( + self, methods: list[m.Method], frame_max: int + ) -> tuple[SocketAction, ...]: payload = b"" for method in methods: - encoded = fr.encode( - fr.MethodOnChannel(self.egress_channel(method), method), - self.config.negotiation_options.frame_max, + wire_bytes = fr.encode( + fr.MethodOnChannel(self.egress_channel(method), method), frame_max ) self.transcribe( - TranscriptEvent.METHOD_EGRESS, method=method, wire_bytes=encoded + TranscriptEvent.METHOD_EGRESS, method=method, wire_bytes=wire_bytes ) - payload += encoded + payload += wire_bytes return (SocketWrite(payload),) if payload else () diff --git a/src/tests/amqp_imposter/amqp_imposter/amqp/transcript.py b/src/tests/amqp_imposter/amqp_imposter/amqp/transcript.py index 4e575657..d6842d6e 100644 --- a/src/tests/amqp_imposter/amqp_imposter/amqp/transcript.py +++ b/src/tests/amqp_imposter/amqp_imposter/amqp/transcript.py @@ -34,7 +34,9 @@ class TranscriptEvent(StrEnum): IDLE_TIMEOUT = "IDLE_TIMEOUT" PROTOCOL_HEADER = "PROTOCOL_HEADER" FRAME_MALFORMED = "FRAME_MALFORMED" - FRAME_HEARTBEAT = "FRAME_HEARTBEAT" + HEARTBEAT_INGRESS = "HEARTBEAT_INGRESS" + HEARTBEAT_EGRESS = "HEARTBEAT_EGRESS" + HEARTBEAT_TIMEOUT = "HEARTBEAT_TIMEOUT" METHOD_INGRESS = "METHOD_INGRESS" METHOD_EGRESS = "METHOD_EGRESS" METHOD_UNREPRESENTABLE = "METHOD_UNREPRESENTABLE" diff --git a/src/tests/amqp_imposter/amqp_imposter/control/client/__init__.py b/src/tests/amqp_imposter/amqp_imposter/control/client/__init__.py index aea53ac5..2e474592 100644 --- a/src/tests/amqp_imposter/amqp_imposter/control/client/__init__.py +++ b/src/tests/amqp_imposter/amqp_imposter/control/client/__init__.py @@ -17,9 +17,11 @@ from ..transport import ImposterEndpoints from ..v1 import imposter_pb2 as pb from .configuration_util import ( + ConcreteMethod, PatternMethod, SelectorMethod, pattern, + pattern_matches, selector, weighted, when_receive, @@ -36,6 +38,7 @@ ) from .transcript_util import ( Transcript, + format_method, format_transcript, format_transcript_around, format_transcript_line, @@ -47,6 +50,7 @@ "FORCED_REPLY_TEXT", "NOT_FORCED_REPLY_TEXT", "AmqpImposter", + "ConcreteMethod", "ImposterEndpoints", "ImposterShutdownError", "ImposterStartupError", @@ -55,11 +59,13 @@ "Transcript", "amqp_imposter", "connect_imposter", + "format_method", "format_transcript", "format_transcript_around", "format_transcript_line", "parse_imposter_endpoints", "pattern", + "pattern_matches", "pb", "run_imposter", "seek_transcript_line", diff --git a/src/tests/amqp_imposter/amqp_imposter/control/client/configuration_util.py b/src/tests/amqp_imposter/amqp_imposter/control/client/configuration_util.py index 76ab16f7..2e3c0aaf 100644 --- a/src/tests/amqp_imposter/amqp_imposter/control/client/configuration_util.py +++ b/src/tests/amqp_imposter/amqp_imposter/control/client/configuration_util.py @@ -15,8 +15,51 @@ from google.protobuf.message import Message +from ...model import method_unification as mu +from .. import config_proto as cp +from .. import method_proto as mp from ..v1 import imposter_pb2 as pb +type ConcreteMethod = ( + pb.ConnectionStart + | pb.ConnectionStartOk + | pb.ConnectionTune + | pb.ConnectionTuneOk + | pb.ConnectionOpen + | pb.ConnectionOpenOk + | pb.ConnectionClose + | pb.ConnectionCloseOk + | pb.ChannelOpen + | pb.ChannelOpenOk + | pb.ChannelClose + | pb.ChannelCloseOk + | pb.ConfirmSelect + | pb.ConfirmSelectOk + | pb.ExchangeDeclare + | pb.ExchangeDeclareOk + | pb.QueueDeclare + | pb.QueueDeclareOk + | pb.QueueBind + | pb.QueueBindOk + | pb.BasicQos + | pb.BasicQosOk + | pb.BasicConsume + | pb.BasicConsumeOk + | pb.BasicCancel + | pb.BasicCancelOk + | pb.BasicPublish + | pb.BasicReturn + | pb.BasicAck + | pb.BasicNack + | pb.BasicReject + | pb.BasicDeliver + | pb.BasicGet + | pb.BasicGetOk + | pb.BasicGetEmpty + | pb.ExchangeBind + | pb.ExchangeBindOk +) + type SelectorMethod = ( pb.ConnectionStartSelector | pb.ConnectionStartOkSelector @@ -99,10 +142,9 @@ def wrap_in_method_oneof[C: Message](container: type[C], method: Message) -> C: + (oneof,) = container.DESCRIPTOR.oneofs (field_name,) = ( - field.name - for field in container.DESCRIPTOR.oneofs_by_name["method"].fields - if field.message_type == method.DESCRIPTOR + field.name for field in oneof.fields if field.message_type == method.DESCRIPTOR ) return container(**{field_name: method}) @@ -116,6 +158,13 @@ def pattern(method: PatternMethod) -> pb.Pattern: return wrap_in_method_oneof(pb.Pattern, method) +def pattern_matches(pattern: PatternMethod, method: ConcreteMethod) -> bool: + return mu.unifiable( + cp.pattern_from_proto(wrap_in_method_oneof(pb.Pattern, pattern)), + mp.from_proto(wrap_in_method_oneof(pb.Method, method)), + ) + + def weighted(method: SelectorMethod, weight: int | None = None) -> pb.Weighted: return pb.Weighted(selector=selector(method), weight=weight) diff --git a/src/tests/amqp_imposter/amqp_imposter/control/client/transcript_util.py b/src/tests/amqp_imposter/amqp_imposter/control/client/transcript_util.py index 2ccf0138..a8289096 100644 --- a/src/tests/amqp_imposter/amqp_imposter/control/client/transcript_util.py +++ b/src/tests/amqp_imposter/amqp_imposter/control/client/transcript_util.py @@ -22,6 +22,7 @@ from google.protobuf.message import Message from ..v1 import imposter_pb2 as pb +from .configuration_util import ConcreteMethod, PatternMethod class Transcript(tuple[pb.TranscriptLine, ...]): @@ -48,7 +49,7 @@ def format_direction_arrow(event: pb.TranscriptEvent.ValueType) -> str: # all ingress if event in ( pb.TRANSCRIPT_EVENT_PROTOCOL_HEADER, - pb.TRANSCRIPT_EVENT_FRAME_HEARTBEAT, + pb.TRANSCRIPT_EVENT_HEARTBEAT_INGRESS, pb.TRANSCRIPT_EVENT_FRAME_MALFORMED, pb.TRANSCRIPT_EVENT_METHOD_INGRESS, pb.TRANSCRIPT_EVENT_METHOD_UNREPRESENTABLE, @@ -56,7 +57,10 @@ def format_direction_arrow(event: pb.TranscriptEvent.ValueType) -> str: return INGRESS_ARROW # all egress - if event in (pb.TRANSCRIPT_EVENT_METHOD_EGRESS,): + if event in ( + pb.TRANSCRIPT_EVENT_HEARTBEAT_EGRESS, + pb.TRANSCRIPT_EVENT_METHOD_EGRESS, + ): return EGRESS_ARROW return NO_ARROW @@ -85,6 +89,18 @@ def format_proto_message(message: Message) -> str: ) +def format_method(method: ConcreteMethod | PatternMethod) -> str: + (kind,) = ( + field.name + for container in (pb.Method, pb.Pattern) + for oneof in container.DESCRIPTOR.oneofs + for field in oneof.fields + if field.message_type == method.DESCRIPTOR + ) + + return f"{kind} {format_proto_message(method)}".rstrip() + + def format_line_name(line: pb.TranscriptLine) -> str: return line.method.WhichOneof("kind") or format_event_name(line.event) @@ -99,10 +115,12 @@ def format_line_name(line: pb.TranscriptLine) -> str: W_METHOD_FIELDS = 100 -def transcript_line_method(line: pb.TranscriptLine) -> Message | None: - if (kind := line.method.WhichOneof("kind")) is not None: - return cast(Message, getattr(line.method, kind)) - return None +def transcript_line_method(line: pb.TranscriptLine) -> ConcreteMethod | None: + match line.method.WhichOneof("kind"): + case None: + return None + case kind: + return cast(ConcreteMethod, getattr(line.method, kind)) def format_transcript_line(line: pb.TranscriptLine) -> str: diff --git a/src/tests/amqp_imposter/amqp_imposter/control/config_proto.py b/src/tests/amqp_imposter/amqp_imposter/control/config_proto.py index 72ecbe57..8e7636f6 100644 --- a/src/tests/amqp_imposter/amqp_imposter/control/config_proto.py +++ b/src/tests/amqp_imposter/amqp_imposter/control/config_proto.py @@ -26,7 +26,9 @@ from ..model.method_weights import BASE_WEIGHT, BadWeight, WeightedSelector from ..model.negotiation_options import ( DEFAULT_NEGOTIATION_OPTIONS, + Capabilities, NegotiationOptions, + Tunables, ) from .method_proto import method_oneof from .v1 import imposter_pb2 as pb @@ -130,12 +132,12 @@ def negotiation_to_proto(options: NegotiationOptions) -> pb.NegotiationOptions: return pb.NegotiationOptions( mechanisms=pb.StringList(items=options.mechanisms), locales=pb.StringList(items=options.locales), - publisher_confirms=options.publisher_confirms, - basic_nack=options.basic_nack, - consumer_cancel_notify=options.consumer_cancel_notify, - channel_max=options.channel_max, - frame_max=options.frame_max, - heartbeat=options.heartbeat, + publisher_confirms=options.capabilities.publisher_confirms, + basic_nack=options.capabilities.basic_nack, + consumer_cancel_notify=options.capabilities.consumer_cancel_notify, + channel_max=options.tunables.channel_max, + frame_max=options.tunables.frame_max, + heartbeat=options.tunables.heartbeat, ) @@ -150,24 +152,28 @@ def negotiation_from_proto(message: pb.NegotiationOptions) -> NegotiationOptions locales=validated_nonempty_tuple(message.locales.items, "locales") if message.HasField("locales") else default.locales, - publisher_confirms=message.publisher_confirms - if message.HasField("publisher_confirms") - else default.publisher_confirms, - basic_nack=message.basic_nack - if message.HasField("basic_nack") - else default.basic_nack, - consumer_cancel_notify=message.consumer_cancel_notify - if message.HasField("consumer_cancel_notify") - else default.consumer_cancel_notify, - channel_max=Short(message.channel_max) - if message.HasField("channel_max") - else default.channel_max, - frame_max=Long(message.frame_max) - if message.HasField("frame_max") - else default.frame_max, - heartbeat=Short(message.heartbeat) - if message.HasField("heartbeat") - else default.heartbeat, + capabilities=Capabilities( + publisher_confirms=message.publisher_confirms + if message.HasField("publisher_confirms") + else default.capabilities.publisher_confirms, + basic_nack=message.basic_nack + if message.HasField("basic_nack") + else default.capabilities.basic_nack, + consumer_cancel_notify=message.consumer_cancel_notify + if message.HasField("consumer_cancel_notify") + else default.capabilities.consumer_cancel_notify, + ), + tunables=Tunables( + channel_max=Short(message.channel_max) + if message.HasField("channel_max") + else default.tunables.channel_max, + frame_max=Long(message.frame_max) + if message.HasField("frame_max") + else default.tunables.frame_max, + heartbeat=Short(message.heartbeat) + if message.HasField("heartbeat") + else default.tunables.heartbeat, + ), ) except BadDomain as bad: raise ImposterError(str(bad)) from bad @@ -176,9 +182,10 @@ def negotiation_from_proto(message: pb.NegotiationOptions) -> NegotiationOptions def validated_negotiation_options(options: NegotiationOptions) -> NegotiationOptions: - if options.frame_max < c.FRAME_MIN_FLOOR: + if 0 < options.tunables.frame_max < c.FRAME_MIN_FLOOR: raise ImposterError( - f"frame_max below {c.FRAME_MIN_FLOOR}: {options.frame_max}", + f"frame_max must be 0 or at least {c.FRAME_MIN_FLOOR}: " + f"{options.tunables.frame_max}", ) return options diff --git a/src/tests/amqp_imposter/amqp_imposter/control/method_proto.py b/src/tests/amqp_imposter/amqp_imposter/control/method_proto.py index aa868a71..1b588184 100644 --- a/src/tests/amqp_imposter/amqp_imposter/control/method_proto.py +++ b/src/tests/amqp_imposter/amqp_imposter/control/method_proto.py @@ -291,8 +291,12 @@ def transcript_event_to_proto(event: TranscriptEvent) -> pb.TranscriptEvent.Valu return pb.TRANSCRIPT_EVENT_PROTOCOL_HEADER case TranscriptEvent.FRAME_MALFORMED: return pb.TRANSCRIPT_EVENT_FRAME_MALFORMED - case TranscriptEvent.FRAME_HEARTBEAT: - return pb.TRANSCRIPT_EVENT_FRAME_HEARTBEAT + case TranscriptEvent.HEARTBEAT_INGRESS: + return pb.TRANSCRIPT_EVENT_HEARTBEAT_INGRESS + case TranscriptEvent.HEARTBEAT_EGRESS: + return pb.TRANSCRIPT_EVENT_HEARTBEAT_EGRESS + case TranscriptEvent.HEARTBEAT_TIMEOUT: + return pb.TRANSCRIPT_EVENT_HEARTBEAT_TIMEOUT case TranscriptEvent.METHOD_INGRESS: return pb.TRANSCRIPT_EVENT_METHOD_INGRESS case TranscriptEvent.METHOD_EGRESS: diff --git a/src/tests/amqp_imposter/amqp_imposter/control/v1/imposter_pb2.py b/src/tests/amqp_imposter/amqp_imposter/control/v1/imposter_pb2.py index ba0a38dc..4742c322 100644 --- a/src/tests/amqp_imposter/amqp_imposter/control/v1/imposter_pb2.py +++ b/src/tests/amqp_imposter/amqp_imposter/control/v1/imposter_pb2.py @@ -25,7 +25,7 @@ from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\'amqp_imposter/control/v1/imposter.proto\x12\x18\x61mqp_imposter.control.v1\x1a\x1fgoogle/protobuf/timestamp.proto\"\x06\n\x04Void\"\x1b\n\nStringList\x12\r\n\x05items\x18\x01 \x03(\t\"\xba\x02\n\tAmqpValue\x12\x11\n\x07\x62oolean\x18\x01 \x01(\x08H\x00\x12\x0e\n\x04long\x18\x02 \x01(\x03H\x00\x12\x10\n\x06string\x18\x03 \x01(\tH\x00\x12\x0f\n\x05\x62ytes\x18\x04 \x01(\x0cH\x00\x12\x11\n\x07\x64\x65\x63imal\x18\x05 \x01(\tH\x00\x12/\n\ttimestamp\x18\x06 \x01(\x0b\x32\x1a.google.protobuf.TimestampH\x00\x12.\n\x04void\x18\x07 \x01(\x0b\x32\x1e.amqp_imposter.control.v1.VoidH\x00\x12\x34\n\x05table\x18\x08 \x01(\x0b\x32#.amqp_imposter.control.v1.AmqpTableH\x00\x12\x34\n\x05\x61rray\x18\t \x01(\x0b\x32#.amqp_imposter.control.v1.AmqpArrayH\x00\x42\x07\n\x05value\"\xa3\x01\n\tAmqpTable\x12\x41\n\x07\x65ntries\x18\x01 \x03(\x0b\x32\x30.amqp_imposter.control.v1.AmqpTable.EntriesEntry\x1aS\n\x0c\x45ntriesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x32\n\x05value\x18\x02 \x01(\x0b\x32#.amqp_imposter.control.v1.AmqpValue:\x02\x38\x01\"?\n\tAmqpArray\x12\x32\n\x05items\x18\x01 \x03(\x0b\x32#.amqp_imposter.control.v1.AmqpValue\"\xb4\x04\n\x11MessageProperties\x12\x19\n\x0c\x63ontent_type\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1d\n\x10\x63ontent_encoding\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x39\n\x07headers\x18\x03 \x01(\x0b\x32#.amqp_imposter.control.v1.AmqpTableH\x02\x88\x01\x01\x12\x1a\n\rdelivery_mode\x18\x04 \x01(\rH\x03\x88\x01\x01\x12\x15\n\x08priority\x18\x05 \x01(\rH\x04\x88\x01\x01\x12\x1b\n\x0e\x63orrelation_id\x18\x06 \x01(\tH\x05\x88\x01\x01\x12\x15\n\x08reply_to\x18\x07 \x01(\tH\x06\x88\x01\x01\x12\x17\n\nexpiration\x18\x08 \x01(\tH\x07\x88\x01\x01\x12\x17\n\nmessage_id\x18\t \x01(\tH\x08\x88\x01\x01\x12\x16\n\ttimestamp\x18\n \x01(\x04H\t\x88\x01\x01\x12\x11\n\x04type\x18\x0b \x01(\tH\n\x88\x01\x01\x12\x14\n\x07user_id\x18\x0c \x01(\tH\x0b\x88\x01\x01\x12\x13\n\x06\x61pp_id\x18\r \x01(\tH\x0c\x88\x01\x01\x42\x0f\n\r_content_typeB\x13\n\x11_content_encodingB\n\n\x08_headersB\x10\n\x0e_delivery_modeB\x0b\n\t_priorityB\x11\n\x0f_correlation_idB\x0b\n\t_reply_toB\r\n\x0b_expirationB\r\n\x0b_message_idB\x0c\n\n_timestampB\x07\n\x05_typeB\n\n\x08_user_idB\t\n\x07_app_id\"\xc0\x03\n\x12NegotiationOptions\x12=\n\nmechanisms\x18\x01 \x01(\x0b\x32$.amqp_imposter.control.v1.StringListH\x00\x88\x01\x01\x12:\n\x07locales\x18\x02 \x01(\x0b\x32$.amqp_imposter.control.v1.StringListH\x01\x88\x01\x01\x12\x1f\n\x12publisher_confirms\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12\x17\n\nbasic_nack\x18\x04 \x01(\x08H\x03\x88\x01\x01\x12#\n\x16\x63onsumer_cancel_notify\x18\x05 \x01(\x08H\x04\x88\x01\x01\x12\x18\n\x0b\x63hannel_max\x18\x06 \x01(\rH\x05\x88\x01\x01\x12\x16\n\tframe_max\x18\x07 \x01(\rH\x06\x88\x01\x01\x12\x16\n\theartbeat\x18\x08 \x01(\rH\x07\x88\x01\x01\x42\r\n\x0b_mechanismsB\n\n\x08_localesB\x15\n\x13_publisher_confirmsB\r\n\x0b_basic_nackB\x19\n\x17_consumer_cancel_notifyB\x0e\n\x0c_channel_maxB\x0c\n\n_frame_maxB\x0c\n\n_heartbeat\"\xb4\x01\n\x0f\x43onnectionStart\x12\x15\n\rversion_major\x18\x01 \x01(\r\x12\x15\n\rversion_minor\x18\x02 \x01(\r\x12\x12\n\nmechanisms\x18\x03 \x03(\t\x12\x0f\n\x07locales\x18\x04 \x03(\t\x12\x1a\n\x12publisher_confirms\x18\x05 \x01(\x08\x12\x12\n\nbasic_nack\x18\x06 \x01(\x08\x12\x1e\n\x16\x63onsumer_cancel_notify\x18\x07 \x01(\x08\"\xab\x03\n\x17\x43onnectionStartSelector\x12\x1a\n\rversion_major\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x1a\n\rversion_minor\x18\x02 \x01(\rH\x01\x88\x01\x01\x12=\n\nmechanisms\x18\x03 \x01(\x0b\x32$.amqp_imposter.control.v1.StringListH\x02\x88\x01\x01\x12:\n\x07locales\x18\x04 \x01(\x0b\x32$.amqp_imposter.control.v1.StringListH\x03\x88\x01\x01\x12\x1f\n\x12publisher_confirms\x18\x05 \x01(\x08H\x04\x88\x01\x01\x12\x17\n\nbasic_nack\x18\x06 \x01(\x08H\x05\x88\x01\x01\x12#\n\x16\x63onsumer_cancel_notify\x18\x07 \x01(\x08H\x06\x88\x01\x01\x42\x10\n\x0e_version_majorB\x10\n\x0e_version_minorB\r\n\x0b_mechanismsB\n\n\x08_localesB\x15\n\x13_publisher_confirmsB\r\n\x0b_basic_nackB\x19\n\x17_consumer_cancel_notify\"\xaa\x03\n\x16\x43onnectionStartPattern\x12\x1a\n\rversion_major\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x1a\n\rversion_minor\x18\x02 \x01(\rH\x01\x88\x01\x01\x12=\n\nmechanisms\x18\x03 \x01(\x0b\x32$.amqp_imposter.control.v1.StringListH\x02\x88\x01\x01\x12:\n\x07locales\x18\x04 \x01(\x0b\x32$.amqp_imposter.control.v1.StringListH\x03\x88\x01\x01\x12\x1f\n\x12publisher_confirms\x18\x05 \x01(\x08H\x04\x88\x01\x01\x12\x17\n\nbasic_nack\x18\x06 \x01(\x08H\x05\x88\x01\x01\x12#\n\x16\x63onsumer_cancel_notify\x18\x07 \x01(\x08H\x06\x88\x01\x01\x42\x10\n\x0e_version_majorB\x10\n\x0e_version_minorB\r\n\x0b_mechanismsB\n\n\x08_localesB\x15\n\x13_publisher_confirmsB\r\n\x0b_basic_nackB\x19\n\x17_consumer_cancel_notify\"H\n\x11\x43onnectionStartOk\x12\x11\n\tmechanism\x18\x01 \x01(\t\x12\x0e\n\x06locale\x18\x02 \x01(\t\x12\x10\n\x08response\x18\x03 \x01(\t\"g\n\x19\x43onnectionStartOkSelector\x12\x16\n\tmechanism\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06locale\x18\x02 \x01(\tH\x01\x88\x01\x01\x42\x0c\n\n_mechanismB\t\n\x07_localeJ\x04\x08\x03\x10\x04\"\x84\x01\n\x18\x43onnectionStartOkPattern\x12\x16\n\tmechanism\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06locale\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x15\n\x08response\x18\x03 \x01(\tH\x02\x88\x01\x01\x42\x0c\n\n_mechanismB\t\n\x07_localeB\x0b\n\t_response\"K\n\x0e\x43onnectionTune\x12\x13\n\x0b\x63hannel_max\x18\x01 \x01(\r\x12\x11\n\tframe_max\x18\x02 \x01(\r\x12\x11\n\theartbeat\x18\x03 \x01(\r\"\x8e\x01\n\x16\x43onnectionTuneSelector\x12\x18\n\x0b\x63hannel_max\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x16\n\tframe_max\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x16\n\theartbeat\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x0e\n\x0c_channel_maxB\x0c\n\n_frame_maxB\x0c\n\n_heartbeat\"\x8d\x01\n\x15\x43onnectionTunePattern\x12\x18\n\x0b\x63hannel_max\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x16\n\tframe_max\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x16\n\theartbeat\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x0e\n\x0c_channel_maxB\x0c\n\n_frame_maxB\x0c\n\n_heartbeat\"M\n\x10\x43onnectionTuneOk\x12\x13\n\x0b\x63hannel_max\x18\x01 \x01(\r\x12\x11\n\tframe_max\x18\x02 \x01(\r\x12\x11\n\theartbeat\x18\x03 \x01(\r\"\x90\x01\n\x18\x43onnectionTuneOkSelector\x12\x18\n\x0b\x63hannel_max\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x16\n\tframe_max\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x16\n\theartbeat\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x0e\n\x0c_channel_maxB\x0c\n\n_frame_maxB\x0c\n\n_heartbeat\"\x8f\x01\n\x17\x43onnectionTuneOkPattern\x12\x18\n\x0b\x63hannel_max\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x16\n\tframe_max\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x16\n\theartbeat\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x0e\n\x0c_channel_maxB\x0c\n\n_frame_maxB\x0c\n\n_heartbeat\"\x1f\n\x0e\x43onnectionOpen\x12\r\n\x05vhost\x18\x01 \x01(\t\"\x1e\n\x16\x43onnectionOpenSelectorJ\x04\x08\x01\x10\x02\"5\n\x15\x43onnectionOpenPattern\x12\x12\n\x05vhost\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x08\n\x06_vhost\"\x12\n\x10\x43onnectionOpenOk\"\x1a\n\x18\x43onnectionOpenOkSelector\"\x19\n\x17\x43onnectionOpenOkPattern\"^\n\x0f\x43onnectionClose\x12\x12\n\nreply_code\x18\x01 \x01(\r\x12\x12\n\nreply_text\x18\x02 \x01(\t\x12\x10\n\x08\x63lass_id\x18\x03 \x01(\r\x12\x11\n\tmethod_id\x18\x04 \x01(\r\"\xb3\x01\n\x17\x43onnectionCloseSelector\x12\x17\n\nreply_code\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x17\n\nreply_text\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x15\n\x08\x63lass_id\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x16\n\tmethod_id\x18\x04 \x01(\rH\x03\x88\x01\x01\x42\r\n\x0b_reply_codeB\r\n\x0b_reply_textB\x0b\n\t_class_idB\x0c\n\n_method_id\"\xb2\x01\n\x16\x43onnectionClosePattern\x12\x17\n\nreply_code\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x17\n\nreply_text\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x15\n\x08\x63lass_id\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x16\n\tmethod_id\x18\x04 \x01(\rH\x03\x88\x01\x01\x42\r\n\x0b_reply_codeB\r\n\x0b_reply_textB\x0b\n\t_class_idB\x0c\n\n_method_id\"\x13\n\x11\x43onnectionCloseOk\"\x1b\n\x19\x43onnectionCloseOkSelector\"\x1a\n\x18\x43onnectionCloseOkPattern\"\r\n\x0b\x43hannelOpen\"\x15\n\x13\x43hannelOpenSelector\"\x14\n\x12\x43hannelOpenPattern\"\x0f\n\rChannelOpenOk\"\x17\n\x15\x43hannelOpenOkSelector\"\x16\n\x14\x43hannelOpenOkPattern\"[\n\x0c\x43hannelClose\x12\x12\n\nreply_code\x18\x01 \x01(\r\x12\x12\n\nreply_text\x18\x02 \x01(\t\x12\x10\n\x08\x63lass_id\x18\x03 \x01(\r\x12\x11\n\tmethod_id\x18\x04 \x01(\r\"\xb0\x01\n\x14\x43hannelCloseSelector\x12\x17\n\nreply_code\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x17\n\nreply_text\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x15\n\x08\x63lass_id\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x16\n\tmethod_id\x18\x04 \x01(\rH\x03\x88\x01\x01\x42\r\n\x0b_reply_codeB\r\n\x0b_reply_textB\x0b\n\t_class_idB\x0c\n\n_method_id\"\xaf\x01\n\x13\x43hannelClosePattern\x12\x17\n\nreply_code\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x17\n\nreply_text\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x15\n\x08\x63lass_id\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x16\n\tmethod_id\x18\x04 \x01(\rH\x03\x88\x01\x01\x42\r\n\x0b_reply_codeB\r\n\x0b_reply_textB\x0b\n\t_class_idB\x0c\n\n_method_id\"\x10\n\x0e\x43hannelCloseOk\"\x18\n\x16\x43hannelCloseOkSelector\"\x17\n\x15\x43hannelCloseOkPattern\" \n\rConfirmSelect\x12\x0f\n\x07no_wait\x18\x01 \x01(\x08\"\x1d\n\x15\x43onfirmSelectSelectorJ\x04\x08\x01\x10\x02\"8\n\x14\x43onfirmSelectPattern\x12\x14\n\x07no_wait\x18\x01 \x01(\x08H\x00\x88\x01\x01\x42\n\n\x08_no_wait\"\x11\n\x0f\x43onfirmSelectOk\"\x19\n\x17\x43onfirmSelectOkSelector\"\x18\n\x16\x43onfirmSelectOkPattern\"\xdf\x01\n\x0f\x45xchangeDeclare\x12\x10\n\x08\x65xchange\x18\x01 \x01(\t\x12\x15\n\rexchange_type\x18\x02 \x01(\t\x12\x0f\n\x07passive\x18\x03 \x01(\x08\x12\x0f\n\x07\x64urable\x18\x04 \x01(\x08\x12\x13\n\x0b\x61uto_delete\x18\x05 \x01(\x08\x12\x10\n\x08internal\x18\x06 \x01(\x08\x12\x0f\n\x07no_wait\x18\x07 \x01(\x08\x12;\n\targuments\x18\x08 \x01(\x0b\x32#.amqp_imposter.control.v1.AmqpTableH\x00\x88\x01\x01\x42\x0c\n\n_arguments\"C\n\x17\x45xchangeDeclareSelector\x12\x15\n\x08\x65xchange\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x0b\n\t_exchangeJ\x04\x08\x02\x10\t\"\xe9\x02\n\x16\x45xchangeDeclarePattern\x12\x15\n\x08\x65xchange\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1a\n\rexchange_type\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x14\n\x07passive\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12\x14\n\x07\x64urable\x18\x04 \x01(\x08H\x03\x88\x01\x01\x12\x18\n\x0b\x61uto_delete\x18\x05 \x01(\x08H\x04\x88\x01\x01\x12\x15\n\x08internal\x18\x06 \x01(\x08H\x05\x88\x01\x01\x12\x14\n\x07no_wait\x18\x07 \x01(\x08H\x06\x88\x01\x01\x12;\n\targuments\x18\x08 \x01(\x0b\x32#.amqp_imposter.control.v1.AmqpTableH\x07\x88\x01\x01\x42\x0b\n\t_exchangeB\x10\n\x0e_exchange_typeB\n\n\x08_passiveB\n\n\x08_durableB\x0e\n\x0c_auto_deleteB\x0b\n\t_internalB\n\n\x08_no_waitB\x0c\n\n_arguments\"\x13\n\x11\x45xchangeDeclareOk\"\x1b\n\x19\x45xchangeDeclareOkSelector\"\x1a\n\x18\x45xchangeDeclareOkPattern\"\xa4\x01\n\x0c\x45xchangeBind\x12\x13\n\x0b\x64\x65stination\x18\x01 \x01(\t\x12\x0e\n\x06source\x18\x02 \x01(\t\x12\x13\n\x0brouting_key\x18\x03 \x01(\t\x12\x0f\n\x07no_wait\x18\x04 \x01(\x08\x12;\n\targuments\x18\x05 \x01(\x0b\x32#.amqp_imposter.control.v1.AmqpTableH\x00\x88\x01\x01\x42\x0c\n\n_arguments\"\x1c\n\x14\x45xchangeBindSelectorJ\x04\x08\x01\x10\x06\"\xf6\x01\n\x13\x45xchangeBindPattern\x12\x18\n\x0b\x64\x65stination\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06source\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x18\n\x0brouting_key\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x14\n\x07no_wait\x18\x04 \x01(\x08H\x03\x88\x01\x01\x12;\n\targuments\x18\x05 \x01(\x0b\x32#.amqp_imposter.control.v1.AmqpTableH\x04\x88\x01\x01\x42\x0e\n\x0c_destinationB\t\n\x07_sourceB\x0e\n\x0c_routing_keyB\n\n\x08_no_waitB\x0c\n\n_arguments\"\x10\n\x0e\x45xchangeBindOk\"\x18\n\x16\x45xchangeBindOkSelector\"\x17\n\x15\x45xchangeBindOkPattern\"\xc3\x01\n\x0cQueueDeclare\x12\r\n\x05queue\x18\x01 \x01(\t\x12\x0f\n\x07passive\x18\x02 \x01(\x08\x12\x0f\n\x07\x64urable\x18\x03 \x01(\x08\x12\x11\n\texclusive\x18\x04 \x01(\x08\x12\x13\n\x0b\x61uto_delete\x18\x05 \x01(\x08\x12\x0f\n\x07no_wait\x18\x06 \x01(\x08\x12;\n\targuments\x18\x07 \x01(\x0b\x32#.amqp_imposter.control.v1.AmqpTableH\x00\x88\x01\x01\x42\x0c\n\n_arguments\"\x1c\n\x14QueueDeclareSelectorJ\x04\x08\x01\x10\x08\"\xb4\x02\n\x13QueueDeclarePattern\x12\x12\n\x05queue\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x14\n\x07passive\x18\x02 \x01(\x08H\x01\x88\x01\x01\x12\x14\n\x07\x64urable\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12\x16\n\texclusive\x18\x04 \x01(\x08H\x03\x88\x01\x01\x12\x18\n\x0b\x61uto_delete\x18\x05 \x01(\x08H\x04\x88\x01\x01\x12\x14\n\x07no_wait\x18\x06 \x01(\x08H\x05\x88\x01\x01\x12;\n\targuments\x18\x07 \x01(\x0b\x32#.amqp_imposter.control.v1.AmqpTableH\x06\x88\x01\x01\x42\x08\n\x06_queueB\n\n\x08_passiveB\n\n\x08_durableB\x0c\n\n_exclusiveB\x0e\n\x0c_auto_deleteB\n\n\x08_no_waitB\x0c\n\n_arguments\"N\n\x0eQueueDeclareOk\x12\r\n\x05queue\x18\x01 \x01(\t\x12\x15\n\rmessage_count\x18\x02 \x01(\r\x12\x16\n\x0e\x63onsumer_count\x18\x03 \x01(\r\"\x1e\n\x16QueueDeclareOkSelectorJ\x04\x08\x01\x10\x04\"\x93\x01\n\x15QueueDeclareOkPattern\x12\x12\n\x05queue\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1a\n\rmessage_count\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x1b\n\x0e\x63onsumer_count\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_queueB\x10\n\x0e_message_countB\x11\n\x0f_consumer_count\"\x9d\x01\n\tQueueBind\x12\r\n\x05queue\x18\x01 \x01(\t\x12\x10\n\x08\x65xchange\x18\x02 \x01(\t\x12\x13\n\x0brouting_key\x18\x03 \x01(\t\x12\x0f\n\x07no_wait\x18\x04 \x01(\x08\x12;\n\targuments\x18\x05 \x01(\x0b\x32#.amqp_imposter.control.v1.AmqpTableH\x00\x88\x01\x01\x42\x0c\n\n_arguments\"\x19\n\x11QueueBindSelectorJ\x04\x08\x01\x10\x06\"\xeb\x01\n\x10QueueBindPattern\x12\x12\n\x05queue\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x15\n\x08\x65xchange\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x18\n\x0brouting_key\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x14\n\x07no_wait\x18\x04 \x01(\x08H\x03\x88\x01\x01\x12;\n\targuments\x18\x05 \x01(\x0b\x32#.amqp_imposter.control.v1.AmqpTableH\x04\x88\x01\x01\x42\x08\n\x06_queueB\x0b\n\t_exchangeB\x0e\n\x0c_routing_keyB\n\n\x08_no_waitB\x0c\n\n_arguments\"\r\n\x0bQueueBindOk\"\x15\n\x13QueueBindOkSelector\"\x14\n\x12QueueBindOkPattern\"M\n\x08\x42\x61sicQos\x12\x16\n\x0eprefetch_count\x18\x01 \x01(\r\x12\x15\n\rprefetch_size\x18\x02 \x01(\r\x12\x12\n\nglobal_qos\x18\x03 \x01(\x08\"\x18\n\x10\x42\x61sicQosSelectorJ\x04\x08\x01\x10\x04\"\x97\x01\n\x0f\x42\x61sicQosPattern\x12\x1b\n\x0eprefetch_count\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x1a\n\rprefetch_size\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x17\n\nglobal_qos\x18\x03 \x01(\x08H\x02\x88\x01\x01\x42\x11\n\x0f_prefetch_countB\x10\n\x0e_prefetch_sizeB\r\n\x0b_global_qos\"\x0c\n\nBasicQosOk\"\x14\n\x12\x42\x61sicQosOkSelector\"\x13\n\x11\x42\x61sicQosOkPattern\"\xc4\x01\n\x0c\x42\x61sicConsume\x12\r\n\x05queue\x18\x01 \x01(\t\x12\x14\n\x0c\x63onsumer_tag\x18\x02 \x01(\t\x12\x10\n\x08no_local\x18\x03 \x01(\x08\x12\x0e\n\x06no_ack\x18\x04 \x01(\x08\x12\x0f\n\x07no_wait\x18\x05 \x01(\x08\x12\x11\n\texclusive\x18\x06 \x01(\x08\x12;\n\targuments\x18\x07 \x01(\x0b\x32#.amqp_imposter.control.v1.AmqpTableH\x00\x88\x01\x01\x42\x0c\n\n_arguments\"\x1c\n\x14\x42\x61sicConsumeSelectorJ\x04\x08\x01\x10\x08\"\xb6\x02\n\x13\x42\x61sicConsumePattern\x12\x12\n\x05queue\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x19\n\x0c\x63onsumer_tag\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x15\n\x08no_local\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12\x13\n\x06no_ack\x18\x04 \x01(\x08H\x03\x88\x01\x01\x12\x14\n\x07no_wait\x18\x05 \x01(\x08H\x04\x88\x01\x01\x12\x16\n\texclusive\x18\x06 \x01(\x08H\x05\x88\x01\x01\x12;\n\targuments\x18\x07 \x01(\x0b\x32#.amqp_imposter.control.v1.AmqpTableH\x06\x88\x01\x01\x42\x08\n\x06_queueB\x0f\n\r_consumer_tagB\x0b\n\t_no_localB\t\n\x07_no_ackB\n\n\x08_no_waitB\x0c\n\n_exclusiveB\x0c\n\n_arguments\"&\n\x0e\x42\x61sicConsumeOk\x12\x14\n\x0c\x63onsumer_tag\x18\x01 \x01(\t\"\x1e\n\x16\x42\x61sicConsumeOkSelectorJ\x04\x08\x01\x10\x02\"C\n\x15\x42\x61sicConsumeOkPattern\x12\x19\n\x0c\x63onsumer_tag\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x0f\n\r_consumer_tag\"4\n\x0b\x42\x61sicCancel\x12\x14\n\x0c\x63onsumer_tag\x18\x01 \x01(\t\x12\x0f\n\x07no_wait\x18\x02 \x01(\x08\"G\n\x13\x42\x61sicCancelSelector\x12\x19\n\x0c\x63onsumer_tag\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x0f\n\r_consumer_tagJ\x04\x08\x02\x10\x03\"b\n\x12\x42\x61sicCancelPattern\x12\x19\n\x0c\x63onsumer_tag\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x14\n\x07no_wait\x18\x02 \x01(\x08H\x01\x88\x01\x01\x42\x0f\n\r_consumer_tagB\n\n\x08_no_wait\"%\n\rBasicCancelOk\x12\x14\n\x0c\x63onsumer_tag\x18\x01 \x01(\t\"C\n\x15\x42\x61sicCancelOkSelector\x12\x19\n\x0c\x63onsumer_tag\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x0f\n\r_consumer_tag\"B\n\x14\x42\x61sicCancelOkPattern\x12\x19\n\x0c\x63onsumer_tag\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x0f\n\r_consumer_tag\"\xbe\x01\n\x0c\x42\x61sicPublish\x12\x10\n\x08\x65xchange\x18\x01 \x01(\t\x12\x13\n\x0brouting_key\x18\x02 \x01(\t\x12\x11\n\tmandatory\x18\x03 \x01(\x08\x12\x11\n\timmediate\x18\x04 \x01(\x08\x12\x44\n\nproperties\x18\x05 \x01(\x0b\x32+.amqp_imposter.control.v1.MessagePropertiesH\x00\x88\x01\x01\x12\x0c\n\x04\x62ody\x18\x06 \x01(\x0c\x42\r\n\x0b_properties\"\x1c\n\x14\x42\x61sicPublishSelectorJ\x04\x08\x01\x10\x07\"\xa0\x02\n\x13\x42\x61sicPublishPattern\x12\x15\n\x08\x65xchange\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x18\n\x0brouting_key\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x16\n\tmandatory\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12\x16\n\timmediate\x18\x04 \x01(\x08H\x03\x88\x01\x01\x12\x44\n\nproperties\x18\x05 \x01(\x0b\x32+.amqp_imposter.control.v1.MessagePropertiesH\x04\x88\x01\x01\x12\x11\n\x04\x62ody\x18\x06 \x01(\x0cH\x05\x88\x01\x01\x42\x0b\n\t_exchangeB\x0e\n\x0c_routing_keyB\x0c\n\n_mandatoryB\x0c\n\n_immediateB\r\n\x0b_propertiesB\x07\n\x05_body\"\xbf\x01\n\x0b\x42\x61sicReturn\x12\x12\n\nreply_code\x18\x01 \x01(\r\x12\x12\n\nreply_text\x18\x02 \x01(\t\x12\x10\n\x08\x65xchange\x18\x03 \x01(\t\x12\x13\n\x0brouting_key\x18\x04 \x01(\t\x12\x44\n\nproperties\x18\x05 \x01(\x0b\x32+.amqp_imposter.control.v1.MessagePropertiesH\x00\x88\x01\x01\x12\x0c\n\x04\x62ody\x18\x06 \x01(\x0c\x42\r\n\x0b_properties\"\x9d\x01\n\x13\x42\x61sicReturnSelector\x12\x17\n\nreply_code\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x15\n\x08\x65xchange\x18\x03 \x01(\tH\x01\x88\x01\x01\x12\x18\n\x0brouting_key\x18\x04 \x01(\tH\x02\x88\x01\x01\x42\r\n\x0b_reply_codeB\x0b\n\t_exchangeB\x0e\n\x0c_routing_keyJ\x04\x08\x02\x10\x03J\x04\x08\x05\x10\x06J\x04\x08\x06\x10\x07\"\xa3\x02\n\x12\x42\x61sicReturnPattern\x12\x17\n\nreply_code\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x17\n\nreply_text\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x15\n\x08\x65xchange\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x18\n\x0brouting_key\x18\x04 \x01(\tH\x03\x88\x01\x01\x12\x44\n\nproperties\x18\x05 \x01(\x0b\x32+.amqp_imposter.control.v1.MessagePropertiesH\x04\x88\x01\x01\x12\x11\n\x04\x62ody\x18\x06 \x01(\x0cH\x05\x88\x01\x01\x42\r\n\x0b_reply_codeB\r\n\x0b_reply_textB\x0b\n\t_exchangeB\x0e\n\x0c_routing_keyB\r\n\x0b_propertiesB\x07\n\x05_body\"2\n\x08\x42\x61sicAck\x12\x14\n\x0c\x64\x65livery_tag\x18\x01 \x01(\x04\x12\x10\n\x08multiple\x18\x02 \x01(\x08\"D\n\x10\x42\x61sicAckSelector\x12\x19\n\x0c\x64\x65livery_tag\x18\x01 \x01(\x04H\x00\x88\x01\x01\x42\x0f\n\r_delivery_tagJ\x04\x08\x02\x10\x03\"a\n\x0f\x42\x61sicAckPattern\x12\x19\n\x0c\x64\x65livery_tag\x18\x01 \x01(\x04H\x00\x88\x01\x01\x12\x15\n\x08multiple\x18\x02 \x01(\x08H\x01\x88\x01\x01\x42\x0f\n\r_delivery_tagB\x0b\n\t_multiple\"D\n\tBasicNack\x12\x14\n\x0c\x64\x65livery_tag\x18\x01 \x01(\x04\x12\x10\n\x08multiple\x18\x02 \x01(\x08\x12\x0f\n\x07requeue\x18\x03 \x01(\x08\"K\n\x11\x42\x61sicNackSelector\x12\x19\n\x0c\x64\x65livery_tag\x18\x01 \x01(\x04H\x00\x88\x01\x01\x42\x0f\n\r_delivery_tagJ\x04\x08\x02\x10\x03J\x04\x08\x03\x10\x04\"\x84\x01\n\x10\x42\x61sicNackPattern\x12\x19\n\x0c\x64\x65livery_tag\x18\x01 \x01(\x04H\x00\x88\x01\x01\x12\x15\n\x08multiple\x18\x02 \x01(\x08H\x01\x88\x01\x01\x12\x14\n\x07requeue\x18\x03 \x01(\x08H\x02\x88\x01\x01\x42\x0f\n\r_delivery_tagB\x0b\n\t_multipleB\n\n\x08_requeue\"4\n\x0b\x42\x61sicReject\x12\x14\n\x0c\x64\x65livery_tag\x18\x01 \x01(\x04\x12\x0f\n\x07requeue\x18\x02 \x01(\x08\"G\n\x13\x42\x61sicRejectSelector\x12\x19\n\x0c\x64\x65livery_tag\x18\x01 \x01(\x04H\x00\x88\x01\x01\x42\x0f\n\r_delivery_tagJ\x04\x08\x02\x10\x03\"b\n\x12\x42\x61sicRejectPattern\x12\x19\n\x0c\x64\x65livery_tag\x18\x01 \x01(\x04H\x00\x88\x01\x01\x12\x14\n\x07requeue\x18\x02 \x01(\x08H\x01\x88\x01\x01\x42\x0f\n\r_delivery_tagB\n\n\x08_requeue\"\xd9\x01\n\x0c\x42\x61sicDeliver\x12\x14\n\x0c\x63onsumer_tag\x18\x01 \x01(\t\x12\x14\n\x0c\x64\x65livery_tag\x18\x02 \x01(\x04\x12\x13\n\x0bredelivered\x18\x03 \x01(\x08\x12\x10\n\x08\x65xchange\x18\x04 \x01(\t\x12\x13\n\x0brouting_key\x18\x05 \x01(\t\x12\x44\n\nproperties\x18\x06 \x01(\x0b\x32+.amqp_imposter.control.v1.MessagePropertiesH\x00\x88\x01\x01\x12\x0c\n\x04\x62ody\x18\x07 \x01(\x0c\x42\r\n\x0b_properties\"t\n\x14\x42\x61sicDeliverSelector\x12\x19\n\x0c\x63onsumer_tag\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x19\n\x0c\x64\x65livery_tag\x18\x02 \x01(\x04H\x01\x88\x01\x01\x42\x0f\n\r_consumer_tagB\x0f\n\r_delivery_tagJ\x04\x08\x03\x10\x08\"\xd6\x02\n\x13\x42\x61sicDeliverPattern\x12\x19\n\x0c\x63onsumer_tag\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x19\n\x0c\x64\x65livery_tag\x18\x02 \x01(\x04H\x01\x88\x01\x01\x12\x18\n\x0bredelivered\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12\x15\n\x08\x65xchange\x18\x04 \x01(\tH\x03\x88\x01\x01\x12\x18\n\x0brouting_key\x18\x05 \x01(\tH\x04\x88\x01\x01\x12\x44\n\nproperties\x18\x06 \x01(\x0b\x32+.amqp_imposter.control.v1.MessagePropertiesH\x05\x88\x01\x01\x12\x11\n\x04\x62ody\x18\x07 \x01(\x0cH\x06\x88\x01\x01\x42\x0f\n\r_consumer_tagB\x0f\n\r_delivery_tagB\x0e\n\x0c_redeliveredB\x0b\n\t_exchangeB\x0e\n\x0c_routing_keyB\r\n\x0b_propertiesB\x07\n\x05_body\")\n\x08\x42\x61sicGet\x12\r\n\x05queue\x18\x01 \x01(\t\x12\x0e\n\x06no_ack\x18\x02 \x01(\x08\"\x1e\n\x10\x42\x61sicGetSelectorJ\x04\x08\x01\x10\x02J\x04\x08\x02\x10\x03\"O\n\x0f\x42\x61sicGetPattern\x12\x12\n\x05queue\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06no_ack\x18\x02 \x01(\x08H\x01\x88\x01\x01\x42\x08\n\x06_queueB\t\n\x07_no_ack\"\xd8\x01\n\nBasicGetOk\x12\x14\n\x0c\x64\x65livery_tag\x18\x01 \x01(\x04\x12\x13\n\x0bredelivered\x18\x02 \x01(\x08\x12\x10\n\x08\x65xchange\x18\x03 \x01(\t\x12\x13\n\x0brouting_key\x18\x04 \x01(\t\x12\x15\n\rmessage_count\x18\x05 \x01(\r\x12\x44\n\nproperties\x18\x06 \x01(\x0b\x32+.amqp_imposter.control.v1.MessagePropertiesH\x00\x88\x01\x01\x12\x0c\n\x04\x62ody\x18\x07 \x01(\x0c\x42\r\n\x0b_properties\"F\n\x12\x42\x61sicGetOkSelector\x12\x19\n\x0c\x64\x65livery_tag\x18\x01 \x01(\x04H\x00\x88\x01\x01\x42\x0f\n\r_delivery_tagJ\x04\x08\x02\x10\x08\"\xd6\x02\n\x11\x42\x61sicGetOkPattern\x12\x19\n\x0c\x64\x65livery_tag\x18\x01 \x01(\x04H\x00\x88\x01\x01\x12\x18\n\x0bredelivered\x18\x02 \x01(\x08H\x01\x88\x01\x01\x12\x15\n\x08\x65xchange\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x18\n\x0brouting_key\x18\x04 \x01(\tH\x03\x88\x01\x01\x12\x1a\n\rmessage_count\x18\x05 \x01(\rH\x04\x88\x01\x01\x12\x44\n\nproperties\x18\x06 \x01(\x0b\x32+.amqp_imposter.control.v1.MessagePropertiesH\x05\x88\x01\x01\x12\x11\n\x04\x62ody\x18\x07 \x01(\x0cH\x06\x88\x01\x01\x42\x0f\n\r_delivery_tagB\x0e\n\x0c_redeliveredB\x0b\n\t_exchangeB\x0e\n\x0c_routing_keyB\x10\n\x0e_message_countB\r\n\x0b_propertiesB\x07\n\x05_body\"\x0f\n\rBasicGetEmpty\"\x17\n\x15\x42\x61sicGetEmptySelector\"\x16\n\x14\x42\x61sicGetEmptyPattern\"\xb5\x13\n\x06Method\x12\x45\n\x10\x63onnection_start\x18\x01 \x01(\x0b\x32).amqp_imposter.control.v1.ConnectionStartH\x00\x12J\n\x13\x63onnection_start_ok\x18\x02 \x01(\x0b\x32+.amqp_imposter.control.v1.ConnectionStartOkH\x00\x12\x43\n\x0f\x63onnection_tune\x18\x03 \x01(\x0b\x32(.amqp_imposter.control.v1.ConnectionTuneH\x00\x12H\n\x12\x63onnection_tune_ok\x18\x04 \x01(\x0b\x32*.amqp_imposter.control.v1.ConnectionTuneOkH\x00\x12\x43\n\x0f\x63onnection_open\x18\x05 \x01(\x0b\x32(.amqp_imposter.control.v1.ConnectionOpenH\x00\x12H\n\x12\x63onnection_open_ok\x18\x06 \x01(\x0b\x32*.amqp_imposter.control.v1.ConnectionOpenOkH\x00\x12\x45\n\x10\x63onnection_close\x18\x07 \x01(\x0b\x32).amqp_imposter.control.v1.ConnectionCloseH\x00\x12J\n\x13\x63onnection_close_ok\x18\x08 \x01(\x0b\x32+.amqp_imposter.control.v1.ConnectionCloseOkH\x00\x12=\n\x0c\x63hannel_open\x18\t \x01(\x0b\x32%.amqp_imposter.control.v1.ChannelOpenH\x00\x12\x42\n\x0f\x63hannel_open_ok\x18\n \x01(\x0b\x32\'.amqp_imposter.control.v1.ChannelOpenOkH\x00\x12?\n\rchannel_close\x18\x0b \x01(\x0b\x32&.amqp_imposter.control.v1.ChannelCloseH\x00\x12\x44\n\x10\x63hannel_close_ok\x18\x0c \x01(\x0b\x32(.amqp_imposter.control.v1.ChannelCloseOkH\x00\x12\x41\n\x0e\x63onfirm_select\x18\r \x01(\x0b\x32\'.amqp_imposter.control.v1.ConfirmSelectH\x00\x12\x46\n\x11\x63onfirm_select_ok\x18\x0e \x01(\x0b\x32).amqp_imposter.control.v1.ConfirmSelectOkH\x00\x12\x45\n\x10\x65xchange_declare\x18\x0f \x01(\x0b\x32).amqp_imposter.control.v1.ExchangeDeclareH\x00\x12J\n\x13\x65xchange_declare_ok\x18\x10 \x01(\x0b\x32+.amqp_imposter.control.v1.ExchangeDeclareOkH\x00\x12?\n\rqueue_declare\x18\x11 \x01(\x0b\x32&.amqp_imposter.control.v1.QueueDeclareH\x00\x12\x44\n\x10queue_declare_ok\x18\x12 \x01(\x0b\x32(.amqp_imposter.control.v1.QueueDeclareOkH\x00\x12\x39\n\nqueue_bind\x18\x13 \x01(\x0b\x32#.amqp_imposter.control.v1.QueueBindH\x00\x12>\n\rqueue_bind_ok\x18\x14 \x01(\x0b\x32%.amqp_imposter.control.v1.QueueBindOkH\x00\x12\x37\n\tbasic_qos\x18\x15 \x01(\x0b\x32\".amqp_imposter.control.v1.BasicQosH\x00\x12<\n\x0c\x62\x61sic_qos_ok\x18\x16 \x01(\x0b\x32$.amqp_imposter.control.v1.BasicQosOkH\x00\x12?\n\rbasic_consume\x18\x17 \x01(\x0b\x32&.amqp_imposter.control.v1.BasicConsumeH\x00\x12\x44\n\x10\x62\x61sic_consume_ok\x18\x18 \x01(\x0b\x32(.amqp_imposter.control.v1.BasicConsumeOkH\x00\x12=\n\x0c\x62\x61sic_cancel\x18\x19 \x01(\x0b\x32%.amqp_imposter.control.v1.BasicCancelH\x00\x12\x42\n\x0f\x62\x61sic_cancel_ok\x18\x1a \x01(\x0b\x32\'.amqp_imposter.control.v1.BasicCancelOkH\x00\x12?\n\rbasic_publish\x18\x1b \x01(\x0b\x32&.amqp_imposter.control.v1.BasicPublishH\x00\x12=\n\x0c\x62\x61sic_return\x18\x1c \x01(\x0b\x32%.amqp_imposter.control.v1.BasicReturnH\x00\x12\x37\n\tbasic_ack\x18\x1d \x01(\x0b\x32\".amqp_imposter.control.v1.BasicAckH\x00\x12\x39\n\nbasic_nack\x18\x1e \x01(\x0b\x32#.amqp_imposter.control.v1.BasicNackH\x00\x12=\n\x0c\x62\x61sic_reject\x18\x1f \x01(\x0b\x32%.amqp_imposter.control.v1.BasicRejectH\x00\x12?\n\rbasic_deliver\x18 \x01(\x0b\x32&.amqp_imposter.control.v1.BasicDeliverH\x00\x12\x37\n\tbasic_get\x18! \x01(\x0b\x32\".amqp_imposter.control.v1.BasicGetH\x00\x12<\n\x0c\x62\x61sic_get_ok\x18\" \x01(\x0b\x32$.amqp_imposter.control.v1.BasicGetOkH\x00\x12\x42\n\x0f\x62\x61sic_get_empty\x18# \x01(\x0b\x32\'.amqp_imposter.control.v1.BasicGetEmptyH\x00\x12?\n\rexchange_bind\x18$ \x01(\x0b\x32&.amqp_imposter.control.v1.ExchangeBindH\x00\x12\x44\n\x10\x65xchange_bind_ok\x18% \x01(\x0b\x32(.amqp_imposter.control.v1.ExchangeBindOkH\x00\x42\x06\n\x04kind\"\xe1\x15\n\x08Selector\x12M\n\x10\x63onnection_start\x18\x01 \x01(\x0b\x32\x31.amqp_imposter.control.v1.ConnectionStartSelectorH\x00\x12R\n\x13\x63onnection_start_ok\x18\x02 \x01(\x0b\x32\x33.amqp_imposter.control.v1.ConnectionStartOkSelectorH\x00\x12K\n\x0f\x63onnection_tune\x18\x03 \x01(\x0b\x32\x30.amqp_imposter.control.v1.ConnectionTuneSelectorH\x00\x12P\n\x12\x63onnection_tune_ok\x18\x04 \x01(\x0b\x32\x32.amqp_imposter.control.v1.ConnectionTuneOkSelectorH\x00\x12K\n\x0f\x63onnection_open\x18\x05 \x01(\x0b\x32\x30.amqp_imposter.control.v1.ConnectionOpenSelectorH\x00\x12P\n\x12\x63onnection_open_ok\x18\x06 \x01(\x0b\x32\x32.amqp_imposter.control.v1.ConnectionOpenOkSelectorH\x00\x12M\n\x10\x63onnection_close\x18\x07 \x01(\x0b\x32\x31.amqp_imposter.control.v1.ConnectionCloseSelectorH\x00\x12R\n\x13\x63onnection_close_ok\x18\x08 \x01(\x0b\x32\x33.amqp_imposter.control.v1.ConnectionCloseOkSelectorH\x00\x12\x45\n\x0c\x63hannel_open\x18\t \x01(\x0b\x32-.amqp_imposter.control.v1.ChannelOpenSelectorH\x00\x12J\n\x0f\x63hannel_open_ok\x18\n \x01(\x0b\x32/.amqp_imposter.control.v1.ChannelOpenOkSelectorH\x00\x12G\n\rchannel_close\x18\x0b \x01(\x0b\x32..amqp_imposter.control.v1.ChannelCloseSelectorH\x00\x12L\n\x10\x63hannel_close_ok\x18\x0c \x01(\x0b\x32\x30.amqp_imposter.control.v1.ChannelCloseOkSelectorH\x00\x12I\n\x0e\x63onfirm_select\x18\r \x01(\x0b\x32/.amqp_imposter.control.v1.ConfirmSelectSelectorH\x00\x12N\n\x11\x63onfirm_select_ok\x18\x0e \x01(\x0b\x32\x31.amqp_imposter.control.v1.ConfirmSelectOkSelectorH\x00\x12M\n\x10\x65xchange_declare\x18\x0f \x01(\x0b\x32\x31.amqp_imposter.control.v1.ExchangeDeclareSelectorH\x00\x12R\n\x13\x65xchange_declare_ok\x18\x10 \x01(\x0b\x32\x33.amqp_imposter.control.v1.ExchangeDeclareOkSelectorH\x00\x12G\n\rexchange_bind\x18\x11 \x01(\x0b\x32..amqp_imposter.control.v1.ExchangeBindSelectorH\x00\x12L\n\x10\x65xchange_bind_ok\x18\x12 \x01(\x0b\x32\x30.amqp_imposter.control.v1.ExchangeBindOkSelectorH\x00\x12G\n\rqueue_declare\x18\x13 \x01(\x0b\x32..amqp_imposter.control.v1.QueueDeclareSelectorH\x00\x12L\n\x10queue_declare_ok\x18\x14 \x01(\x0b\x32\x30.amqp_imposter.control.v1.QueueDeclareOkSelectorH\x00\x12\x41\n\nqueue_bind\x18\x15 \x01(\x0b\x32+.amqp_imposter.control.v1.QueueBindSelectorH\x00\x12\x46\n\rqueue_bind_ok\x18\x16 \x01(\x0b\x32-.amqp_imposter.control.v1.QueueBindOkSelectorH\x00\x12?\n\tbasic_qos\x18\x17 \x01(\x0b\x32*.amqp_imposter.control.v1.BasicQosSelectorH\x00\x12\x44\n\x0c\x62\x61sic_qos_ok\x18\x18 \x01(\x0b\x32,.amqp_imposter.control.v1.BasicQosOkSelectorH\x00\x12G\n\rbasic_consume\x18\x19 \x01(\x0b\x32..amqp_imposter.control.v1.BasicConsumeSelectorH\x00\x12L\n\x10\x62\x61sic_consume_ok\x18\x1a \x01(\x0b\x32\x30.amqp_imposter.control.v1.BasicConsumeOkSelectorH\x00\x12\x45\n\x0c\x62\x61sic_cancel\x18\x1b \x01(\x0b\x32-.amqp_imposter.control.v1.BasicCancelSelectorH\x00\x12J\n\x0f\x62\x61sic_cancel_ok\x18\x1c \x01(\x0b\x32/.amqp_imposter.control.v1.BasicCancelOkSelectorH\x00\x12G\n\rbasic_publish\x18\x1d \x01(\x0b\x32..amqp_imposter.control.v1.BasicPublishSelectorH\x00\x12\x45\n\x0c\x62\x61sic_return\x18\x1e \x01(\x0b\x32-.amqp_imposter.control.v1.BasicReturnSelectorH\x00\x12?\n\tbasic_ack\x18\x1f \x01(\x0b\x32*.amqp_imposter.control.v1.BasicAckSelectorH\x00\x12\x41\n\nbasic_nack\x18 \x01(\x0b\x32+.amqp_imposter.control.v1.BasicNackSelectorH\x00\x12\x45\n\x0c\x62\x61sic_reject\x18! \x01(\x0b\x32-.amqp_imposter.control.v1.BasicRejectSelectorH\x00\x12G\n\rbasic_deliver\x18\" \x01(\x0b\x32..amqp_imposter.control.v1.BasicDeliverSelectorH\x00\x12?\n\tbasic_get\x18# \x01(\x0b\x32*.amqp_imposter.control.v1.BasicGetSelectorH\x00\x12\x44\n\x0c\x62\x61sic_get_ok\x18$ \x01(\x0b\x32,.amqp_imposter.control.v1.BasicGetOkSelectorH\x00\x12J\n\x0f\x62\x61sic_get_empty\x18% \x01(\x0b\x32/.amqp_imposter.control.v1.BasicGetEmptySelectorH\x00\x42\x08\n\x06method\"\xbb\x15\n\x07Pattern\x12L\n\x10\x63onnection_start\x18\x01 \x01(\x0b\x32\x30.amqp_imposter.control.v1.ConnectionStartPatternH\x00\x12Q\n\x13\x63onnection_start_ok\x18\x02 \x01(\x0b\x32\x32.amqp_imposter.control.v1.ConnectionStartOkPatternH\x00\x12J\n\x0f\x63onnection_tune\x18\x03 \x01(\x0b\x32/.amqp_imposter.control.v1.ConnectionTunePatternH\x00\x12O\n\x12\x63onnection_tune_ok\x18\x04 \x01(\x0b\x32\x31.amqp_imposter.control.v1.ConnectionTuneOkPatternH\x00\x12J\n\x0f\x63onnection_open\x18\x05 \x01(\x0b\x32/.amqp_imposter.control.v1.ConnectionOpenPatternH\x00\x12O\n\x12\x63onnection_open_ok\x18\x06 \x01(\x0b\x32\x31.amqp_imposter.control.v1.ConnectionOpenOkPatternH\x00\x12L\n\x10\x63onnection_close\x18\x07 \x01(\x0b\x32\x30.amqp_imposter.control.v1.ConnectionClosePatternH\x00\x12Q\n\x13\x63onnection_close_ok\x18\x08 \x01(\x0b\x32\x32.amqp_imposter.control.v1.ConnectionCloseOkPatternH\x00\x12\x44\n\x0c\x63hannel_open\x18\t \x01(\x0b\x32,.amqp_imposter.control.v1.ChannelOpenPatternH\x00\x12I\n\x0f\x63hannel_open_ok\x18\n \x01(\x0b\x32..amqp_imposter.control.v1.ChannelOpenOkPatternH\x00\x12\x46\n\rchannel_close\x18\x0b \x01(\x0b\x32-.amqp_imposter.control.v1.ChannelClosePatternH\x00\x12K\n\x10\x63hannel_close_ok\x18\x0c \x01(\x0b\x32/.amqp_imposter.control.v1.ChannelCloseOkPatternH\x00\x12H\n\x0e\x63onfirm_select\x18\r \x01(\x0b\x32..amqp_imposter.control.v1.ConfirmSelectPatternH\x00\x12M\n\x11\x63onfirm_select_ok\x18\x0e \x01(\x0b\x32\x30.amqp_imposter.control.v1.ConfirmSelectOkPatternH\x00\x12L\n\x10\x65xchange_declare\x18\x0f \x01(\x0b\x32\x30.amqp_imposter.control.v1.ExchangeDeclarePatternH\x00\x12Q\n\x13\x65xchange_declare_ok\x18\x10 \x01(\x0b\x32\x32.amqp_imposter.control.v1.ExchangeDeclareOkPatternH\x00\x12\x46\n\rexchange_bind\x18\x11 \x01(\x0b\x32-.amqp_imposter.control.v1.ExchangeBindPatternH\x00\x12K\n\x10\x65xchange_bind_ok\x18\x12 \x01(\x0b\x32/.amqp_imposter.control.v1.ExchangeBindOkPatternH\x00\x12\x46\n\rqueue_declare\x18\x13 \x01(\x0b\x32-.amqp_imposter.control.v1.QueueDeclarePatternH\x00\x12K\n\x10queue_declare_ok\x18\x14 \x01(\x0b\x32/.amqp_imposter.control.v1.QueueDeclareOkPatternH\x00\x12@\n\nqueue_bind\x18\x15 \x01(\x0b\x32*.amqp_imposter.control.v1.QueueBindPatternH\x00\x12\x45\n\rqueue_bind_ok\x18\x16 \x01(\x0b\x32,.amqp_imposter.control.v1.QueueBindOkPatternH\x00\x12>\n\tbasic_qos\x18\x17 \x01(\x0b\x32).amqp_imposter.control.v1.BasicQosPatternH\x00\x12\x43\n\x0c\x62\x61sic_qos_ok\x18\x18 \x01(\x0b\x32+.amqp_imposter.control.v1.BasicQosOkPatternH\x00\x12\x46\n\rbasic_consume\x18\x19 \x01(\x0b\x32-.amqp_imposter.control.v1.BasicConsumePatternH\x00\x12K\n\x10\x62\x61sic_consume_ok\x18\x1a \x01(\x0b\x32/.amqp_imposter.control.v1.BasicConsumeOkPatternH\x00\x12\x44\n\x0c\x62\x61sic_cancel\x18\x1b \x01(\x0b\x32,.amqp_imposter.control.v1.BasicCancelPatternH\x00\x12I\n\x0f\x62\x61sic_cancel_ok\x18\x1c \x01(\x0b\x32..amqp_imposter.control.v1.BasicCancelOkPatternH\x00\x12\x46\n\rbasic_publish\x18\x1d \x01(\x0b\x32-.amqp_imposter.control.v1.BasicPublishPatternH\x00\x12\x44\n\x0c\x62\x61sic_return\x18\x1e \x01(\x0b\x32,.amqp_imposter.control.v1.BasicReturnPatternH\x00\x12>\n\tbasic_ack\x18\x1f \x01(\x0b\x32).amqp_imposter.control.v1.BasicAckPatternH\x00\x12@\n\nbasic_nack\x18 \x01(\x0b\x32*.amqp_imposter.control.v1.BasicNackPatternH\x00\x12\x44\n\x0c\x62\x61sic_reject\x18! \x01(\x0b\x32,.amqp_imposter.control.v1.BasicRejectPatternH\x00\x12\x46\n\rbasic_deliver\x18\" \x01(\x0b\x32-.amqp_imposter.control.v1.BasicDeliverPatternH\x00\x12>\n\tbasic_get\x18# \x01(\x0b\x32).amqp_imposter.control.v1.BasicGetPatternH\x00\x12\x43\n\x0c\x62\x61sic_get_ok\x18$ \x01(\x0b\x32+.amqp_imposter.control.v1.BasicGetOkPatternH\x00\x12I\n\x0f\x62\x61sic_get_empty\x18% \x01(\x0b\x32..amqp_imposter.control.v1.BasicGetEmptyPatternH\x00\x42\x08\n\x06method\"`\n\x08Weighted\x12\x34\n\x08selector\x18\x01 \x01(\x0b\x32\".amqp_imposter.control.v1.Selector\x12\x13\n\x06weight\x18\x02 \x01(\rH\x00\x88\x01\x01\x42\t\n\x07_weight\"\xb2\x01\n\x08Scripted\x12\x35\n\x08received\x18\x01 \x01(\x0b\x32!.amqp_imposter.control.v1.PatternH\x00\x12\x31\n\x04sent\x18\x02 \x01(\x0b\x32!.amqp_imposter.control.v1.PatternH\x00\x12\x34\n\tthen_send\x18\x03 \x01(\x0b\x32!.amqp_imposter.control.v1.PatternB\x06\n\x04when\"\xa2\x04\n\rSessionConfig\x12\x11\n\x04seed\x18\x01 \x01(\x04H\x00\x88\x01\x01\x12N\n\x13negotiation_options\x18\x02 \x01(\x0b\x32,.amqp_imposter.control.v1.NegotiationOptionsH\x01\x88\x01\x01\x12\x33\n\x07weights\x18\x03 \x03(\x0b\x32\".amqp_imposter.control.v1.Weighted\x12\x38\n\x0cidle_weights\x18\x04 \x03(\x0b\x32\".amqp_imposter.control.v1.Weighted\x12\x32\n\x06script\x18\x05 \x03(\x0b\x32\".amqp_imposter.control.v1.Scripted\x12\x18\n\x0bstop_weight\x18\x06 \x01(\rH\x02\x88\x01\x01\x12\x1d\n\x10max_burst_length\x18\x07 \x01(\rH\x03\x88\x01\x01\x12\x18\n\x0bidle_millis\x18\x08 \x01(\rH\x04\x88\x01\x01\x12\x17\n\nmax_buffer\x18\t \x01(\rH\x05\x88\x01\x01\x12!\n\x14max_transcript_lines\x18\n \x01(\rH\x06\x88\x01\x01\x42\x07\n\x05_seedB\x16\n\x14_negotiation_optionsB\x0e\n\x0c_stop_weightB\x13\n\x11_max_burst_lengthB\x0e\n\x0c_idle_millisB\r\n\x0b_max_bufferB\x17\n\x15_max_transcript_lines\"\xe5\x01\n\x0eTranscriptLine\x12\r\n\x05index\x18\x01 \x01(\x04\x12\x0e\n\x06micros\x18\x02 \x01(\x03\x12\x14\n\x0c\x65poch_micros\x18\x03 \x01(\x03\x12\x38\n\x05\x65vent\x18\x04 \x01(\x0e\x32).amqp_imposter.control.v1.TranscriptEvent\x12\x35\n\x06method\x18\x05 \x01(\x0b\x32 .amqp_imposter.control.v1.MethodH\x00\x88\x01\x01\x12\x0e\n\x06\x64\x65tail\x18\x06 \x01(\t\x12\x12\n\nwire_bytes\x18\x07 \x01(\x0c\x42\t\n\x07_method\"\xb2\x01\n\x0bStatusReply\x12\x16\n\tamqp_port\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x14\n\x0c\x61mqp_greeted\x18\x02 \x01(\x08\x12\x18\n\x10transcript_lines\x18\x03 \x01(\x04\x12\x14\n\x0c\x65poch_micros\x18\x04 \x01(\x03\x12\x37\n\x06\x63onfig\x18\x05 \x01(\x0b\x32\'.amqp_imposter.control.v1.SessionConfigB\x0c\n\n_amqp_port\"K\n\x10\x43onfigureRequest\x12\x37\n\x06\x63onfig\x18\x01 \x01(\x0b\x32\'.amqp_imposter.control.v1.SessionConfig\"\x0f\n\rStatusRequest\"\x0e\n\x0cResetRequest\"\x13\n\x11TranscriptRequest\"\x18\n\x16WatchTranscriptRequest*:\n\nBaseWeight\x12\x1b\n\x17\x42\x41SE_WEIGHT_UNSPECIFIED\x10\x00\x12\x0f\n\x0b\x42\x41SE_WEIGHT\x10\x64*\xca\x03\n\x0fTranscriptEvent\x12 \n\x1cTRANSCRIPT_EVENT_UNSPECIFIED\x10\x00\x12$\n TRANSCRIPT_EVENT_SESSION_STARTED\x10\x01\x12\"\n\x1eTRANSCRIPT_EVENT_TCP_CONNECTED\x10\x02\x12!\n\x1dTRANSCRIPT_EVENT_TCP_REJECTED\x10\x03\x12\x1d\n\x19TRANSCRIPT_EVENT_TCP_DOWN\x10\x04\x12!\n\x1dTRANSCRIPT_EVENT_IDLE_TIMEOUT\x10\x05\x12$\n TRANSCRIPT_EVENT_PROTOCOL_HEADER\x10\x06\x12$\n TRANSCRIPT_EVENT_FRAME_MALFORMED\x10\x07\x12$\n TRANSCRIPT_EVENT_FRAME_HEARTBEAT\x10\x08\x12#\n\x1fTRANSCRIPT_EVENT_METHOD_INGRESS\x10\t\x12\"\n\x1eTRANSCRIPT_EVENT_METHOD_EGRESS\x10\n\x12+\n\'TRANSCRIPT_EVENT_METHOD_UNREPRESENTABLE\x10\x0b\x32\xf4\x03\n\x08Imposter\x12^\n\tConfigure\x12*.amqp_imposter.control.v1.ConfigureRequest\x1a%.amqp_imposter.control.v1.StatusReply\x12X\n\x06Status\x12\'.amqp_imposter.control.v1.StatusRequest\x1a%.amqp_imposter.control.v1.StatusReply\x12V\n\x05Reset\x12&.amqp_imposter.control.v1.ResetRequest\x1a%.amqp_imposter.control.v1.StatusReply\x12\x65\n\nTranscript\x12+.amqp_imposter.control.v1.TranscriptRequest\x1a(.amqp_imposter.control.v1.TranscriptLine0\x01\x12o\n\x0fWatchTranscript\x12\x30.amqp_imposter.control.v1.WatchTranscriptRequest\x1a(.amqp_imposter.control.v1.TranscriptLine0\x01\x62\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\'amqp_imposter/control/v1/imposter.proto\x12\x18\x61mqp_imposter.control.v1\x1a\x1fgoogle/protobuf/timestamp.proto\"\x06\n\x04Void\"\x1b\n\nStringList\x12\r\n\x05items\x18\x01 \x03(\t\"\xba\x02\n\tAmqpValue\x12\x11\n\x07\x62oolean\x18\x01 \x01(\x08H\x00\x12\x0e\n\x04long\x18\x02 \x01(\x03H\x00\x12\x10\n\x06string\x18\x03 \x01(\tH\x00\x12\x0f\n\x05\x62ytes\x18\x04 \x01(\x0cH\x00\x12\x11\n\x07\x64\x65\x63imal\x18\x05 \x01(\tH\x00\x12/\n\ttimestamp\x18\x06 \x01(\x0b\x32\x1a.google.protobuf.TimestampH\x00\x12.\n\x04void\x18\x07 \x01(\x0b\x32\x1e.amqp_imposter.control.v1.VoidH\x00\x12\x34\n\x05table\x18\x08 \x01(\x0b\x32#.amqp_imposter.control.v1.AmqpTableH\x00\x12\x34\n\x05\x61rray\x18\t \x01(\x0b\x32#.amqp_imposter.control.v1.AmqpArrayH\x00\x42\x07\n\x05value\"\xa3\x01\n\tAmqpTable\x12\x41\n\x07\x65ntries\x18\x01 \x03(\x0b\x32\x30.amqp_imposter.control.v1.AmqpTable.EntriesEntry\x1aS\n\x0c\x45ntriesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x32\n\x05value\x18\x02 \x01(\x0b\x32#.amqp_imposter.control.v1.AmqpValue:\x02\x38\x01\"?\n\tAmqpArray\x12\x32\n\x05items\x18\x01 \x03(\x0b\x32#.amqp_imposter.control.v1.AmqpValue\"\xb4\x04\n\x11MessageProperties\x12\x19\n\x0c\x63ontent_type\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1d\n\x10\x63ontent_encoding\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x39\n\x07headers\x18\x03 \x01(\x0b\x32#.amqp_imposter.control.v1.AmqpTableH\x02\x88\x01\x01\x12\x1a\n\rdelivery_mode\x18\x04 \x01(\rH\x03\x88\x01\x01\x12\x15\n\x08priority\x18\x05 \x01(\rH\x04\x88\x01\x01\x12\x1b\n\x0e\x63orrelation_id\x18\x06 \x01(\tH\x05\x88\x01\x01\x12\x15\n\x08reply_to\x18\x07 \x01(\tH\x06\x88\x01\x01\x12\x17\n\nexpiration\x18\x08 \x01(\tH\x07\x88\x01\x01\x12\x17\n\nmessage_id\x18\t \x01(\tH\x08\x88\x01\x01\x12\x16\n\ttimestamp\x18\n \x01(\x04H\t\x88\x01\x01\x12\x11\n\x04type\x18\x0b \x01(\tH\n\x88\x01\x01\x12\x14\n\x07user_id\x18\x0c \x01(\tH\x0b\x88\x01\x01\x12\x13\n\x06\x61pp_id\x18\r \x01(\tH\x0c\x88\x01\x01\x42\x0f\n\r_content_typeB\x13\n\x11_content_encodingB\n\n\x08_headersB\x10\n\x0e_delivery_modeB\x0b\n\t_priorityB\x11\n\x0f_correlation_idB\x0b\n\t_reply_toB\r\n\x0b_expirationB\r\n\x0b_message_idB\x0c\n\n_timestampB\x07\n\x05_typeB\n\n\x08_user_idB\t\n\x07_app_id\"\xc0\x03\n\x12NegotiationOptions\x12=\n\nmechanisms\x18\x01 \x01(\x0b\x32$.amqp_imposter.control.v1.StringListH\x00\x88\x01\x01\x12:\n\x07locales\x18\x02 \x01(\x0b\x32$.amqp_imposter.control.v1.StringListH\x01\x88\x01\x01\x12\x1f\n\x12publisher_confirms\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12\x17\n\nbasic_nack\x18\x04 \x01(\x08H\x03\x88\x01\x01\x12#\n\x16\x63onsumer_cancel_notify\x18\x05 \x01(\x08H\x04\x88\x01\x01\x12\x18\n\x0b\x63hannel_max\x18\x06 \x01(\rH\x05\x88\x01\x01\x12\x16\n\tframe_max\x18\x07 \x01(\rH\x06\x88\x01\x01\x12\x16\n\theartbeat\x18\x08 \x01(\rH\x07\x88\x01\x01\x42\r\n\x0b_mechanismsB\n\n\x08_localesB\x15\n\x13_publisher_confirmsB\r\n\x0b_basic_nackB\x19\n\x17_consumer_cancel_notifyB\x0e\n\x0c_channel_maxB\x0c\n\n_frame_maxB\x0c\n\n_heartbeat\"\xbf\x01\n\x0f\x43onnectionStart\x12\x15\n\rversion_major\x18\x01 \x01(\r\x12\x15\n\rversion_minor\x18\x02 \x01(\r\x12\x12\n\nmechanisms\x18\x03 \x03(\t\x12\x0f\n\x07locales\x18\x04 \x03(\t\x12\x43\n\x11server_properties\x18\x05 \x01(\x0b\x32#.amqp_imposter.control.v1.AmqpTableH\x00\x88\x01\x01\x42\x14\n\x12_server_properties\"\xe6\x02\n\x17\x43onnectionStartSelector\x12\x1a\n\rversion_major\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x1a\n\rversion_minor\x18\x02 \x01(\rH\x01\x88\x01\x01\x12=\n\nmechanisms\x18\x03 \x01(\x0b\x32$.amqp_imposter.control.v1.StringListH\x02\x88\x01\x01\x12:\n\x07locales\x18\x04 \x01(\x0b\x32$.amqp_imposter.control.v1.StringListH\x03\x88\x01\x01\x12\x43\n\x11server_properties\x18\x05 \x01(\x0b\x32#.amqp_imposter.control.v1.AmqpTableH\x04\x88\x01\x01\x42\x10\n\x0e_version_majorB\x10\n\x0e_version_minorB\r\n\x0b_mechanismsB\n\n\x08_localesB\x14\n\x12_server_properties\"\xe5\x02\n\x16\x43onnectionStartPattern\x12\x1a\n\rversion_major\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x1a\n\rversion_minor\x18\x02 \x01(\rH\x01\x88\x01\x01\x12=\n\nmechanisms\x18\x03 \x01(\x0b\x32$.amqp_imposter.control.v1.StringListH\x02\x88\x01\x01\x12:\n\x07locales\x18\x04 \x01(\x0b\x32$.amqp_imposter.control.v1.StringListH\x03\x88\x01\x01\x12\x43\n\x11server_properties\x18\x05 \x01(\x0b\x32#.amqp_imposter.control.v1.AmqpTableH\x04\x88\x01\x01\x42\x10\n\x0e_version_majorB\x10\n\x0e_version_minorB\r\n\x0b_mechanismsB\n\n\x08_localesB\x14\n\x12_server_properties\"\xa3\x01\n\x11\x43onnectionStartOk\x12\x11\n\tmechanism\x18\x01 \x01(\t\x12\x0e\n\x06locale\x18\x02 \x01(\t\x12\x10\n\x08response\x18\x03 \x01(\t\x12\x43\n\x11\x63lient_properties\x18\x04 \x01(\x0b\x32#.amqp_imposter.control.v1.AmqpTableH\x00\x88\x01\x01\x42\x14\n\x12_client_properties\"m\n\x19\x43onnectionStartOkSelector\x12\x16\n\tmechanism\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06locale\x18\x02 \x01(\tH\x01\x88\x01\x01\x42\x0c\n\n_mechanismB\t\n\x07_localeJ\x04\x08\x03\x10\x04J\x04\x08\x04\x10\x05\"\xdf\x01\n\x18\x43onnectionStartOkPattern\x12\x16\n\tmechanism\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06locale\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x15\n\x08response\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x43\n\x11\x63lient_properties\x18\x04 \x01(\x0b\x32#.amqp_imposter.control.v1.AmqpTableH\x03\x88\x01\x01\x42\x0c\n\n_mechanismB\t\n\x07_localeB\x0b\n\t_responseB\x14\n\x12_client_properties\"K\n\x0e\x43onnectionTune\x12\x13\n\x0b\x63hannel_max\x18\x01 \x01(\r\x12\x11\n\tframe_max\x18\x02 \x01(\r\x12\x11\n\theartbeat\x18\x03 \x01(\r\"\x8e\x01\n\x16\x43onnectionTuneSelector\x12\x18\n\x0b\x63hannel_max\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x16\n\tframe_max\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x16\n\theartbeat\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x0e\n\x0c_channel_maxB\x0c\n\n_frame_maxB\x0c\n\n_heartbeat\"\x8d\x01\n\x15\x43onnectionTunePattern\x12\x18\n\x0b\x63hannel_max\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x16\n\tframe_max\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x16\n\theartbeat\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x0e\n\x0c_channel_maxB\x0c\n\n_frame_maxB\x0c\n\n_heartbeat\"M\n\x10\x43onnectionTuneOk\x12\x13\n\x0b\x63hannel_max\x18\x01 \x01(\r\x12\x11\n\tframe_max\x18\x02 \x01(\r\x12\x11\n\theartbeat\x18\x03 \x01(\r\"\x90\x01\n\x18\x43onnectionTuneOkSelector\x12\x18\n\x0b\x63hannel_max\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x16\n\tframe_max\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x16\n\theartbeat\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x0e\n\x0c_channel_maxB\x0c\n\n_frame_maxB\x0c\n\n_heartbeat\"\x8f\x01\n\x17\x43onnectionTuneOkPattern\x12\x18\n\x0b\x63hannel_max\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x16\n\tframe_max\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x16\n\theartbeat\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x0e\n\x0c_channel_maxB\x0c\n\n_frame_maxB\x0c\n\n_heartbeat\"\x1f\n\x0e\x43onnectionOpen\x12\r\n\x05vhost\x18\x01 \x01(\t\"\x1e\n\x16\x43onnectionOpenSelectorJ\x04\x08\x01\x10\x02\"5\n\x15\x43onnectionOpenPattern\x12\x12\n\x05vhost\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x08\n\x06_vhost\"\x12\n\x10\x43onnectionOpenOk\"\x1a\n\x18\x43onnectionOpenOkSelector\"\x19\n\x17\x43onnectionOpenOkPattern\"^\n\x0f\x43onnectionClose\x12\x12\n\nreply_code\x18\x01 \x01(\r\x12\x12\n\nreply_text\x18\x02 \x01(\t\x12\x10\n\x08\x63lass_id\x18\x03 \x01(\r\x12\x11\n\tmethod_id\x18\x04 \x01(\r\"\xb3\x01\n\x17\x43onnectionCloseSelector\x12\x17\n\nreply_code\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x17\n\nreply_text\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x15\n\x08\x63lass_id\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x16\n\tmethod_id\x18\x04 \x01(\rH\x03\x88\x01\x01\x42\r\n\x0b_reply_codeB\r\n\x0b_reply_textB\x0b\n\t_class_idB\x0c\n\n_method_id\"\xb2\x01\n\x16\x43onnectionClosePattern\x12\x17\n\nreply_code\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x17\n\nreply_text\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x15\n\x08\x63lass_id\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x16\n\tmethod_id\x18\x04 \x01(\rH\x03\x88\x01\x01\x42\r\n\x0b_reply_codeB\r\n\x0b_reply_textB\x0b\n\t_class_idB\x0c\n\n_method_id\"\x13\n\x11\x43onnectionCloseOk\"\x1b\n\x19\x43onnectionCloseOkSelector\"\x1a\n\x18\x43onnectionCloseOkPattern\"\r\n\x0b\x43hannelOpen\"\x15\n\x13\x43hannelOpenSelector\"\x14\n\x12\x43hannelOpenPattern\"\x0f\n\rChannelOpenOk\"\x17\n\x15\x43hannelOpenOkSelector\"\x16\n\x14\x43hannelOpenOkPattern\"[\n\x0c\x43hannelClose\x12\x12\n\nreply_code\x18\x01 \x01(\r\x12\x12\n\nreply_text\x18\x02 \x01(\t\x12\x10\n\x08\x63lass_id\x18\x03 \x01(\r\x12\x11\n\tmethod_id\x18\x04 \x01(\r\"\xb0\x01\n\x14\x43hannelCloseSelector\x12\x17\n\nreply_code\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x17\n\nreply_text\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x15\n\x08\x63lass_id\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x16\n\tmethod_id\x18\x04 \x01(\rH\x03\x88\x01\x01\x42\r\n\x0b_reply_codeB\r\n\x0b_reply_textB\x0b\n\t_class_idB\x0c\n\n_method_id\"\xaf\x01\n\x13\x43hannelClosePattern\x12\x17\n\nreply_code\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x17\n\nreply_text\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x15\n\x08\x63lass_id\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x16\n\tmethod_id\x18\x04 \x01(\rH\x03\x88\x01\x01\x42\r\n\x0b_reply_codeB\r\n\x0b_reply_textB\x0b\n\t_class_idB\x0c\n\n_method_id\"\x10\n\x0e\x43hannelCloseOk\"\x18\n\x16\x43hannelCloseOkSelector\"\x17\n\x15\x43hannelCloseOkPattern\" \n\rConfirmSelect\x12\x0f\n\x07no_wait\x18\x01 \x01(\x08\"\x1d\n\x15\x43onfirmSelectSelectorJ\x04\x08\x01\x10\x02\"8\n\x14\x43onfirmSelectPattern\x12\x14\n\x07no_wait\x18\x01 \x01(\x08H\x00\x88\x01\x01\x42\n\n\x08_no_wait\"\x11\n\x0f\x43onfirmSelectOk\"\x19\n\x17\x43onfirmSelectOkSelector\"\x18\n\x16\x43onfirmSelectOkPattern\"\xdf\x01\n\x0f\x45xchangeDeclare\x12\x10\n\x08\x65xchange\x18\x01 \x01(\t\x12\x15\n\rexchange_type\x18\x02 \x01(\t\x12\x0f\n\x07passive\x18\x03 \x01(\x08\x12\x0f\n\x07\x64urable\x18\x04 \x01(\x08\x12\x13\n\x0b\x61uto_delete\x18\x05 \x01(\x08\x12\x10\n\x08internal\x18\x06 \x01(\x08\x12\x0f\n\x07no_wait\x18\x07 \x01(\x08\x12;\n\targuments\x18\x08 \x01(\x0b\x32#.amqp_imposter.control.v1.AmqpTableH\x00\x88\x01\x01\x42\x0c\n\n_arguments\"C\n\x17\x45xchangeDeclareSelector\x12\x15\n\x08\x65xchange\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x0b\n\t_exchangeJ\x04\x08\x02\x10\t\"\xe9\x02\n\x16\x45xchangeDeclarePattern\x12\x15\n\x08\x65xchange\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1a\n\rexchange_type\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x14\n\x07passive\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12\x14\n\x07\x64urable\x18\x04 \x01(\x08H\x03\x88\x01\x01\x12\x18\n\x0b\x61uto_delete\x18\x05 \x01(\x08H\x04\x88\x01\x01\x12\x15\n\x08internal\x18\x06 \x01(\x08H\x05\x88\x01\x01\x12\x14\n\x07no_wait\x18\x07 \x01(\x08H\x06\x88\x01\x01\x12;\n\targuments\x18\x08 \x01(\x0b\x32#.amqp_imposter.control.v1.AmqpTableH\x07\x88\x01\x01\x42\x0b\n\t_exchangeB\x10\n\x0e_exchange_typeB\n\n\x08_passiveB\n\n\x08_durableB\x0e\n\x0c_auto_deleteB\x0b\n\t_internalB\n\n\x08_no_waitB\x0c\n\n_arguments\"\x13\n\x11\x45xchangeDeclareOk\"\x1b\n\x19\x45xchangeDeclareOkSelector\"\x1a\n\x18\x45xchangeDeclareOkPattern\"\xa4\x01\n\x0c\x45xchangeBind\x12\x13\n\x0b\x64\x65stination\x18\x01 \x01(\t\x12\x0e\n\x06source\x18\x02 \x01(\t\x12\x13\n\x0brouting_key\x18\x03 \x01(\t\x12\x0f\n\x07no_wait\x18\x04 \x01(\x08\x12;\n\targuments\x18\x05 \x01(\x0b\x32#.amqp_imposter.control.v1.AmqpTableH\x00\x88\x01\x01\x42\x0c\n\n_arguments\"\x1c\n\x14\x45xchangeBindSelectorJ\x04\x08\x01\x10\x06\"\xf6\x01\n\x13\x45xchangeBindPattern\x12\x18\n\x0b\x64\x65stination\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06source\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x18\n\x0brouting_key\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x14\n\x07no_wait\x18\x04 \x01(\x08H\x03\x88\x01\x01\x12;\n\targuments\x18\x05 \x01(\x0b\x32#.amqp_imposter.control.v1.AmqpTableH\x04\x88\x01\x01\x42\x0e\n\x0c_destinationB\t\n\x07_sourceB\x0e\n\x0c_routing_keyB\n\n\x08_no_waitB\x0c\n\n_arguments\"\x10\n\x0e\x45xchangeBindOk\"\x18\n\x16\x45xchangeBindOkSelector\"\x17\n\x15\x45xchangeBindOkPattern\"\xc3\x01\n\x0cQueueDeclare\x12\r\n\x05queue\x18\x01 \x01(\t\x12\x0f\n\x07passive\x18\x02 \x01(\x08\x12\x0f\n\x07\x64urable\x18\x03 \x01(\x08\x12\x11\n\texclusive\x18\x04 \x01(\x08\x12\x13\n\x0b\x61uto_delete\x18\x05 \x01(\x08\x12\x0f\n\x07no_wait\x18\x06 \x01(\x08\x12;\n\targuments\x18\x07 \x01(\x0b\x32#.amqp_imposter.control.v1.AmqpTableH\x00\x88\x01\x01\x42\x0c\n\n_arguments\"\x1c\n\x14QueueDeclareSelectorJ\x04\x08\x01\x10\x08\"\xb4\x02\n\x13QueueDeclarePattern\x12\x12\n\x05queue\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x14\n\x07passive\x18\x02 \x01(\x08H\x01\x88\x01\x01\x12\x14\n\x07\x64urable\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12\x16\n\texclusive\x18\x04 \x01(\x08H\x03\x88\x01\x01\x12\x18\n\x0b\x61uto_delete\x18\x05 \x01(\x08H\x04\x88\x01\x01\x12\x14\n\x07no_wait\x18\x06 \x01(\x08H\x05\x88\x01\x01\x12;\n\targuments\x18\x07 \x01(\x0b\x32#.amqp_imposter.control.v1.AmqpTableH\x06\x88\x01\x01\x42\x08\n\x06_queueB\n\n\x08_passiveB\n\n\x08_durableB\x0c\n\n_exclusiveB\x0e\n\x0c_auto_deleteB\n\n\x08_no_waitB\x0c\n\n_arguments\"N\n\x0eQueueDeclareOk\x12\r\n\x05queue\x18\x01 \x01(\t\x12\x15\n\rmessage_count\x18\x02 \x01(\r\x12\x16\n\x0e\x63onsumer_count\x18\x03 \x01(\r\"\x1e\n\x16QueueDeclareOkSelectorJ\x04\x08\x01\x10\x04\"\x93\x01\n\x15QueueDeclareOkPattern\x12\x12\n\x05queue\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1a\n\rmessage_count\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x1b\n\x0e\x63onsumer_count\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_queueB\x10\n\x0e_message_countB\x11\n\x0f_consumer_count\"\x9d\x01\n\tQueueBind\x12\r\n\x05queue\x18\x01 \x01(\t\x12\x10\n\x08\x65xchange\x18\x02 \x01(\t\x12\x13\n\x0brouting_key\x18\x03 \x01(\t\x12\x0f\n\x07no_wait\x18\x04 \x01(\x08\x12;\n\targuments\x18\x05 \x01(\x0b\x32#.amqp_imposter.control.v1.AmqpTableH\x00\x88\x01\x01\x42\x0c\n\n_arguments\"\x19\n\x11QueueBindSelectorJ\x04\x08\x01\x10\x06\"\xeb\x01\n\x10QueueBindPattern\x12\x12\n\x05queue\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x15\n\x08\x65xchange\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x18\n\x0brouting_key\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x14\n\x07no_wait\x18\x04 \x01(\x08H\x03\x88\x01\x01\x12;\n\targuments\x18\x05 \x01(\x0b\x32#.amqp_imposter.control.v1.AmqpTableH\x04\x88\x01\x01\x42\x08\n\x06_queueB\x0b\n\t_exchangeB\x0e\n\x0c_routing_keyB\n\n\x08_no_waitB\x0c\n\n_arguments\"\r\n\x0bQueueBindOk\"\x15\n\x13QueueBindOkSelector\"\x14\n\x12QueueBindOkPattern\"M\n\x08\x42\x61sicQos\x12\x16\n\x0eprefetch_count\x18\x01 \x01(\r\x12\x15\n\rprefetch_size\x18\x02 \x01(\r\x12\x12\n\nglobal_qos\x18\x03 \x01(\x08\"\x18\n\x10\x42\x61sicQosSelectorJ\x04\x08\x01\x10\x04\"\x97\x01\n\x0f\x42\x61sicQosPattern\x12\x1b\n\x0eprefetch_count\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x1a\n\rprefetch_size\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x17\n\nglobal_qos\x18\x03 \x01(\x08H\x02\x88\x01\x01\x42\x11\n\x0f_prefetch_countB\x10\n\x0e_prefetch_sizeB\r\n\x0b_global_qos\"\x0c\n\nBasicQosOk\"\x14\n\x12\x42\x61sicQosOkSelector\"\x13\n\x11\x42\x61sicQosOkPattern\"\xc4\x01\n\x0c\x42\x61sicConsume\x12\r\n\x05queue\x18\x01 \x01(\t\x12\x14\n\x0c\x63onsumer_tag\x18\x02 \x01(\t\x12\x10\n\x08no_local\x18\x03 \x01(\x08\x12\x0e\n\x06no_ack\x18\x04 \x01(\x08\x12\x0f\n\x07no_wait\x18\x05 \x01(\x08\x12\x11\n\texclusive\x18\x06 \x01(\x08\x12;\n\targuments\x18\x07 \x01(\x0b\x32#.amqp_imposter.control.v1.AmqpTableH\x00\x88\x01\x01\x42\x0c\n\n_arguments\"\x1c\n\x14\x42\x61sicConsumeSelectorJ\x04\x08\x01\x10\x08\"\xb6\x02\n\x13\x42\x61sicConsumePattern\x12\x12\n\x05queue\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x19\n\x0c\x63onsumer_tag\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x15\n\x08no_local\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12\x13\n\x06no_ack\x18\x04 \x01(\x08H\x03\x88\x01\x01\x12\x14\n\x07no_wait\x18\x05 \x01(\x08H\x04\x88\x01\x01\x12\x16\n\texclusive\x18\x06 \x01(\x08H\x05\x88\x01\x01\x12;\n\targuments\x18\x07 \x01(\x0b\x32#.amqp_imposter.control.v1.AmqpTableH\x06\x88\x01\x01\x42\x08\n\x06_queueB\x0f\n\r_consumer_tagB\x0b\n\t_no_localB\t\n\x07_no_ackB\n\n\x08_no_waitB\x0c\n\n_exclusiveB\x0c\n\n_arguments\"&\n\x0e\x42\x61sicConsumeOk\x12\x14\n\x0c\x63onsumer_tag\x18\x01 \x01(\t\"\x1e\n\x16\x42\x61sicConsumeOkSelectorJ\x04\x08\x01\x10\x02\"C\n\x15\x42\x61sicConsumeOkPattern\x12\x19\n\x0c\x63onsumer_tag\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x0f\n\r_consumer_tag\"4\n\x0b\x42\x61sicCancel\x12\x14\n\x0c\x63onsumer_tag\x18\x01 \x01(\t\x12\x0f\n\x07no_wait\x18\x02 \x01(\x08\"G\n\x13\x42\x61sicCancelSelector\x12\x19\n\x0c\x63onsumer_tag\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x0f\n\r_consumer_tagJ\x04\x08\x02\x10\x03\"b\n\x12\x42\x61sicCancelPattern\x12\x19\n\x0c\x63onsumer_tag\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x14\n\x07no_wait\x18\x02 \x01(\x08H\x01\x88\x01\x01\x42\x0f\n\r_consumer_tagB\n\n\x08_no_wait\"%\n\rBasicCancelOk\x12\x14\n\x0c\x63onsumer_tag\x18\x01 \x01(\t\"C\n\x15\x42\x61sicCancelOkSelector\x12\x19\n\x0c\x63onsumer_tag\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x0f\n\r_consumer_tag\"B\n\x14\x42\x61sicCancelOkPattern\x12\x19\n\x0c\x63onsumer_tag\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x0f\n\r_consumer_tag\"\xbe\x01\n\x0c\x42\x61sicPublish\x12\x10\n\x08\x65xchange\x18\x01 \x01(\t\x12\x13\n\x0brouting_key\x18\x02 \x01(\t\x12\x11\n\tmandatory\x18\x03 \x01(\x08\x12\x11\n\timmediate\x18\x04 \x01(\x08\x12\x44\n\nproperties\x18\x05 \x01(\x0b\x32+.amqp_imposter.control.v1.MessagePropertiesH\x00\x88\x01\x01\x12\x0c\n\x04\x62ody\x18\x06 \x01(\x0c\x42\r\n\x0b_properties\"\x1c\n\x14\x42\x61sicPublishSelectorJ\x04\x08\x01\x10\x07\"\xa0\x02\n\x13\x42\x61sicPublishPattern\x12\x15\n\x08\x65xchange\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x18\n\x0brouting_key\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x16\n\tmandatory\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12\x16\n\timmediate\x18\x04 \x01(\x08H\x03\x88\x01\x01\x12\x44\n\nproperties\x18\x05 \x01(\x0b\x32+.amqp_imposter.control.v1.MessagePropertiesH\x04\x88\x01\x01\x12\x11\n\x04\x62ody\x18\x06 \x01(\x0cH\x05\x88\x01\x01\x42\x0b\n\t_exchangeB\x0e\n\x0c_routing_keyB\x0c\n\n_mandatoryB\x0c\n\n_immediateB\r\n\x0b_propertiesB\x07\n\x05_body\"\xbf\x01\n\x0b\x42\x61sicReturn\x12\x12\n\nreply_code\x18\x01 \x01(\r\x12\x12\n\nreply_text\x18\x02 \x01(\t\x12\x10\n\x08\x65xchange\x18\x03 \x01(\t\x12\x13\n\x0brouting_key\x18\x04 \x01(\t\x12\x44\n\nproperties\x18\x05 \x01(\x0b\x32+.amqp_imposter.control.v1.MessagePropertiesH\x00\x88\x01\x01\x12\x0c\n\x04\x62ody\x18\x06 \x01(\x0c\x42\r\n\x0b_properties\"\x9d\x01\n\x13\x42\x61sicReturnSelector\x12\x17\n\nreply_code\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x15\n\x08\x65xchange\x18\x03 \x01(\tH\x01\x88\x01\x01\x12\x18\n\x0brouting_key\x18\x04 \x01(\tH\x02\x88\x01\x01\x42\r\n\x0b_reply_codeB\x0b\n\t_exchangeB\x0e\n\x0c_routing_keyJ\x04\x08\x02\x10\x03J\x04\x08\x05\x10\x06J\x04\x08\x06\x10\x07\"\xa3\x02\n\x12\x42\x61sicReturnPattern\x12\x17\n\nreply_code\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x17\n\nreply_text\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x15\n\x08\x65xchange\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x18\n\x0brouting_key\x18\x04 \x01(\tH\x03\x88\x01\x01\x12\x44\n\nproperties\x18\x05 \x01(\x0b\x32+.amqp_imposter.control.v1.MessagePropertiesH\x04\x88\x01\x01\x12\x11\n\x04\x62ody\x18\x06 \x01(\x0cH\x05\x88\x01\x01\x42\r\n\x0b_reply_codeB\r\n\x0b_reply_textB\x0b\n\t_exchangeB\x0e\n\x0c_routing_keyB\r\n\x0b_propertiesB\x07\n\x05_body\"2\n\x08\x42\x61sicAck\x12\x14\n\x0c\x64\x65livery_tag\x18\x01 \x01(\x04\x12\x10\n\x08multiple\x18\x02 \x01(\x08\"D\n\x10\x42\x61sicAckSelector\x12\x19\n\x0c\x64\x65livery_tag\x18\x01 \x01(\x04H\x00\x88\x01\x01\x42\x0f\n\r_delivery_tagJ\x04\x08\x02\x10\x03\"a\n\x0f\x42\x61sicAckPattern\x12\x19\n\x0c\x64\x65livery_tag\x18\x01 \x01(\x04H\x00\x88\x01\x01\x12\x15\n\x08multiple\x18\x02 \x01(\x08H\x01\x88\x01\x01\x42\x0f\n\r_delivery_tagB\x0b\n\t_multiple\"D\n\tBasicNack\x12\x14\n\x0c\x64\x65livery_tag\x18\x01 \x01(\x04\x12\x10\n\x08multiple\x18\x02 \x01(\x08\x12\x0f\n\x07requeue\x18\x03 \x01(\x08\"K\n\x11\x42\x61sicNackSelector\x12\x19\n\x0c\x64\x65livery_tag\x18\x01 \x01(\x04H\x00\x88\x01\x01\x42\x0f\n\r_delivery_tagJ\x04\x08\x02\x10\x03J\x04\x08\x03\x10\x04\"\x84\x01\n\x10\x42\x61sicNackPattern\x12\x19\n\x0c\x64\x65livery_tag\x18\x01 \x01(\x04H\x00\x88\x01\x01\x12\x15\n\x08multiple\x18\x02 \x01(\x08H\x01\x88\x01\x01\x12\x14\n\x07requeue\x18\x03 \x01(\x08H\x02\x88\x01\x01\x42\x0f\n\r_delivery_tagB\x0b\n\t_multipleB\n\n\x08_requeue\"4\n\x0b\x42\x61sicReject\x12\x14\n\x0c\x64\x65livery_tag\x18\x01 \x01(\x04\x12\x0f\n\x07requeue\x18\x02 \x01(\x08\"G\n\x13\x42\x61sicRejectSelector\x12\x19\n\x0c\x64\x65livery_tag\x18\x01 \x01(\x04H\x00\x88\x01\x01\x42\x0f\n\r_delivery_tagJ\x04\x08\x02\x10\x03\"b\n\x12\x42\x61sicRejectPattern\x12\x19\n\x0c\x64\x65livery_tag\x18\x01 \x01(\x04H\x00\x88\x01\x01\x12\x14\n\x07requeue\x18\x02 \x01(\x08H\x01\x88\x01\x01\x42\x0f\n\r_delivery_tagB\n\n\x08_requeue\"\xd9\x01\n\x0c\x42\x61sicDeliver\x12\x14\n\x0c\x63onsumer_tag\x18\x01 \x01(\t\x12\x14\n\x0c\x64\x65livery_tag\x18\x02 \x01(\x04\x12\x13\n\x0bredelivered\x18\x03 \x01(\x08\x12\x10\n\x08\x65xchange\x18\x04 \x01(\t\x12\x13\n\x0brouting_key\x18\x05 \x01(\t\x12\x44\n\nproperties\x18\x06 \x01(\x0b\x32+.amqp_imposter.control.v1.MessagePropertiesH\x00\x88\x01\x01\x12\x0c\n\x04\x62ody\x18\x07 \x01(\x0c\x42\r\n\x0b_properties\"t\n\x14\x42\x61sicDeliverSelector\x12\x19\n\x0c\x63onsumer_tag\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x19\n\x0c\x64\x65livery_tag\x18\x02 \x01(\x04H\x01\x88\x01\x01\x42\x0f\n\r_consumer_tagB\x0f\n\r_delivery_tagJ\x04\x08\x03\x10\x08\"\xd6\x02\n\x13\x42\x61sicDeliverPattern\x12\x19\n\x0c\x63onsumer_tag\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x19\n\x0c\x64\x65livery_tag\x18\x02 \x01(\x04H\x01\x88\x01\x01\x12\x18\n\x0bredelivered\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12\x15\n\x08\x65xchange\x18\x04 \x01(\tH\x03\x88\x01\x01\x12\x18\n\x0brouting_key\x18\x05 \x01(\tH\x04\x88\x01\x01\x12\x44\n\nproperties\x18\x06 \x01(\x0b\x32+.amqp_imposter.control.v1.MessagePropertiesH\x05\x88\x01\x01\x12\x11\n\x04\x62ody\x18\x07 \x01(\x0cH\x06\x88\x01\x01\x42\x0f\n\r_consumer_tagB\x0f\n\r_delivery_tagB\x0e\n\x0c_redeliveredB\x0b\n\t_exchangeB\x0e\n\x0c_routing_keyB\r\n\x0b_propertiesB\x07\n\x05_body\")\n\x08\x42\x61sicGet\x12\r\n\x05queue\x18\x01 \x01(\t\x12\x0e\n\x06no_ack\x18\x02 \x01(\x08\"\x1e\n\x10\x42\x61sicGetSelectorJ\x04\x08\x01\x10\x02J\x04\x08\x02\x10\x03\"O\n\x0f\x42\x61sicGetPattern\x12\x12\n\x05queue\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06no_ack\x18\x02 \x01(\x08H\x01\x88\x01\x01\x42\x08\n\x06_queueB\t\n\x07_no_ack\"\xd8\x01\n\nBasicGetOk\x12\x14\n\x0c\x64\x65livery_tag\x18\x01 \x01(\x04\x12\x13\n\x0bredelivered\x18\x02 \x01(\x08\x12\x10\n\x08\x65xchange\x18\x03 \x01(\t\x12\x13\n\x0brouting_key\x18\x04 \x01(\t\x12\x15\n\rmessage_count\x18\x05 \x01(\r\x12\x44\n\nproperties\x18\x06 \x01(\x0b\x32+.amqp_imposter.control.v1.MessagePropertiesH\x00\x88\x01\x01\x12\x0c\n\x04\x62ody\x18\x07 \x01(\x0c\x42\r\n\x0b_properties\"F\n\x12\x42\x61sicGetOkSelector\x12\x19\n\x0c\x64\x65livery_tag\x18\x01 \x01(\x04H\x00\x88\x01\x01\x42\x0f\n\r_delivery_tagJ\x04\x08\x02\x10\x08\"\xd6\x02\n\x11\x42\x61sicGetOkPattern\x12\x19\n\x0c\x64\x65livery_tag\x18\x01 \x01(\x04H\x00\x88\x01\x01\x12\x18\n\x0bredelivered\x18\x02 \x01(\x08H\x01\x88\x01\x01\x12\x15\n\x08\x65xchange\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x18\n\x0brouting_key\x18\x04 \x01(\tH\x03\x88\x01\x01\x12\x1a\n\rmessage_count\x18\x05 \x01(\rH\x04\x88\x01\x01\x12\x44\n\nproperties\x18\x06 \x01(\x0b\x32+.amqp_imposter.control.v1.MessagePropertiesH\x05\x88\x01\x01\x12\x11\n\x04\x62ody\x18\x07 \x01(\x0cH\x06\x88\x01\x01\x42\x0f\n\r_delivery_tagB\x0e\n\x0c_redeliveredB\x0b\n\t_exchangeB\x0e\n\x0c_routing_keyB\x10\n\x0e_message_countB\r\n\x0b_propertiesB\x07\n\x05_body\"\x0f\n\rBasicGetEmpty\"\x17\n\x15\x42\x61sicGetEmptySelector\"\x16\n\x14\x42\x61sicGetEmptyPattern\"\xb5\x13\n\x06Method\x12\x45\n\x10\x63onnection_start\x18\x01 \x01(\x0b\x32).amqp_imposter.control.v1.ConnectionStartH\x00\x12J\n\x13\x63onnection_start_ok\x18\x02 \x01(\x0b\x32+.amqp_imposter.control.v1.ConnectionStartOkH\x00\x12\x43\n\x0f\x63onnection_tune\x18\x03 \x01(\x0b\x32(.amqp_imposter.control.v1.ConnectionTuneH\x00\x12H\n\x12\x63onnection_tune_ok\x18\x04 \x01(\x0b\x32*.amqp_imposter.control.v1.ConnectionTuneOkH\x00\x12\x43\n\x0f\x63onnection_open\x18\x05 \x01(\x0b\x32(.amqp_imposter.control.v1.ConnectionOpenH\x00\x12H\n\x12\x63onnection_open_ok\x18\x06 \x01(\x0b\x32*.amqp_imposter.control.v1.ConnectionOpenOkH\x00\x12\x45\n\x10\x63onnection_close\x18\x07 \x01(\x0b\x32).amqp_imposter.control.v1.ConnectionCloseH\x00\x12J\n\x13\x63onnection_close_ok\x18\x08 \x01(\x0b\x32+.amqp_imposter.control.v1.ConnectionCloseOkH\x00\x12=\n\x0c\x63hannel_open\x18\t \x01(\x0b\x32%.amqp_imposter.control.v1.ChannelOpenH\x00\x12\x42\n\x0f\x63hannel_open_ok\x18\n \x01(\x0b\x32\'.amqp_imposter.control.v1.ChannelOpenOkH\x00\x12?\n\rchannel_close\x18\x0b \x01(\x0b\x32&.amqp_imposter.control.v1.ChannelCloseH\x00\x12\x44\n\x10\x63hannel_close_ok\x18\x0c \x01(\x0b\x32(.amqp_imposter.control.v1.ChannelCloseOkH\x00\x12\x41\n\x0e\x63onfirm_select\x18\r \x01(\x0b\x32\'.amqp_imposter.control.v1.ConfirmSelectH\x00\x12\x46\n\x11\x63onfirm_select_ok\x18\x0e \x01(\x0b\x32).amqp_imposter.control.v1.ConfirmSelectOkH\x00\x12\x45\n\x10\x65xchange_declare\x18\x0f \x01(\x0b\x32).amqp_imposter.control.v1.ExchangeDeclareH\x00\x12J\n\x13\x65xchange_declare_ok\x18\x10 \x01(\x0b\x32+.amqp_imposter.control.v1.ExchangeDeclareOkH\x00\x12?\n\rqueue_declare\x18\x11 \x01(\x0b\x32&.amqp_imposter.control.v1.QueueDeclareH\x00\x12\x44\n\x10queue_declare_ok\x18\x12 \x01(\x0b\x32(.amqp_imposter.control.v1.QueueDeclareOkH\x00\x12\x39\n\nqueue_bind\x18\x13 \x01(\x0b\x32#.amqp_imposter.control.v1.QueueBindH\x00\x12>\n\rqueue_bind_ok\x18\x14 \x01(\x0b\x32%.amqp_imposter.control.v1.QueueBindOkH\x00\x12\x37\n\tbasic_qos\x18\x15 \x01(\x0b\x32\".amqp_imposter.control.v1.BasicQosH\x00\x12<\n\x0c\x62\x61sic_qos_ok\x18\x16 \x01(\x0b\x32$.amqp_imposter.control.v1.BasicQosOkH\x00\x12?\n\rbasic_consume\x18\x17 \x01(\x0b\x32&.amqp_imposter.control.v1.BasicConsumeH\x00\x12\x44\n\x10\x62\x61sic_consume_ok\x18\x18 \x01(\x0b\x32(.amqp_imposter.control.v1.BasicConsumeOkH\x00\x12=\n\x0c\x62\x61sic_cancel\x18\x19 \x01(\x0b\x32%.amqp_imposter.control.v1.BasicCancelH\x00\x12\x42\n\x0f\x62\x61sic_cancel_ok\x18\x1a \x01(\x0b\x32\'.amqp_imposter.control.v1.BasicCancelOkH\x00\x12?\n\rbasic_publish\x18\x1b \x01(\x0b\x32&.amqp_imposter.control.v1.BasicPublishH\x00\x12=\n\x0c\x62\x61sic_return\x18\x1c \x01(\x0b\x32%.amqp_imposter.control.v1.BasicReturnH\x00\x12\x37\n\tbasic_ack\x18\x1d \x01(\x0b\x32\".amqp_imposter.control.v1.BasicAckH\x00\x12\x39\n\nbasic_nack\x18\x1e \x01(\x0b\x32#.amqp_imposter.control.v1.BasicNackH\x00\x12=\n\x0c\x62\x61sic_reject\x18\x1f \x01(\x0b\x32%.amqp_imposter.control.v1.BasicRejectH\x00\x12?\n\rbasic_deliver\x18 \x01(\x0b\x32&.amqp_imposter.control.v1.BasicDeliverH\x00\x12\x37\n\tbasic_get\x18! \x01(\x0b\x32\".amqp_imposter.control.v1.BasicGetH\x00\x12<\n\x0c\x62\x61sic_get_ok\x18\" \x01(\x0b\x32$.amqp_imposter.control.v1.BasicGetOkH\x00\x12\x42\n\x0f\x62\x61sic_get_empty\x18# \x01(\x0b\x32\'.amqp_imposter.control.v1.BasicGetEmptyH\x00\x12?\n\rexchange_bind\x18$ \x01(\x0b\x32&.amqp_imposter.control.v1.ExchangeBindH\x00\x12\x44\n\x10\x65xchange_bind_ok\x18% \x01(\x0b\x32(.amqp_imposter.control.v1.ExchangeBindOkH\x00\x42\x06\n\x04kind\"\xe1\x15\n\x08Selector\x12M\n\x10\x63onnection_start\x18\x01 \x01(\x0b\x32\x31.amqp_imposter.control.v1.ConnectionStartSelectorH\x00\x12R\n\x13\x63onnection_start_ok\x18\x02 \x01(\x0b\x32\x33.amqp_imposter.control.v1.ConnectionStartOkSelectorH\x00\x12K\n\x0f\x63onnection_tune\x18\x03 \x01(\x0b\x32\x30.amqp_imposter.control.v1.ConnectionTuneSelectorH\x00\x12P\n\x12\x63onnection_tune_ok\x18\x04 \x01(\x0b\x32\x32.amqp_imposter.control.v1.ConnectionTuneOkSelectorH\x00\x12K\n\x0f\x63onnection_open\x18\x05 \x01(\x0b\x32\x30.amqp_imposter.control.v1.ConnectionOpenSelectorH\x00\x12P\n\x12\x63onnection_open_ok\x18\x06 \x01(\x0b\x32\x32.amqp_imposter.control.v1.ConnectionOpenOkSelectorH\x00\x12M\n\x10\x63onnection_close\x18\x07 \x01(\x0b\x32\x31.amqp_imposter.control.v1.ConnectionCloseSelectorH\x00\x12R\n\x13\x63onnection_close_ok\x18\x08 \x01(\x0b\x32\x33.amqp_imposter.control.v1.ConnectionCloseOkSelectorH\x00\x12\x45\n\x0c\x63hannel_open\x18\t \x01(\x0b\x32-.amqp_imposter.control.v1.ChannelOpenSelectorH\x00\x12J\n\x0f\x63hannel_open_ok\x18\n \x01(\x0b\x32/.amqp_imposter.control.v1.ChannelOpenOkSelectorH\x00\x12G\n\rchannel_close\x18\x0b \x01(\x0b\x32..amqp_imposter.control.v1.ChannelCloseSelectorH\x00\x12L\n\x10\x63hannel_close_ok\x18\x0c \x01(\x0b\x32\x30.amqp_imposter.control.v1.ChannelCloseOkSelectorH\x00\x12I\n\x0e\x63onfirm_select\x18\r \x01(\x0b\x32/.amqp_imposter.control.v1.ConfirmSelectSelectorH\x00\x12N\n\x11\x63onfirm_select_ok\x18\x0e \x01(\x0b\x32\x31.amqp_imposter.control.v1.ConfirmSelectOkSelectorH\x00\x12M\n\x10\x65xchange_declare\x18\x0f \x01(\x0b\x32\x31.amqp_imposter.control.v1.ExchangeDeclareSelectorH\x00\x12R\n\x13\x65xchange_declare_ok\x18\x10 \x01(\x0b\x32\x33.amqp_imposter.control.v1.ExchangeDeclareOkSelectorH\x00\x12G\n\rexchange_bind\x18\x11 \x01(\x0b\x32..amqp_imposter.control.v1.ExchangeBindSelectorH\x00\x12L\n\x10\x65xchange_bind_ok\x18\x12 \x01(\x0b\x32\x30.amqp_imposter.control.v1.ExchangeBindOkSelectorH\x00\x12G\n\rqueue_declare\x18\x13 \x01(\x0b\x32..amqp_imposter.control.v1.QueueDeclareSelectorH\x00\x12L\n\x10queue_declare_ok\x18\x14 \x01(\x0b\x32\x30.amqp_imposter.control.v1.QueueDeclareOkSelectorH\x00\x12\x41\n\nqueue_bind\x18\x15 \x01(\x0b\x32+.amqp_imposter.control.v1.QueueBindSelectorH\x00\x12\x46\n\rqueue_bind_ok\x18\x16 \x01(\x0b\x32-.amqp_imposter.control.v1.QueueBindOkSelectorH\x00\x12?\n\tbasic_qos\x18\x17 \x01(\x0b\x32*.amqp_imposter.control.v1.BasicQosSelectorH\x00\x12\x44\n\x0c\x62\x61sic_qos_ok\x18\x18 \x01(\x0b\x32,.amqp_imposter.control.v1.BasicQosOkSelectorH\x00\x12G\n\rbasic_consume\x18\x19 \x01(\x0b\x32..amqp_imposter.control.v1.BasicConsumeSelectorH\x00\x12L\n\x10\x62\x61sic_consume_ok\x18\x1a \x01(\x0b\x32\x30.amqp_imposter.control.v1.BasicConsumeOkSelectorH\x00\x12\x45\n\x0c\x62\x61sic_cancel\x18\x1b \x01(\x0b\x32-.amqp_imposter.control.v1.BasicCancelSelectorH\x00\x12J\n\x0f\x62\x61sic_cancel_ok\x18\x1c \x01(\x0b\x32/.amqp_imposter.control.v1.BasicCancelOkSelectorH\x00\x12G\n\rbasic_publish\x18\x1d \x01(\x0b\x32..amqp_imposter.control.v1.BasicPublishSelectorH\x00\x12\x45\n\x0c\x62\x61sic_return\x18\x1e \x01(\x0b\x32-.amqp_imposter.control.v1.BasicReturnSelectorH\x00\x12?\n\tbasic_ack\x18\x1f \x01(\x0b\x32*.amqp_imposter.control.v1.BasicAckSelectorH\x00\x12\x41\n\nbasic_nack\x18 \x01(\x0b\x32+.amqp_imposter.control.v1.BasicNackSelectorH\x00\x12\x45\n\x0c\x62\x61sic_reject\x18! \x01(\x0b\x32-.amqp_imposter.control.v1.BasicRejectSelectorH\x00\x12G\n\rbasic_deliver\x18\" \x01(\x0b\x32..amqp_imposter.control.v1.BasicDeliverSelectorH\x00\x12?\n\tbasic_get\x18# \x01(\x0b\x32*.amqp_imposter.control.v1.BasicGetSelectorH\x00\x12\x44\n\x0c\x62\x61sic_get_ok\x18$ \x01(\x0b\x32,.amqp_imposter.control.v1.BasicGetOkSelectorH\x00\x12J\n\x0f\x62\x61sic_get_empty\x18% \x01(\x0b\x32/.amqp_imposter.control.v1.BasicGetEmptySelectorH\x00\x42\x08\n\x06method\"\xbb\x15\n\x07Pattern\x12L\n\x10\x63onnection_start\x18\x01 \x01(\x0b\x32\x30.amqp_imposter.control.v1.ConnectionStartPatternH\x00\x12Q\n\x13\x63onnection_start_ok\x18\x02 \x01(\x0b\x32\x32.amqp_imposter.control.v1.ConnectionStartOkPatternH\x00\x12J\n\x0f\x63onnection_tune\x18\x03 \x01(\x0b\x32/.amqp_imposter.control.v1.ConnectionTunePatternH\x00\x12O\n\x12\x63onnection_tune_ok\x18\x04 \x01(\x0b\x32\x31.amqp_imposter.control.v1.ConnectionTuneOkPatternH\x00\x12J\n\x0f\x63onnection_open\x18\x05 \x01(\x0b\x32/.amqp_imposter.control.v1.ConnectionOpenPatternH\x00\x12O\n\x12\x63onnection_open_ok\x18\x06 \x01(\x0b\x32\x31.amqp_imposter.control.v1.ConnectionOpenOkPatternH\x00\x12L\n\x10\x63onnection_close\x18\x07 \x01(\x0b\x32\x30.amqp_imposter.control.v1.ConnectionClosePatternH\x00\x12Q\n\x13\x63onnection_close_ok\x18\x08 \x01(\x0b\x32\x32.amqp_imposter.control.v1.ConnectionCloseOkPatternH\x00\x12\x44\n\x0c\x63hannel_open\x18\t \x01(\x0b\x32,.amqp_imposter.control.v1.ChannelOpenPatternH\x00\x12I\n\x0f\x63hannel_open_ok\x18\n \x01(\x0b\x32..amqp_imposter.control.v1.ChannelOpenOkPatternH\x00\x12\x46\n\rchannel_close\x18\x0b \x01(\x0b\x32-.amqp_imposter.control.v1.ChannelClosePatternH\x00\x12K\n\x10\x63hannel_close_ok\x18\x0c \x01(\x0b\x32/.amqp_imposter.control.v1.ChannelCloseOkPatternH\x00\x12H\n\x0e\x63onfirm_select\x18\r \x01(\x0b\x32..amqp_imposter.control.v1.ConfirmSelectPatternH\x00\x12M\n\x11\x63onfirm_select_ok\x18\x0e \x01(\x0b\x32\x30.amqp_imposter.control.v1.ConfirmSelectOkPatternH\x00\x12L\n\x10\x65xchange_declare\x18\x0f \x01(\x0b\x32\x30.amqp_imposter.control.v1.ExchangeDeclarePatternH\x00\x12Q\n\x13\x65xchange_declare_ok\x18\x10 \x01(\x0b\x32\x32.amqp_imposter.control.v1.ExchangeDeclareOkPatternH\x00\x12\x46\n\rexchange_bind\x18\x11 \x01(\x0b\x32-.amqp_imposter.control.v1.ExchangeBindPatternH\x00\x12K\n\x10\x65xchange_bind_ok\x18\x12 \x01(\x0b\x32/.amqp_imposter.control.v1.ExchangeBindOkPatternH\x00\x12\x46\n\rqueue_declare\x18\x13 \x01(\x0b\x32-.amqp_imposter.control.v1.QueueDeclarePatternH\x00\x12K\n\x10queue_declare_ok\x18\x14 \x01(\x0b\x32/.amqp_imposter.control.v1.QueueDeclareOkPatternH\x00\x12@\n\nqueue_bind\x18\x15 \x01(\x0b\x32*.amqp_imposter.control.v1.QueueBindPatternH\x00\x12\x45\n\rqueue_bind_ok\x18\x16 \x01(\x0b\x32,.amqp_imposter.control.v1.QueueBindOkPatternH\x00\x12>\n\tbasic_qos\x18\x17 \x01(\x0b\x32).amqp_imposter.control.v1.BasicQosPatternH\x00\x12\x43\n\x0c\x62\x61sic_qos_ok\x18\x18 \x01(\x0b\x32+.amqp_imposter.control.v1.BasicQosOkPatternH\x00\x12\x46\n\rbasic_consume\x18\x19 \x01(\x0b\x32-.amqp_imposter.control.v1.BasicConsumePatternH\x00\x12K\n\x10\x62\x61sic_consume_ok\x18\x1a \x01(\x0b\x32/.amqp_imposter.control.v1.BasicConsumeOkPatternH\x00\x12\x44\n\x0c\x62\x61sic_cancel\x18\x1b \x01(\x0b\x32,.amqp_imposter.control.v1.BasicCancelPatternH\x00\x12I\n\x0f\x62\x61sic_cancel_ok\x18\x1c \x01(\x0b\x32..amqp_imposter.control.v1.BasicCancelOkPatternH\x00\x12\x46\n\rbasic_publish\x18\x1d \x01(\x0b\x32-.amqp_imposter.control.v1.BasicPublishPatternH\x00\x12\x44\n\x0c\x62\x61sic_return\x18\x1e \x01(\x0b\x32,.amqp_imposter.control.v1.BasicReturnPatternH\x00\x12>\n\tbasic_ack\x18\x1f \x01(\x0b\x32).amqp_imposter.control.v1.BasicAckPatternH\x00\x12@\n\nbasic_nack\x18 \x01(\x0b\x32*.amqp_imposter.control.v1.BasicNackPatternH\x00\x12\x44\n\x0c\x62\x61sic_reject\x18! \x01(\x0b\x32,.amqp_imposter.control.v1.BasicRejectPatternH\x00\x12\x46\n\rbasic_deliver\x18\" \x01(\x0b\x32-.amqp_imposter.control.v1.BasicDeliverPatternH\x00\x12>\n\tbasic_get\x18# \x01(\x0b\x32).amqp_imposter.control.v1.BasicGetPatternH\x00\x12\x43\n\x0c\x62\x61sic_get_ok\x18$ \x01(\x0b\x32+.amqp_imposter.control.v1.BasicGetOkPatternH\x00\x12I\n\x0f\x62\x61sic_get_empty\x18% \x01(\x0b\x32..amqp_imposter.control.v1.BasicGetEmptyPatternH\x00\x42\x08\n\x06method\"`\n\x08Weighted\x12\x34\n\x08selector\x18\x01 \x01(\x0b\x32\".amqp_imposter.control.v1.Selector\x12\x13\n\x06weight\x18\x02 \x01(\rH\x00\x88\x01\x01\x42\t\n\x07_weight\"\xb2\x01\n\x08Scripted\x12\x35\n\x08received\x18\x01 \x01(\x0b\x32!.amqp_imposter.control.v1.PatternH\x00\x12\x31\n\x04sent\x18\x02 \x01(\x0b\x32!.amqp_imposter.control.v1.PatternH\x00\x12\x34\n\tthen_send\x18\x03 \x01(\x0b\x32!.amqp_imposter.control.v1.PatternB\x06\n\x04when\"\xa2\x04\n\rSessionConfig\x12\x11\n\x04seed\x18\x01 \x01(\x04H\x00\x88\x01\x01\x12N\n\x13negotiation_options\x18\x02 \x01(\x0b\x32,.amqp_imposter.control.v1.NegotiationOptionsH\x01\x88\x01\x01\x12\x33\n\x07weights\x18\x03 \x03(\x0b\x32\".amqp_imposter.control.v1.Weighted\x12\x38\n\x0cidle_weights\x18\x04 \x03(\x0b\x32\".amqp_imposter.control.v1.Weighted\x12\x32\n\x06script\x18\x05 \x03(\x0b\x32\".amqp_imposter.control.v1.Scripted\x12\x18\n\x0bstop_weight\x18\x06 \x01(\rH\x02\x88\x01\x01\x12\x1d\n\x10max_burst_length\x18\x07 \x01(\rH\x03\x88\x01\x01\x12\x18\n\x0bidle_millis\x18\x08 \x01(\rH\x04\x88\x01\x01\x12\x17\n\nmax_buffer\x18\t \x01(\rH\x05\x88\x01\x01\x12!\n\x14max_transcript_lines\x18\n \x01(\rH\x06\x88\x01\x01\x42\x07\n\x05_seedB\x16\n\x14_negotiation_optionsB\x0e\n\x0c_stop_weightB\x13\n\x11_max_burst_lengthB\x0e\n\x0c_idle_millisB\r\n\x0b_max_bufferB\x17\n\x15_max_transcript_lines\"\xe5\x01\n\x0eTranscriptLine\x12\r\n\x05index\x18\x01 \x01(\x04\x12\x0e\n\x06micros\x18\x02 \x01(\x03\x12\x14\n\x0c\x65poch_micros\x18\x03 \x01(\x03\x12\x38\n\x05\x65vent\x18\x04 \x01(\x0e\x32).amqp_imposter.control.v1.TranscriptEvent\x12\x35\n\x06method\x18\x05 \x01(\x0b\x32 .amqp_imposter.control.v1.MethodH\x00\x88\x01\x01\x12\x0e\n\x06\x64\x65tail\x18\x06 \x01(\t\x12\x12\n\nwire_bytes\x18\x07 \x01(\x0c\x42\t\n\x07_method\"\xb2\x01\n\x0bStatusReply\x12\x16\n\tamqp_port\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x14\n\x0c\x61mqp_greeted\x18\x02 \x01(\x08\x12\x18\n\x10transcript_lines\x18\x03 \x01(\x04\x12\x14\n\x0c\x65poch_micros\x18\x04 \x01(\x03\x12\x37\n\x06\x63onfig\x18\x05 \x01(\x0b\x32\'.amqp_imposter.control.v1.SessionConfigB\x0c\n\n_amqp_port\"K\n\x10\x43onfigureRequest\x12\x37\n\x06\x63onfig\x18\x01 \x01(\x0b\x32\'.amqp_imposter.control.v1.SessionConfig\"\x0f\n\rStatusRequest\"\x0e\n\x0cResetRequest\"\x13\n\x11TranscriptRequest\"\x18\n\x16WatchTranscriptRequest*:\n\nBaseWeight\x12\x1b\n\x17\x42\x41SE_WEIGHT_UNSPECIFIED\x10\x00\x12\x0f\n\x0b\x42\x41SE_WEIGHT\x10\x64*\x9b\x04\n\x0fTranscriptEvent\x12 \n\x1cTRANSCRIPT_EVENT_UNSPECIFIED\x10\x00\x12$\n TRANSCRIPT_EVENT_SESSION_STARTED\x10\x01\x12\"\n\x1eTRANSCRIPT_EVENT_TCP_CONNECTED\x10\x02\x12!\n\x1dTRANSCRIPT_EVENT_TCP_REJECTED\x10\x03\x12\x1d\n\x19TRANSCRIPT_EVENT_TCP_DOWN\x10\x04\x12!\n\x1dTRANSCRIPT_EVENT_IDLE_TIMEOUT\x10\x05\x12$\n TRANSCRIPT_EVENT_PROTOCOL_HEADER\x10\x06\x12$\n TRANSCRIPT_EVENT_FRAME_MALFORMED\x10\x07\x12&\n\"TRANSCRIPT_EVENT_HEARTBEAT_INGRESS\x10\x08\x12#\n\x1fTRANSCRIPT_EVENT_METHOD_INGRESS\x10\t\x12\"\n\x1eTRANSCRIPT_EVENT_METHOD_EGRESS\x10\n\x12+\n\'TRANSCRIPT_EVENT_METHOD_UNREPRESENTABLE\x10\x0b\x12%\n!TRANSCRIPT_EVENT_HEARTBEAT_EGRESS\x10\x0c\x12&\n\"TRANSCRIPT_EVENT_HEARTBEAT_TIMEOUT\x10\r2\xf4\x03\n\x08Imposter\x12^\n\tConfigure\x12*.amqp_imposter.control.v1.ConfigureRequest\x1a%.amqp_imposter.control.v1.StatusReply\x12X\n\x06Status\x12\'.amqp_imposter.control.v1.StatusRequest\x1a%.amqp_imposter.control.v1.StatusReply\x12V\n\x05Reset\x12&.amqp_imposter.control.v1.ResetRequest\x1a%.amqp_imposter.control.v1.StatusReply\x12\x65\n\nTranscript\x12+.amqp_imposter.control.v1.TranscriptRequest\x1a(.amqp_imposter.control.v1.TranscriptLine0\x01\x12o\n\x0fWatchTranscript\x12\x30.amqp_imposter.control.v1.WatchTranscriptRequest\x1a(.amqp_imposter.control.v1.TranscriptLine0\x01\x62\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -34,10 +34,10 @@ DESCRIPTOR._loaded_options = None _globals['_AMQPTABLE_ENTRIESENTRY']._loaded_options = None _globals['_AMQPTABLE_ENTRIESENTRY']._serialized_options = b'8\001' - _globals['_BASEWEIGHT']._serialized_start=22168 - _globals['_BASEWEIGHT']._serialized_end=22226 - _globals['_TRANSCRIPTEVENT']._serialized_start=22229 - _globals['_TRANSCRIPTEVENT']._serialized_end=22687 + _globals['_BASEWEIGHT']._serialized_start=22230 + _globals['_BASEWEIGHT']._serialized_end=22288 + _globals['_TRANSCRIPTEVENT']._serialized_start=22291 + _globals['_TRANSCRIPTEVENT']._serialized_end=22830 _globals['_VOID']._serialized_start=102 _globals['_VOID']._serialized_end=108 _globals['_STRINGLIST']._serialized_start=110 @@ -55,253 +55,253 @@ _globals['_NEGOTIATIONOPTIONS']._serialized_start=1255 _globals['_NEGOTIATIONOPTIONS']._serialized_end=1703 _globals['_CONNECTIONSTART']._serialized_start=1706 - _globals['_CONNECTIONSTART']._serialized_end=1886 - _globals['_CONNECTIONSTARTSELECTOR']._serialized_start=1889 - _globals['_CONNECTIONSTARTSELECTOR']._serialized_end=2316 - _globals['_CONNECTIONSTARTPATTERN']._serialized_start=2319 - _globals['_CONNECTIONSTARTPATTERN']._serialized_end=2745 - _globals['_CONNECTIONSTARTOK']._serialized_start=2747 - _globals['_CONNECTIONSTARTOK']._serialized_end=2819 - _globals['_CONNECTIONSTARTOKSELECTOR']._serialized_start=2821 - _globals['_CONNECTIONSTARTOKSELECTOR']._serialized_end=2924 - _globals['_CONNECTIONSTARTOKPATTERN']._serialized_start=2927 - _globals['_CONNECTIONSTARTOKPATTERN']._serialized_end=3059 - _globals['_CONNECTIONTUNE']._serialized_start=3061 - _globals['_CONNECTIONTUNE']._serialized_end=3136 - _globals['_CONNECTIONTUNESELECTOR']._serialized_start=3139 - _globals['_CONNECTIONTUNESELECTOR']._serialized_end=3281 - _globals['_CONNECTIONTUNEPATTERN']._serialized_start=3284 - _globals['_CONNECTIONTUNEPATTERN']._serialized_end=3425 - _globals['_CONNECTIONTUNEOK']._serialized_start=3427 - _globals['_CONNECTIONTUNEOK']._serialized_end=3504 - _globals['_CONNECTIONTUNEOKSELECTOR']._serialized_start=3507 - _globals['_CONNECTIONTUNEOKSELECTOR']._serialized_end=3651 - _globals['_CONNECTIONTUNEOKPATTERN']._serialized_start=3654 - _globals['_CONNECTIONTUNEOKPATTERN']._serialized_end=3797 - _globals['_CONNECTIONOPEN']._serialized_start=3799 - _globals['_CONNECTIONOPEN']._serialized_end=3830 - _globals['_CONNECTIONOPENSELECTOR']._serialized_start=3832 - _globals['_CONNECTIONOPENSELECTOR']._serialized_end=3862 - _globals['_CONNECTIONOPENPATTERN']._serialized_start=3864 - _globals['_CONNECTIONOPENPATTERN']._serialized_end=3917 - _globals['_CONNECTIONOPENOK']._serialized_start=3919 - _globals['_CONNECTIONOPENOK']._serialized_end=3937 - _globals['_CONNECTIONOPENOKSELECTOR']._serialized_start=3939 - _globals['_CONNECTIONOPENOKSELECTOR']._serialized_end=3965 - _globals['_CONNECTIONOPENOKPATTERN']._serialized_start=3967 - _globals['_CONNECTIONOPENOKPATTERN']._serialized_end=3992 - _globals['_CONNECTIONCLOSE']._serialized_start=3994 - _globals['_CONNECTIONCLOSE']._serialized_end=4088 - _globals['_CONNECTIONCLOSESELECTOR']._serialized_start=4091 - _globals['_CONNECTIONCLOSESELECTOR']._serialized_end=4270 - _globals['_CONNECTIONCLOSEPATTERN']._serialized_start=4273 - _globals['_CONNECTIONCLOSEPATTERN']._serialized_end=4451 - _globals['_CONNECTIONCLOSEOK']._serialized_start=4453 - _globals['_CONNECTIONCLOSEOK']._serialized_end=4472 - _globals['_CONNECTIONCLOSEOKSELECTOR']._serialized_start=4474 - _globals['_CONNECTIONCLOSEOKSELECTOR']._serialized_end=4501 - _globals['_CONNECTIONCLOSEOKPATTERN']._serialized_start=4503 - _globals['_CONNECTIONCLOSEOKPATTERN']._serialized_end=4529 - _globals['_CHANNELOPEN']._serialized_start=4531 - _globals['_CHANNELOPEN']._serialized_end=4544 - _globals['_CHANNELOPENSELECTOR']._serialized_start=4546 - _globals['_CHANNELOPENSELECTOR']._serialized_end=4567 - _globals['_CHANNELOPENPATTERN']._serialized_start=4569 - _globals['_CHANNELOPENPATTERN']._serialized_end=4589 - _globals['_CHANNELOPENOK']._serialized_start=4591 - _globals['_CHANNELOPENOK']._serialized_end=4606 - _globals['_CHANNELOPENOKSELECTOR']._serialized_start=4608 - _globals['_CHANNELOPENOKSELECTOR']._serialized_end=4631 - _globals['_CHANNELOPENOKPATTERN']._serialized_start=4633 - _globals['_CHANNELOPENOKPATTERN']._serialized_end=4655 - _globals['_CHANNELCLOSE']._serialized_start=4657 - _globals['_CHANNELCLOSE']._serialized_end=4748 - _globals['_CHANNELCLOSESELECTOR']._serialized_start=4751 - _globals['_CHANNELCLOSESELECTOR']._serialized_end=4927 - _globals['_CHANNELCLOSEPATTERN']._serialized_start=4930 - _globals['_CHANNELCLOSEPATTERN']._serialized_end=5105 - _globals['_CHANNELCLOSEOK']._serialized_start=5107 - _globals['_CHANNELCLOSEOK']._serialized_end=5123 - _globals['_CHANNELCLOSEOKSELECTOR']._serialized_start=5125 - _globals['_CHANNELCLOSEOKSELECTOR']._serialized_end=5149 - _globals['_CHANNELCLOSEOKPATTERN']._serialized_start=5151 - _globals['_CHANNELCLOSEOKPATTERN']._serialized_end=5174 - _globals['_CONFIRMSELECT']._serialized_start=5176 - _globals['_CONFIRMSELECT']._serialized_end=5208 - _globals['_CONFIRMSELECTSELECTOR']._serialized_start=5210 - _globals['_CONFIRMSELECTSELECTOR']._serialized_end=5239 - _globals['_CONFIRMSELECTPATTERN']._serialized_start=5241 - _globals['_CONFIRMSELECTPATTERN']._serialized_end=5297 - _globals['_CONFIRMSELECTOK']._serialized_start=5299 - _globals['_CONFIRMSELECTOK']._serialized_end=5316 - _globals['_CONFIRMSELECTOKSELECTOR']._serialized_start=5318 - _globals['_CONFIRMSELECTOKSELECTOR']._serialized_end=5343 - _globals['_CONFIRMSELECTOKPATTERN']._serialized_start=5345 - _globals['_CONFIRMSELECTOKPATTERN']._serialized_end=5369 - _globals['_EXCHANGEDECLARE']._serialized_start=5372 - _globals['_EXCHANGEDECLARE']._serialized_end=5595 - _globals['_EXCHANGEDECLARESELECTOR']._serialized_start=5597 - _globals['_EXCHANGEDECLARESELECTOR']._serialized_end=5664 - _globals['_EXCHANGEDECLAREPATTERN']._serialized_start=5667 - _globals['_EXCHANGEDECLAREPATTERN']._serialized_end=6028 - _globals['_EXCHANGEDECLAREOK']._serialized_start=6030 - _globals['_EXCHANGEDECLAREOK']._serialized_end=6049 - _globals['_EXCHANGEDECLAREOKSELECTOR']._serialized_start=6051 - _globals['_EXCHANGEDECLAREOKSELECTOR']._serialized_end=6078 - _globals['_EXCHANGEDECLAREOKPATTERN']._serialized_start=6080 - _globals['_EXCHANGEDECLAREOKPATTERN']._serialized_end=6106 - _globals['_EXCHANGEBIND']._serialized_start=6109 - _globals['_EXCHANGEBIND']._serialized_end=6273 - _globals['_EXCHANGEBINDSELECTOR']._serialized_start=6275 - _globals['_EXCHANGEBINDSELECTOR']._serialized_end=6303 - _globals['_EXCHANGEBINDPATTERN']._serialized_start=6306 - _globals['_EXCHANGEBINDPATTERN']._serialized_end=6552 - _globals['_EXCHANGEBINDOK']._serialized_start=6554 - _globals['_EXCHANGEBINDOK']._serialized_end=6570 - _globals['_EXCHANGEBINDOKSELECTOR']._serialized_start=6572 - _globals['_EXCHANGEBINDOKSELECTOR']._serialized_end=6596 - _globals['_EXCHANGEBINDOKPATTERN']._serialized_start=6598 - _globals['_EXCHANGEBINDOKPATTERN']._serialized_end=6621 - _globals['_QUEUEDECLARE']._serialized_start=6624 - _globals['_QUEUEDECLARE']._serialized_end=6819 - _globals['_QUEUEDECLARESELECTOR']._serialized_start=6821 - _globals['_QUEUEDECLARESELECTOR']._serialized_end=6849 - _globals['_QUEUEDECLAREPATTERN']._serialized_start=6852 - _globals['_QUEUEDECLAREPATTERN']._serialized_end=7160 - _globals['_QUEUEDECLAREOK']._serialized_start=7162 - _globals['_QUEUEDECLAREOK']._serialized_end=7240 - _globals['_QUEUEDECLAREOKSELECTOR']._serialized_start=7242 - _globals['_QUEUEDECLAREOKSELECTOR']._serialized_end=7272 - _globals['_QUEUEDECLAREOKPATTERN']._serialized_start=7275 - _globals['_QUEUEDECLAREOKPATTERN']._serialized_end=7422 - _globals['_QUEUEBIND']._serialized_start=7425 - _globals['_QUEUEBIND']._serialized_end=7582 - _globals['_QUEUEBINDSELECTOR']._serialized_start=7584 - _globals['_QUEUEBINDSELECTOR']._serialized_end=7609 - _globals['_QUEUEBINDPATTERN']._serialized_start=7612 - _globals['_QUEUEBINDPATTERN']._serialized_end=7847 - _globals['_QUEUEBINDOK']._serialized_start=7849 - _globals['_QUEUEBINDOK']._serialized_end=7862 - _globals['_QUEUEBINDOKSELECTOR']._serialized_start=7864 - _globals['_QUEUEBINDOKSELECTOR']._serialized_end=7885 - _globals['_QUEUEBINDOKPATTERN']._serialized_start=7887 - _globals['_QUEUEBINDOKPATTERN']._serialized_end=7907 - _globals['_BASICQOS']._serialized_start=7909 - _globals['_BASICQOS']._serialized_end=7986 - _globals['_BASICQOSSELECTOR']._serialized_start=7988 - _globals['_BASICQOSSELECTOR']._serialized_end=8012 - _globals['_BASICQOSPATTERN']._serialized_start=8015 - _globals['_BASICQOSPATTERN']._serialized_end=8166 - _globals['_BASICQOSOK']._serialized_start=8168 - _globals['_BASICQOSOK']._serialized_end=8180 - _globals['_BASICQOSOKSELECTOR']._serialized_start=8182 - _globals['_BASICQOSOKSELECTOR']._serialized_end=8202 - _globals['_BASICQOSOKPATTERN']._serialized_start=8204 - _globals['_BASICQOSOKPATTERN']._serialized_end=8223 - _globals['_BASICCONSUME']._serialized_start=8226 - _globals['_BASICCONSUME']._serialized_end=8422 - _globals['_BASICCONSUMESELECTOR']._serialized_start=8424 - _globals['_BASICCONSUMESELECTOR']._serialized_end=8452 - _globals['_BASICCONSUMEPATTERN']._serialized_start=8455 - _globals['_BASICCONSUMEPATTERN']._serialized_end=8765 - _globals['_BASICCONSUMEOK']._serialized_start=8767 - _globals['_BASICCONSUMEOK']._serialized_end=8805 - _globals['_BASICCONSUMEOKSELECTOR']._serialized_start=8807 - _globals['_BASICCONSUMEOKSELECTOR']._serialized_end=8837 - _globals['_BASICCONSUMEOKPATTERN']._serialized_start=8839 - _globals['_BASICCONSUMEOKPATTERN']._serialized_end=8906 - _globals['_BASICCANCEL']._serialized_start=8908 - _globals['_BASICCANCEL']._serialized_end=8960 - _globals['_BASICCANCELSELECTOR']._serialized_start=8962 - _globals['_BASICCANCELSELECTOR']._serialized_end=9033 - _globals['_BASICCANCELPATTERN']._serialized_start=9035 - _globals['_BASICCANCELPATTERN']._serialized_end=9133 - _globals['_BASICCANCELOK']._serialized_start=9135 - _globals['_BASICCANCELOK']._serialized_end=9172 - _globals['_BASICCANCELOKSELECTOR']._serialized_start=9174 - _globals['_BASICCANCELOKSELECTOR']._serialized_end=9241 - _globals['_BASICCANCELOKPATTERN']._serialized_start=9243 - _globals['_BASICCANCELOKPATTERN']._serialized_end=9309 - _globals['_BASICPUBLISH']._serialized_start=9312 - _globals['_BASICPUBLISH']._serialized_end=9502 - _globals['_BASICPUBLISHSELECTOR']._serialized_start=9504 - _globals['_BASICPUBLISHSELECTOR']._serialized_end=9532 - _globals['_BASICPUBLISHPATTERN']._serialized_start=9535 - _globals['_BASICPUBLISHPATTERN']._serialized_end=9823 - _globals['_BASICRETURN']._serialized_start=9826 - _globals['_BASICRETURN']._serialized_end=10017 - _globals['_BASICRETURNSELECTOR']._serialized_start=10020 - _globals['_BASICRETURNSELECTOR']._serialized_end=10177 - _globals['_BASICRETURNPATTERN']._serialized_start=10180 - _globals['_BASICRETURNPATTERN']._serialized_end=10471 - _globals['_BASICACK']._serialized_start=10473 - _globals['_BASICACK']._serialized_end=10523 - _globals['_BASICACKSELECTOR']._serialized_start=10525 - _globals['_BASICACKSELECTOR']._serialized_end=10593 - _globals['_BASICACKPATTERN']._serialized_start=10595 - _globals['_BASICACKPATTERN']._serialized_end=10692 - _globals['_BASICNACK']._serialized_start=10694 - _globals['_BASICNACK']._serialized_end=10762 - _globals['_BASICNACKSELECTOR']._serialized_start=10764 - _globals['_BASICNACKSELECTOR']._serialized_end=10839 - _globals['_BASICNACKPATTERN']._serialized_start=10842 - _globals['_BASICNACKPATTERN']._serialized_end=10974 - _globals['_BASICREJECT']._serialized_start=10976 - _globals['_BASICREJECT']._serialized_end=11028 - _globals['_BASICREJECTSELECTOR']._serialized_start=11030 - _globals['_BASICREJECTSELECTOR']._serialized_end=11101 - _globals['_BASICREJECTPATTERN']._serialized_start=11103 - _globals['_BASICREJECTPATTERN']._serialized_end=11201 - _globals['_BASICDELIVER']._serialized_start=11204 - _globals['_BASICDELIVER']._serialized_end=11421 - _globals['_BASICDELIVERSELECTOR']._serialized_start=11423 - _globals['_BASICDELIVERSELECTOR']._serialized_end=11539 - _globals['_BASICDELIVERPATTERN']._serialized_start=11542 - _globals['_BASICDELIVERPATTERN']._serialized_end=11884 - _globals['_BASICGET']._serialized_start=11886 - _globals['_BASICGET']._serialized_end=11927 - _globals['_BASICGETSELECTOR']._serialized_start=11929 - _globals['_BASICGETSELECTOR']._serialized_end=11959 - _globals['_BASICGETPATTERN']._serialized_start=11961 - _globals['_BASICGETPATTERN']._serialized_end=12040 - _globals['_BASICGETOK']._serialized_start=12043 - _globals['_BASICGETOK']._serialized_end=12259 - _globals['_BASICGETOKSELECTOR']._serialized_start=12261 - _globals['_BASICGETOKSELECTOR']._serialized_end=12331 - _globals['_BASICGETOKPATTERN']._serialized_start=12334 - _globals['_BASICGETOKPATTERN']._serialized_end=12676 - _globals['_BASICGETEMPTY']._serialized_start=12678 - _globals['_BASICGETEMPTY']._serialized_end=12693 - _globals['_BASICGETEMPTYSELECTOR']._serialized_start=12695 - _globals['_BASICGETEMPTYSELECTOR']._serialized_end=12718 - _globals['_BASICGETEMPTYPATTERN']._serialized_start=12720 - _globals['_BASICGETEMPTYPATTERN']._serialized_end=12742 - _globals['_METHOD']._serialized_start=12745 - _globals['_METHOD']._serialized_end=15230 - _globals['_SELECTOR']._serialized_start=15233 - _globals['_SELECTOR']._serialized_end=18018 - _globals['_PATTERN']._serialized_start=18021 - _globals['_PATTERN']._serialized_end=20768 - _globals['_WEIGHTED']._serialized_start=20770 - _globals['_WEIGHTED']._serialized_end=20866 - _globals['_SCRIPTED']._serialized_start=20869 - _globals['_SCRIPTED']._serialized_end=21047 - _globals['_SESSIONCONFIG']._serialized_start=21050 - _globals['_SESSIONCONFIG']._serialized_end=21596 - _globals['_TRANSCRIPTLINE']._serialized_start=21599 - _globals['_TRANSCRIPTLINE']._serialized_end=21828 - _globals['_STATUSREPLY']._serialized_start=21831 - _globals['_STATUSREPLY']._serialized_end=22009 - _globals['_CONFIGUREREQUEST']._serialized_start=22011 - _globals['_CONFIGUREREQUEST']._serialized_end=22086 - _globals['_STATUSREQUEST']._serialized_start=22088 - _globals['_STATUSREQUEST']._serialized_end=22103 - _globals['_RESETREQUEST']._serialized_start=22105 - _globals['_RESETREQUEST']._serialized_end=22119 - _globals['_TRANSCRIPTREQUEST']._serialized_start=22121 - _globals['_TRANSCRIPTREQUEST']._serialized_end=22140 - _globals['_WATCHTRANSCRIPTREQUEST']._serialized_start=22142 - _globals['_WATCHTRANSCRIPTREQUEST']._serialized_end=22166 - _globals['_IMPOSTER']._serialized_start=22690 - _globals['_IMPOSTER']._serialized_end=23190 + _globals['_CONNECTIONSTART']._serialized_end=1897 + _globals['_CONNECTIONSTARTSELECTOR']._serialized_start=1900 + _globals['_CONNECTIONSTARTSELECTOR']._serialized_end=2258 + _globals['_CONNECTIONSTARTPATTERN']._serialized_start=2261 + _globals['_CONNECTIONSTARTPATTERN']._serialized_end=2618 + _globals['_CONNECTIONSTARTOK']._serialized_start=2621 + _globals['_CONNECTIONSTARTOK']._serialized_end=2784 + _globals['_CONNECTIONSTARTOKSELECTOR']._serialized_start=2786 + _globals['_CONNECTIONSTARTOKSELECTOR']._serialized_end=2895 + _globals['_CONNECTIONSTARTOKPATTERN']._serialized_start=2898 + _globals['_CONNECTIONSTARTOKPATTERN']._serialized_end=3121 + _globals['_CONNECTIONTUNE']._serialized_start=3123 + _globals['_CONNECTIONTUNE']._serialized_end=3198 + _globals['_CONNECTIONTUNESELECTOR']._serialized_start=3201 + _globals['_CONNECTIONTUNESELECTOR']._serialized_end=3343 + _globals['_CONNECTIONTUNEPATTERN']._serialized_start=3346 + _globals['_CONNECTIONTUNEPATTERN']._serialized_end=3487 + _globals['_CONNECTIONTUNEOK']._serialized_start=3489 + _globals['_CONNECTIONTUNEOK']._serialized_end=3566 + _globals['_CONNECTIONTUNEOKSELECTOR']._serialized_start=3569 + _globals['_CONNECTIONTUNEOKSELECTOR']._serialized_end=3713 + _globals['_CONNECTIONTUNEOKPATTERN']._serialized_start=3716 + _globals['_CONNECTIONTUNEOKPATTERN']._serialized_end=3859 + _globals['_CONNECTIONOPEN']._serialized_start=3861 + _globals['_CONNECTIONOPEN']._serialized_end=3892 + _globals['_CONNECTIONOPENSELECTOR']._serialized_start=3894 + _globals['_CONNECTIONOPENSELECTOR']._serialized_end=3924 + _globals['_CONNECTIONOPENPATTERN']._serialized_start=3926 + _globals['_CONNECTIONOPENPATTERN']._serialized_end=3979 + _globals['_CONNECTIONOPENOK']._serialized_start=3981 + _globals['_CONNECTIONOPENOK']._serialized_end=3999 + _globals['_CONNECTIONOPENOKSELECTOR']._serialized_start=4001 + _globals['_CONNECTIONOPENOKSELECTOR']._serialized_end=4027 + _globals['_CONNECTIONOPENOKPATTERN']._serialized_start=4029 + _globals['_CONNECTIONOPENOKPATTERN']._serialized_end=4054 + _globals['_CONNECTIONCLOSE']._serialized_start=4056 + _globals['_CONNECTIONCLOSE']._serialized_end=4150 + _globals['_CONNECTIONCLOSESELECTOR']._serialized_start=4153 + _globals['_CONNECTIONCLOSESELECTOR']._serialized_end=4332 + _globals['_CONNECTIONCLOSEPATTERN']._serialized_start=4335 + _globals['_CONNECTIONCLOSEPATTERN']._serialized_end=4513 + _globals['_CONNECTIONCLOSEOK']._serialized_start=4515 + _globals['_CONNECTIONCLOSEOK']._serialized_end=4534 + _globals['_CONNECTIONCLOSEOKSELECTOR']._serialized_start=4536 + _globals['_CONNECTIONCLOSEOKSELECTOR']._serialized_end=4563 + _globals['_CONNECTIONCLOSEOKPATTERN']._serialized_start=4565 + _globals['_CONNECTIONCLOSEOKPATTERN']._serialized_end=4591 + _globals['_CHANNELOPEN']._serialized_start=4593 + _globals['_CHANNELOPEN']._serialized_end=4606 + _globals['_CHANNELOPENSELECTOR']._serialized_start=4608 + _globals['_CHANNELOPENSELECTOR']._serialized_end=4629 + _globals['_CHANNELOPENPATTERN']._serialized_start=4631 + _globals['_CHANNELOPENPATTERN']._serialized_end=4651 + _globals['_CHANNELOPENOK']._serialized_start=4653 + _globals['_CHANNELOPENOK']._serialized_end=4668 + _globals['_CHANNELOPENOKSELECTOR']._serialized_start=4670 + _globals['_CHANNELOPENOKSELECTOR']._serialized_end=4693 + _globals['_CHANNELOPENOKPATTERN']._serialized_start=4695 + _globals['_CHANNELOPENOKPATTERN']._serialized_end=4717 + _globals['_CHANNELCLOSE']._serialized_start=4719 + _globals['_CHANNELCLOSE']._serialized_end=4810 + _globals['_CHANNELCLOSESELECTOR']._serialized_start=4813 + _globals['_CHANNELCLOSESELECTOR']._serialized_end=4989 + _globals['_CHANNELCLOSEPATTERN']._serialized_start=4992 + _globals['_CHANNELCLOSEPATTERN']._serialized_end=5167 + _globals['_CHANNELCLOSEOK']._serialized_start=5169 + _globals['_CHANNELCLOSEOK']._serialized_end=5185 + _globals['_CHANNELCLOSEOKSELECTOR']._serialized_start=5187 + _globals['_CHANNELCLOSEOKSELECTOR']._serialized_end=5211 + _globals['_CHANNELCLOSEOKPATTERN']._serialized_start=5213 + _globals['_CHANNELCLOSEOKPATTERN']._serialized_end=5236 + _globals['_CONFIRMSELECT']._serialized_start=5238 + _globals['_CONFIRMSELECT']._serialized_end=5270 + _globals['_CONFIRMSELECTSELECTOR']._serialized_start=5272 + _globals['_CONFIRMSELECTSELECTOR']._serialized_end=5301 + _globals['_CONFIRMSELECTPATTERN']._serialized_start=5303 + _globals['_CONFIRMSELECTPATTERN']._serialized_end=5359 + _globals['_CONFIRMSELECTOK']._serialized_start=5361 + _globals['_CONFIRMSELECTOK']._serialized_end=5378 + _globals['_CONFIRMSELECTOKSELECTOR']._serialized_start=5380 + _globals['_CONFIRMSELECTOKSELECTOR']._serialized_end=5405 + _globals['_CONFIRMSELECTOKPATTERN']._serialized_start=5407 + _globals['_CONFIRMSELECTOKPATTERN']._serialized_end=5431 + _globals['_EXCHANGEDECLARE']._serialized_start=5434 + _globals['_EXCHANGEDECLARE']._serialized_end=5657 + _globals['_EXCHANGEDECLARESELECTOR']._serialized_start=5659 + _globals['_EXCHANGEDECLARESELECTOR']._serialized_end=5726 + _globals['_EXCHANGEDECLAREPATTERN']._serialized_start=5729 + _globals['_EXCHANGEDECLAREPATTERN']._serialized_end=6090 + _globals['_EXCHANGEDECLAREOK']._serialized_start=6092 + _globals['_EXCHANGEDECLAREOK']._serialized_end=6111 + _globals['_EXCHANGEDECLAREOKSELECTOR']._serialized_start=6113 + _globals['_EXCHANGEDECLAREOKSELECTOR']._serialized_end=6140 + _globals['_EXCHANGEDECLAREOKPATTERN']._serialized_start=6142 + _globals['_EXCHANGEDECLAREOKPATTERN']._serialized_end=6168 + _globals['_EXCHANGEBIND']._serialized_start=6171 + _globals['_EXCHANGEBIND']._serialized_end=6335 + _globals['_EXCHANGEBINDSELECTOR']._serialized_start=6337 + _globals['_EXCHANGEBINDSELECTOR']._serialized_end=6365 + _globals['_EXCHANGEBINDPATTERN']._serialized_start=6368 + _globals['_EXCHANGEBINDPATTERN']._serialized_end=6614 + _globals['_EXCHANGEBINDOK']._serialized_start=6616 + _globals['_EXCHANGEBINDOK']._serialized_end=6632 + _globals['_EXCHANGEBINDOKSELECTOR']._serialized_start=6634 + _globals['_EXCHANGEBINDOKSELECTOR']._serialized_end=6658 + _globals['_EXCHANGEBINDOKPATTERN']._serialized_start=6660 + _globals['_EXCHANGEBINDOKPATTERN']._serialized_end=6683 + _globals['_QUEUEDECLARE']._serialized_start=6686 + _globals['_QUEUEDECLARE']._serialized_end=6881 + _globals['_QUEUEDECLARESELECTOR']._serialized_start=6883 + _globals['_QUEUEDECLARESELECTOR']._serialized_end=6911 + _globals['_QUEUEDECLAREPATTERN']._serialized_start=6914 + _globals['_QUEUEDECLAREPATTERN']._serialized_end=7222 + _globals['_QUEUEDECLAREOK']._serialized_start=7224 + _globals['_QUEUEDECLAREOK']._serialized_end=7302 + _globals['_QUEUEDECLAREOKSELECTOR']._serialized_start=7304 + _globals['_QUEUEDECLAREOKSELECTOR']._serialized_end=7334 + _globals['_QUEUEDECLAREOKPATTERN']._serialized_start=7337 + _globals['_QUEUEDECLAREOKPATTERN']._serialized_end=7484 + _globals['_QUEUEBIND']._serialized_start=7487 + _globals['_QUEUEBIND']._serialized_end=7644 + _globals['_QUEUEBINDSELECTOR']._serialized_start=7646 + _globals['_QUEUEBINDSELECTOR']._serialized_end=7671 + _globals['_QUEUEBINDPATTERN']._serialized_start=7674 + _globals['_QUEUEBINDPATTERN']._serialized_end=7909 + _globals['_QUEUEBINDOK']._serialized_start=7911 + _globals['_QUEUEBINDOK']._serialized_end=7924 + _globals['_QUEUEBINDOKSELECTOR']._serialized_start=7926 + _globals['_QUEUEBINDOKSELECTOR']._serialized_end=7947 + _globals['_QUEUEBINDOKPATTERN']._serialized_start=7949 + _globals['_QUEUEBINDOKPATTERN']._serialized_end=7969 + _globals['_BASICQOS']._serialized_start=7971 + _globals['_BASICQOS']._serialized_end=8048 + _globals['_BASICQOSSELECTOR']._serialized_start=8050 + _globals['_BASICQOSSELECTOR']._serialized_end=8074 + _globals['_BASICQOSPATTERN']._serialized_start=8077 + _globals['_BASICQOSPATTERN']._serialized_end=8228 + _globals['_BASICQOSOK']._serialized_start=8230 + _globals['_BASICQOSOK']._serialized_end=8242 + _globals['_BASICQOSOKSELECTOR']._serialized_start=8244 + _globals['_BASICQOSOKSELECTOR']._serialized_end=8264 + _globals['_BASICQOSOKPATTERN']._serialized_start=8266 + _globals['_BASICQOSOKPATTERN']._serialized_end=8285 + _globals['_BASICCONSUME']._serialized_start=8288 + _globals['_BASICCONSUME']._serialized_end=8484 + _globals['_BASICCONSUMESELECTOR']._serialized_start=8486 + _globals['_BASICCONSUMESELECTOR']._serialized_end=8514 + _globals['_BASICCONSUMEPATTERN']._serialized_start=8517 + _globals['_BASICCONSUMEPATTERN']._serialized_end=8827 + _globals['_BASICCONSUMEOK']._serialized_start=8829 + _globals['_BASICCONSUMEOK']._serialized_end=8867 + _globals['_BASICCONSUMEOKSELECTOR']._serialized_start=8869 + _globals['_BASICCONSUMEOKSELECTOR']._serialized_end=8899 + _globals['_BASICCONSUMEOKPATTERN']._serialized_start=8901 + _globals['_BASICCONSUMEOKPATTERN']._serialized_end=8968 + _globals['_BASICCANCEL']._serialized_start=8970 + _globals['_BASICCANCEL']._serialized_end=9022 + _globals['_BASICCANCELSELECTOR']._serialized_start=9024 + _globals['_BASICCANCELSELECTOR']._serialized_end=9095 + _globals['_BASICCANCELPATTERN']._serialized_start=9097 + _globals['_BASICCANCELPATTERN']._serialized_end=9195 + _globals['_BASICCANCELOK']._serialized_start=9197 + _globals['_BASICCANCELOK']._serialized_end=9234 + _globals['_BASICCANCELOKSELECTOR']._serialized_start=9236 + _globals['_BASICCANCELOKSELECTOR']._serialized_end=9303 + _globals['_BASICCANCELOKPATTERN']._serialized_start=9305 + _globals['_BASICCANCELOKPATTERN']._serialized_end=9371 + _globals['_BASICPUBLISH']._serialized_start=9374 + _globals['_BASICPUBLISH']._serialized_end=9564 + _globals['_BASICPUBLISHSELECTOR']._serialized_start=9566 + _globals['_BASICPUBLISHSELECTOR']._serialized_end=9594 + _globals['_BASICPUBLISHPATTERN']._serialized_start=9597 + _globals['_BASICPUBLISHPATTERN']._serialized_end=9885 + _globals['_BASICRETURN']._serialized_start=9888 + _globals['_BASICRETURN']._serialized_end=10079 + _globals['_BASICRETURNSELECTOR']._serialized_start=10082 + _globals['_BASICRETURNSELECTOR']._serialized_end=10239 + _globals['_BASICRETURNPATTERN']._serialized_start=10242 + _globals['_BASICRETURNPATTERN']._serialized_end=10533 + _globals['_BASICACK']._serialized_start=10535 + _globals['_BASICACK']._serialized_end=10585 + _globals['_BASICACKSELECTOR']._serialized_start=10587 + _globals['_BASICACKSELECTOR']._serialized_end=10655 + _globals['_BASICACKPATTERN']._serialized_start=10657 + _globals['_BASICACKPATTERN']._serialized_end=10754 + _globals['_BASICNACK']._serialized_start=10756 + _globals['_BASICNACK']._serialized_end=10824 + _globals['_BASICNACKSELECTOR']._serialized_start=10826 + _globals['_BASICNACKSELECTOR']._serialized_end=10901 + _globals['_BASICNACKPATTERN']._serialized_start=10904 + _globals['_BASICNACKPATTERN']._serialized_end=11036 + _globals['_BASICREJECT']._serialized_start=11038 + _globals['_BASICREJECT']._serialized_end=11090 + _globals['_BASICREJECTSELECTOR']._serialized_start=11092 + _globals['_BASICREJECTSELECTOR']._serialized_end=11163 + _globals['_BASICREJECTPATTERN']._serialized_start=11165 + _globals['_BASICREJECTPATTERN']._serialized_end=11263 + _globals['_BASICDELIVER']._serialized_start=11266 + _globals['_BASICDELIVER']._serialized_end=11483 + _globals['_BASICDELIVERSELECTOR']._serialized_start=11485 + _globals['_BASICDELIVERSELECTOR']._serialized_end=11601 + _globals['_BASICDELIVERPATTERN']._serialized_start=11604 + _globals['_BASICDELIVERPATTERN']._serialized_end=11946 + _globals['_BASICGET']._serialized_start=11948 + _globals['_BASICGET']._serialized_end=11989 + _globals['_BASICGETSELECTOR']._serialized_start=11991 + _globals['_BASICGETSELECTOR']._serialized_end=12021 + _globals['_BASICGETPATTERN']._serialized_start=12023 + _globals['_BASICGETPATTERN']._serialized_end=12102 + _globals['_BASICGETOK']._serialized_start=12105 + _globals['_BASICGETOK']._serialized_end=12321 + _globals['_BASICGETOKSELECTOR']._serialized_start=12323 + _globals['_BASICGETOKSELECTOR']._serialized_end=12393 + _globals['_BASICGETOKPATTERN']._serialized_start=12396 + _globals['_BASICGETOKPATTERN']._serialized_end=12738 + _globals['_BASICGETEMPTY']._serialized_start=12740 + _globals['_BASICGETEMPTY']._serialized_end=12755 + _globals['_BASICGETEMPTYSELECTOR']._serialized_start=12757 + _globals['_BASICGETEMPTYSELECTOR']._serialized_end=12780 + _globals['_BASICGETEMPTYPATTERN']._serialized_start=12782 + _globals['_BASICGETEMPTYPATTERN']._serialized_end=12804 + _globals['_METHOD']._serialized_start=12807 + _globals['_METHOD']._serialized_end=15292 + _globals['_SELECTOR']._serialized_start=15295 + _globals['_SELECTOR']._serialized_end=18080 + _globals['_PATTERN']._serialized_start=18083 + _globals['_PATTERN']._serialized_end=20830 + _globals['_WEIGHTED']._serialized_start=20832 + _globals['_WEIGHTED']._serialized_end=20928 + _globals['_SCRIPTED']._serialized_start=20931 + _globals['_SCRIPTED']._serialized_end=21109 + _globals['_SESSIONCONFIG']._serialized_start=21112 + _globals['_SESSIONCONFIG']._serialized_end=21658 + _globals['_TRANSCRIPTLINE']._serialized_start=21661 + _globals['_TRANSCRIPTLINE']._serialized_end=21890 + _globals['_STATUSREPLY']._serialized_start=21893 + _globals['_STATUSREPLY']._serialized_end=22071 + _globals['_CONFIGUREREQUEST']._serialized_start=22073 + _globals['_CONFIGUREREQUEST']._serialized_end=22148 + _globals['_STATUSREQUEST']._serialized_start=22150 + _globals['_STATUSREQUEST']._serialized_end=22165 + _globals['_RESETREQUEST']._serialized_start=22167 + _globals['_RESETREQUEST']._serialized_end=22181 + _globals['_TRANSCRIPTREQUEST']._serialized_start=22183 + _globals['_TRANSCRIPTREQUEST']._serialized_end=22202 + _globals['_WATCHTRANSCRIPTREQUEST']._serialized_start=22204 + _globals['_WATCHTRANSCRIPTREQUEST']._serialized_end=22228 + _globals['_IMPOSTER']._serialized_start=22833 + _globals['_IMPOSTER']._serialized_end=23333 # @@protoc_insertion_point(module_scope) diff --git a/src/tests/amqp_imposter/amqp_imposter/control/v1/imposter_pb2.pyi b/src/tests/amqp_imposter/amqp_imposter/control/v1/imposter_pb2.pyi index 8629059a..3376e5d7 100644 --- a/src/tests/amqp_imposter/amqp_imposter/control/v1/imposter_pb2.pyi +++ b/src/tests/amqp_imposter/amqp_imposter/control/v1/imposter_pb2.pyi @@ -63,10 +63,12 @@ class _TranscriptEventEnumTypeWrapper(_enum_type_wrapper._EnumTypeWrapper[_Trans TRANSCRIPT_EVENT_IDLE_TIMEOUT: _TranscriptEvent.ValueType # 5 TRANSCRIPT_EVENT_PROTOCOL_HEADER: _TranscriptEvent.ValueType # 6 TRANSCRIPT_EVENT_FRAME_MALFORMED: _TranscriptEvent.ValueType # 7 - TRANSCRIPT_EVENT_FRAME_HEARTBEAT: _TranscriptEvent.ValueType # 8 + TRANSCRIPT_EVENT_HEARTBEAT_INGRESS: _TranscriptEvent.ValueType # 8 TRANSCRIPT_EVENT_METHOD_INGRESS: _TranscriptEvent.ValueType # 9 TRANSCRIPT_EVENT_METHOD_EGRESS: _TranscriptEvent.ValueType # 10 TRANSCRIPT_EVENT_METHOD_UNREPRESENTABLE: _TranscriptEvent.ValueType # 11 + TRANSCRIPT_EVENT_HEARTBEAT_EGRESS: _TranscriptEvent.ValueType # 12 + TRANSCRIPT_EVENT_HEARTBEAT_TIMEOUT: _TranscriptEvent.ValueType # 13 class TranscriptEvent(_TranscriptEvent, metaclass=_TranscriptEventEnumTypeWrapper): ... @@ -78,10 +80,12 @@ TRANSCRIPT_EVENT_TCP_DOWN: TranscriptEvent.ValueType # 4 TRANSCRIPT_EVENT_IDLE_TIMEOUT: TranscriptEvent.ValueType # 5 TRANSCRIPT_EVENT_PROTOCOL_HEADER: TranscriptEvent.ValueType # 6 TRANSCRIPT_EVENT_FRAME_MALFORMED: TranscriptEvent.ValueType # 7 -TRANSCRIPT_EVENT_FRAME_HEARTBEAT: TranscriptEvent.ValueType # 8 +TRANSCRIPT_EVENT_HEARTBEAT_INGRESS: TranscriptEvent.ValueType # 8 TRANSCRIPT_EVENT_METHOD_INGRESS: TranscriptEvent.ValueType # 9 TRANSCRIPT_EVENT_METHOD_EGRESS: TranscriptEvent.ValueType # 10 TRANSCRIPT_EVENT_METHOD_UNREPRESENTABLE: TranscriptEvent.ValueType # 11 +TRANSCRIPT_EVENT_HEARTBEAT_EGRESS: TranscriptEvent.ValueType # 12 +TRANSCRIPT_EVENT_HEARTBEAT_TIMEOUT: TranscriptEvent.ValueType # 13 Global___TranscriptEvent: _TypeAlias = TranscriptEvent # noqa: Y015 @_typing.final @@ -417,18 +421,15 @@ class ConnectionStart(_message.Message): VERSION_MINOR_FIELD_NUMBER: _builtins.int MECHANISMS_FIELD_NUMBER: _builtins.int LOCALES_FIELD_NUMBER: _builtins.int - PUBLISHER_CONFIRMS_FIELD_NUMBER: _builtins.int - BASIC_NACK_FIELD_NUMBER: _builtins.int - CONSUMER_CANCEL_NOTIFY_FIELD_NUMBER: _builtins.int + SERVER_PROPERTIES_FIELD_NUMBER: _builtins.int version_major: _builtins.int version_minor: _builtins.int - publisher_confirms: _builtins.bool - basic_nack: _builtins.bool - consumer_cancel_notify: _builtins.bool @_builtins.property def mechanisms(self) -> _containers.RepeatedScalarFieldContainer[_builtins.str]: ... @_builtins.property def locales(self) -> _containers.RepeatedScalarFieldContainer[_builtins.str]: ... + @_builtins.property + def server_properties(self) -> Global___AmqpTable: ... def __init__( self, *, @@ -436,15 +437,15 @@ class ConnectionStart(_message.Message): version_minor: _builtins.int = ..., mechanisms: _abc.Iterable[_builtins.str] | None = ..., locales: _abc.Iterable[_builtins.str] | None = ..., - publisher_confirms: _builtins.bool = ..., - basic_nack: _builtins.bool = ..., - consumer_cancel_notify: _builtins.bool = ..., + server_properties: Global___AmqpTable | None = ..., ) -> None: ... - _HasFieldArgType: _TypeAlias = _Never # noqa: Y015 + _HasFieldArgType: _TypeAlias = _typing.Literal["_server_properties", b"_server_properties", "server_properties", b"server_properties"] # noqa: Y015 def HasField(self, field_name: _HasFieldArgType) -> _builtins.bool: ... - _ClearFieldArgType: _TypeAlias = _typing.Literal["basic_nack", b"basic_nack", "consumer_cancel_notify", b"consumer_cancel_notify", "locales", b"locales", "mechanisms", b"mechanisms", "publisher_confirms", b"publisher_confirms", "version_major", b"version_major", "version_minor", b"version_minor"] # noqa: Y015 + _ClearFieldArgType: _TypeAlias = _typing.Literal["_server_properties", b"_server_properties", "locales", b"locales", "mechanisms", b"mechanisms", "server_properties", b"server_properties", "version_major", b"version_major", "version_minor", b"version_minor"] # noqa: Y015 def ClearField(self, field_name: _ClearFieldArgType) -> None: ... - def WhichOneof(self, oneof_group: _Never) -> None: ... + _WhichOneofReturnType__server_properties: _TypeAlias = _typing.Literal["server_properties"] # noqa: Y015 + _WhichOneofArgType__server_properties: _TypeAlias = _typing.Literal["_server_properties", b"_server_properties"] # noqa: Y015 + def WhichOneof(self, oneof_group: _WhichOneofArgType__server_properties) -> _WhichOneofReturnType__server_properties | None: ... Global___ConnectionStart: _TypeAlias = ConnectionStart # noqa: Y015 @@ -456,18 +457,15 @@ class ConnectionStartSelector(_message.Message): VERSION_MINOR_FIELD_NUMBER: _builtins.int MECHANISMS_FIELD_NUMBER: _builtins.int LOCALES_FIELD_NUMBER: _builtins.int - PUBLISHER_CONFIRMS_FIELD_NUMBER: _builtins.int - BASIC_NACK_FIELD_NUMBER: _builtins.int - CONSUMER_CANCEL_NOTIFY_FIELD_NUMBER: _builtins.int + SERVER_PROPERTIES_FIELD_NUMBER: _builtins.int version_major: _builtins.int version_minor: _builtins.int - publisher_confirms: _builtins.bool - basic_nack: _builtins.bool - consumer_cancel_notify: _builtins.bool @_builtins.property def mechanisms(self) -> Global___StringList: ... @_builtins.property def locales(self) -> Global___StringList: ... + @_builtins.property + def server_properties(self) -> Global___AmqpTable: ... def __init__( self, *, @@ -475,38 +473,28 @@ class ConnectionStartSelector(_message.Message): version_minor: _builtins.int | None = ..., mechanisms: Global___StringList | None = ..., locales: Global___StringList | None = ..., - publisher_confirms: _builtins.bool | None = ..., - basic_nack: _builtins.bool | None = ..., - consumer_cancel_notify: _builtins.bool | None = ..., + server_properties: Global___AmqpTable | None = ..., ) -> None: ... - _HasFieldArgType: _TypeAlias = _typing.Literal["_basic_nack", b"_basic_nack", "_consumer_cancel_notify", b"_consumer_cancel_notify", "_locales", b"_locales", "_mechanisms", b"_mechanisms", "_publisher_confirms", b"_publisher_confirms", "_version_major", b"_version_major", "_version_minor", b"_version_minor", "basic_nack", b"basic_nack", "consumer_cancel_notify", b"consumer_cancel_notify", "locales", b"locales", "mechanisms", b"mechanisms", "publisher_confirms", b"publisher_confirms", "version_major", b"version_major", "version_minor", b"version_minor"] # noqa: Y015 + _HasFieldArgType: _TypeAlias = _typing.Literal["_locales", b"_locales", "_mechanisms", b"_mechanisms", "_server_properties", b"_server_properties", "_version_major", b"_version_major", "_version_minor", b"_version_minor", "locales", b"locales", "mechanisms", b"mechanisms", "server_properties", b"server_properties", "version_major", b"version_major", "version_minor", b"version_minor"] # noqa: Y015 def HasField(self, field_name: _HasFieldArgType) -> _builtins.bool: ... - _ClearFieldArgType: _TypeAlias = _typing.Literal["_basic_nack", b"_basic_nack", "_consumer_cancel_notify", b"_consumer_cancel_notify", "_locales", b"_locales", "_mechanisms", b"_mechanisms", "_publisher_confirms", b"_publisher_confirms", "_version_major", b"_version_major", "_version_minor", b"_version_minor", "basic_nack", b"basic_nack", "consumer_cancel_notify", b"consumer_cancel_notify", "locales", b"locales", "mechanisms", b"mechanisms", "publisher_confirms", b"publisher_confirms", "version_major", b"version_major", "version_minor", b"version_minor"] # noqa: Y015 + _ClearFieldArgType: _TypeAlias = _typing.Literal["_locales", b"_locales", "_mechanisms", b"_mechanisms", "_server_properties", b"_server_properties", "_version_major", b"_version_major", "_version_minor", b"_version_minor", "locales", b"locales", "mechanisms", b"mechanisms", "server_properties", b"server_properties", "version_major", b"version_major", "version_minor", b"version_minor"] # noqa: Y015 def ClearField(self, field_name: _ClearFieldArgType) -> None: ... - _WhichOneofReturnType__basic_nack: _TypeAlias = _typing.Literal["basic_nack"] # noqa: Y015 - _WhichOneofArgType__basic_nack: _TypeAlias = _typing.Literal["_basic_nack", b"_basic_nack"] # noqa: Y015 - _WhichOneofReturnType__consumer_cancel_notify: _TypeAlias = _typing.Literal["consumer_cancel_notify"] # noqa: Y015 - _WhichOneofArgType__consumer_cancel_notify: _TypeAlias = _typing.Literal["_consumer_cancel_notify", b"_consumer_cancel_notify"] # noqa: Y015 _WhichOneofReturnType__locales: _TypeAlias = _typing.Literal["locales"] # noqa: Y015 _WhichOneofArgType__locales: _TypeAlias = _typing.Literal["_locales", b"_locales"] # noqa: Y015 _WhichOneofReturnType__mechanisms: _TypeAlias = _typing.Literal["mechanisms"] # noqa: Y015 _WhichOneofArgType__mechanisms: _TypeAlias = _typing.Literal["_mechanisms", b"_mechanisms"] # noqa: Y015 - _WhichOneofReturnType__publisher_confirms: _TypeAlias = _typing.Literal["publisher_confirms"] # noqa: Y015 - _WhichOneofArgType__publisher_confirms: _TypeAlias = _typing.Literal["_publisher_confirms", b"_publisher_confirms"] # noqa: Y015 + _WhichOneofReturnType__server_properties: _TypeAlias = _typing.Literal["server_properties"] # noqa: Y015 + _WhichOneofArgType__server_properties: _TypeAlias = _typing.Literal["_server_properties", b"_server_properties"] # noqa: Y015 _WhichOneofReturnType__version_major: _TypeAlias = _typing.Literal["version_major"] # noqa: Y015 _WhichOneofArgType__version_major: _TypeAlias = _typing.Literal["_version_major", b"_version_major"] # noqa: Y015 _WhichOneofReturnType__version_minor: _TypeAlias = _typing.Literal["version_minor"] # noqa: Y015 _WhichOneofArgType__version_minor: _TypeAlias = _typing.Literal["_version_minor", b"_version_minor"] # noqa: Y015 @_typing.overload - def WhichOneof(self, oneof_group: _WhichOneofArgType__basic_nack) -> _WhichOneofReturnType__basic_nack | None: ... - @_typing.overload - def WhichOneof(self, oneof_group: _WhichOneofArgType__consumer_cancel_notify) -> _WhichOneofReturnType__consumer_cancel_notify | None: ... - @_typing.overload def WhichOneof(self, oneof_group: _WhichOneofArgType__locales) -> _WhichOneofReturnType__locales | None: ... @_typing.overload def WhichOneof(self, oneof_group: _WhichOneofArgType__mechanisms) -> _WhichOneofReturnType__mechanisms | None: ... @_typing.overload - def WhichOneof(self, oneof_group: _WhichOneofArgType__publisher_confirms) -> _WhichOneofReturnType__publisher_confirms | None: ... + def WhichOneof(self, oneof_group: _WhichOneofArgType__server_properties) -> _WhichOneofReturnType__server_properties | None: ... @_typing.overload def WhichOneof(self, oneof_group: _WhichOneofArgType__version_major) -> _WhichOneofReturnType__version_major | None: ... @_typing.overload @@ -522,18 +510,15 @@ class ConnectionStartPattern(_message.Message): VERSION_MINOR_FIELD_NUMBER: _builtins.int MECHANISMS_FIELD_NUMBER: _builtins.int LOCALES_FIELD_NUMBER: _builtins.int - PUBLISHER_CONFIRMS_FIELD_NUMBER: _builtins.int - BASIC_NACK_FIELD_NUMBER: _builtins.int - CONSUMER_CANCEL_NOTIFY_FIELD_NUMBER: _builtins.int + SERVER_PROPERTIES_FIELD_NUMBER: _builtins.int version_major: _builtins.int version_minor: _builtins.int - publisher_confirms: _builtins.bool - basic_nack: _builtins.bool - consumer_cancel_notify: _builtins.bool @_builtins.property def mechanisms(self) -> Global___StringList: ... @_builtins.property def locales(self) -> Global___StringList: ... + @_builtins.property + def server_properties(self) -> Global___AmqpTable: ... def __init__( self, *, @@ -541,38 +526,28 @@ class ConnectionStartPattern(_message.Message): version_minor: _builtins.int | None = ..., mechanisms: Global___StringList | None = ..., locales: Global___StringList | None = ..., - publisher_confirms: _builtins.bool | None = ..., - basic_nack: _builtins.bool | None = ..., - consumer_cancel_notify: _builtins.bool | None = ..., + server_properties: Global___AmqpTable | None = ..., ) -> None: ... - _HasFieldArgType: _TypeAlias = _typing.Literal["_basic_nack", b"_basic_nack", "_consumer_cancel_notify", b"_consumer_cancel_notify", "_locales", b"_locales", "_mechanisms", b"_mechanisms", "_publisher_confirms", b"_publisher_confirms", "_version_major", b"_version_major", "_version_minor", b"_version_minor", "basic_nack", b"basic_nack", "consumer_cancel_notify", b"consumer_cancel_notify", "locales", b"locales", "mechanisms", b"mechanisms", "publisher_confirms", b"publisher_confirms", "version_major", b"version_major", "version_minor", b"version_minor"] # noqa: Y015 + _HasFieldArgType: _TypeAlias = _typing.Literal["_locales", b"_locales", "_mechanisms", b"_mechanisms", "_server_properties", b"_server_properties", "_version_major", b"_version_major", "_version_minor", b"_version_minor", "locales", b"locales", "mechanisms", b"mechanisms", "server_properties", b"server_properties", "version_major", b"version_major", "version_minor", b"version_minor"] # noqa: Y015 def HasField(self, field_name: _HasFieldArgType) -> _builtins.bool: ... - _ClearFieldArgType: _TypeAlias = _typing.Literal["_basic_nack", b"_basic_nack", "_consumer_cancel_notify", b"_consumer_cancel_notify", "_locales", b"_locales", "_mechanisms", b"_mechanisms", "_publisher_confirms", b"_publisher_confirms", "_version_major", b"_version_major", "_version_minor", b"_version_minor", "basic_nack", b"basic_nack", "consumer_cancel_notify", b"consumer_cancel_notify", "locales", b"locales", "mechanisms", b"mechanisms", "publisher_confirms", b"publisher_confirms", "version_major", b"version_major", "version_minor", b"version_minor"] # noqa: Y015 + _ClearFieldArgType: _TypeAlias = _typing.Literal["_locales", b"_locales", "_mechanisms", b"_mechanisms", "_server_properties", b"_server_properties", "_version_major", b"_version_major", "_version_minor", b"_version_minor", "locales", b"locales", "mechanisms", b"mechanisms", "server_properties", b"server_properties", "version_major", b"version_major", "version_minor", b"version_minor"] # noqa: Y015 def ClearField(self, field_name: _ClearFieldArgType) -> None: ... - _WhichOneofReturnType__basic_nack: _TypeAlias = _typing.Literal["basic_nack"] # noqa: Y015 - _WhichOneofArgType__basic_nack: _TypeAlias = _typing.Literal["_basic_nack", b"_basic_nack"] # noqa: Y015 - _WhichOneofReturnType__consumer_cancel_notify: _TypeAlias = _typing.Literal["consumer_cancel_notify"] # noqa: Y015 - _WhichOneofArgType__consumer_cancel_notify: _TypeAlias = _typing.Literal["_consumer_cancel_notify", b"_consumer_cancel_notify"] # noqa: Y015 _WhichOneofReturnType__locales: _TypeAlias = _typing.Literal["locales"] # noqa: Y015 _WhichOneofArgType__locales: _TypeAlias = _typing.Literal["_locales", b"_locales"] # noqa: Y015 _WhichOneofReturnType__mechanisms: _TypeAlias = _typing.Literal["mechanisms"] # noqa: Y015 _WhichOneofArgType__mechanisms: _TypeAlias = _typing.Literal["_mechanisms", b"_mechanisms"] # noqa: Y015 - _WhichOneofReturnType__publisher_confirms: _TypeAlias = _typing.Literal["publisher_confirms"] # noqa: Y015 - _WhichOneofArgType__publisher_confirms: _TypeAlias = _typing.Literal["_publisher_confirms", b"_publisher_confirms"] # noqa: Y015 + _WhichOneofReturnType__server_properties: _TypeAlias = _typing.Literal["server_properties"] # noqa: Y015 + _WhichOneofArgType__server_properties: _TypeAlias = _typing.Literal["_server_properties", b"_server_properties"] # noqa: Y015 _WhichOneofReturnType__version_major: _TypeAlias = _typing.Literal["version_major"] # noqa: Y015 _WhichOneofArgType__version_major: _TypeAlias = _typing.Literal["_version_major", b"_version_major"] # noqa: Y015 _WhichOneofReturnType__version_minor: _TypeAlias = _typing.Literal["version_minor"] # noqa: Y015 _WhichOneofArgType__version_minor: _TypeAlias = _typing.Literal["_version_minor", b"_version_minor"] # noqa: Y015 @_typing.overload - def WhichOneof(self, oneof_group: _WhichOneofArgType__basic_nack) -> _WhichOneofReturnType__basic_nack | None: ... - @_typing.overload - def WhichOneof(self, oneof_group: _WhichOneofArgType__consumer_cancel_notify) -> _WhichOneofReturnType__consumer_cancel_notify | None: ... - @_typing.overload def WhichOneof(self, oneof_group: _WhichOneofArgType__locales) -> _WhichOneofReturnType__locales | None: ... @_typing.overload def WhichOneof(self, oneof_group: _WhichOneofArgType__mechanisms) -> _WhichOneofReturnType__mechanisms | None: ... @_typing.overload - def WhichOneof(self, oneof_group: _WhichOneofArgType__publisher_confirms) -> _WhichOneofReturnType__publisher_confirms | None: ... + def WhichOneof(self, oneof_group: _WhichOneofArgType__server_properties) -> _WhichOneofReturnType__server_properties | None: ... @_typing.overload def WhichOneof(self, oneof_group: _WhichOneofArgType__version_major) -> _WhichOneofReturnType__version_major | None: ... @_typing.overload @@ -587,21 +562,27 @@ class ConnectionStartOk(_message.Message): MECHANISM_FIELD_NUMBER: _builtins.int LOCALE_FIELD_NUMBER: _builtins.int RESPONSE_FIELD_NUMBER: _builtins.int + CLIENT_PROPERTIES_FIELD_NUMBER: _builtins.int mechanism: _builtins.str locale: _builtins.str response: _builtins.str + @_builtins.property + def client_properties(self) -> Global___AmqpTable: ... def __init__( self, *, mechanism: _builtins.str = ..., locale: _builtins.str = ..., response: _builtins.str = ..., + client_properties: Global___AmqpTable | None = ..., ) -> None: ... - _HasFieldArgType: _TypeAlias = _Never # noqa: Y015 + _HasFieldArgType: _TypeAlias = _typing.Literal["_client_properties", b"_client_properties", "client_properties", b"client_properties"] # noqa: Y015 def HasField(self, field_name: _HasFieldArgType) -> _builtins.bool: ... - _ClearFieldArgType: _TypeAlias = _typing.Literal["locale", b"locale", "mechanism", b"mechanism", "response", b"response"] # noqa: Y015 + _ClearFieldArgType: _TypeAlias = _typing.Literal["_client_properties", b"_client_properties", "client_properties", b"client_properties", "locale", b"locale", "mechanism", b"mechanism", "response", b"response"] # noqa: Y015 def ClearField(self, field_name: _ClearFieldArgType) -> None: ... - def WhichOneof(self, oneof_group: _Never) -> None: ... + _WhichOneofReturnType__client_properties: _TypeAlias = _typing.Literal["client_properties"] # noqa: Y015 + _WhichOneofArgType__client_properties: _TypeAlias = _typing.Literal["_client_properties", b"_client_properties"] # noqa: Y015 + def WhichOneof(self, oneof_group: _WhichOneofArgType__client_properties) -> _WhichOneofReturnType__client_properties | None: ... Global___ConnectionStartOk: _TypeAlias = ConnectionStartOk # noqa: Y015 @@ -641,20 +622,26 @@ class ConnectionStartOkPattern(_message.Message): MECHANISM_FIELD_NUMBER: _builtins.int LOCALE_FIELD_NUMBER: _builtins.int RESPONSE_FIELD_NUMBER: _builtins.int + CLIENT_PROPERTIES_FIELD_NUMBER: _builtins.int mechanism: _builtins.str locale: _builtins.str response: _builtins.str + @_builtins.property + def client_properties(self) -> Global___AmqpTable: ... def __init__( self, *, mechanism: _builtins.str | None = ..., locale: _builtins.str | None = ..., response: _builtins.str | None = ..., + client_properties: Global___AmqpTable | None = ..., ) -> None: ... - _HasFieldArgType: _TypeAlias = _typing.Literal["_locale", b"_locale", "_mechanism", b"_mechanism", "_response", b"_response", "locale", b"locale", "mechanism", b"mechanism", "response", b"response"] # noqa: Y015 + _HasFieldArgType: _TypeAlias = _typing.Literal["_client_properties", b"_client_properties", "_locale", b"_locale", "_mechanism", b"_mechanism", "_response", b"_response", "client_properties", b"client_properties", "locale", b"locale", "mechanism", b"mechanism", "response", b"response"] # noqa: Y015 def HasField(self, field_name: _HasFieldArgType) -> _builtins.bool: ... - _ClearFieldArgType: _TypeAlias = _typing.Literal["_locale", b"_locale", "_mechanism", b"_mechanism", "_response", b"_response", "locale", b"locale", "mechanism", b"mechanism", "response", b"response"] # noqa: Y015 + _ClearFieldArgType: _TypeAlias = _typing.Literal["_client_properties", b"_client_properties", "_locale", b"_locale", "_mechanism", b"_mechanism", "_response", b"_response", "client_properties", b"client_properties", "locale", b"locale", "mechanism", b"mechanism", "response", b"response"] # noqa: Y015 def ClearField(self, field_name: _ClearFieldArgType) -> None: ... + _WhichOneofReturnType__client_properties: _TypeAlias = _typing.Literal["client_properties"] # noqa: Y015 + _WhichOneofArgType__client_properties: _TypeAlias = _typing.Literal["_client_properties", b"_client_properties"] # noqa: Y015 _WhichOneofReturnType__locale: _TypeAlias = _typing.Literal["locale"] # noqa: Y015 _WhichOneofArgType__locale: _TypeAlias = _typing.Literal["_locale", b"_locale"] # noqa: Y015 _WhichOneofReturnType__mechanism: _TypeAlias = _typing.Literal["mechanism"] # noqa: Y015 @@ -662,6 +649,8 @@ class ConnectionStartOkPattern(_message.Message): _WhichOneofReturnType__response: _TypeAlias = _typing.Literal["response"] # noqa: Y015 _WhichOneofArgType__response: _TypeAlias = _typing.Literal["_response", b"_response"] # noqa: Y015 @_typing.overload + def WhichOneof(self, oneof_group: _WhichOneofArgType__client_properties) -> _WhichOneofReturnType__client_properties | None: ... + @_typing.overload def WhichOneof(self, oneof_group: _WhichOneofArgType__locale) -> _WhichOneofReturnType__locale | None: ... @_typing.overload def WhichOneof(self, oneof_group: _WhichOneofArgType__mechanism) -> _WhichOneofReturnType__mechanism | None: ... diff --git a/src/tests/amqp_imposter/amqp_imposter/model/__init__.py b/src/tests/amqp_imposter/amqp_imposter/model/__init__.py index 32c00c76..93429efb 100644 --- a/src/tests/amqp_imposter/amqp_imposter/model/__init__.py +++ b/src/tests/amqp_imposter/amqp_imposter/model/__init__.py @@ -45,7 +45,9 @@ from .model_state import Unrepresentable from .negotiation_options import ( DEFAULT_NEGOTIATION_OPTIONS, + Capabilities, NegotiationOptions, + Tunables, ) __all__ = [ @@ -58,6 +60,7 @@ "METHOD_KINDS", "STOP_WEIGHT", "Arbitrary", + "Capabilities", "Exact", "Gen", "GenState", @@ -71,6 +74,7 @@ "Sent", "Table", "TableValue", + "Tunables", "Unrepresentable", "WeightedSelector", "assert_concrete", diff --git a/src/tests/amqp_imposter/amqp_imposter/model/constants.py b/src/tests/amqp_imposter/amqp_imposter/model/constants.py index f284cb8f..ec395203 100644 --- a/src/tests/amqp_imposter/amqp_imposter/model/constants.py +++ b/src/tests/amqp_imposter/amqp_imposter/model/constants.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from .domains import Long, Octet, Short, ShortStr +from .domains import Octet, ShortStr PROTOCOL_MAJOR = Octet(0) PROTOCOL_MINOR = Octet(9) @@ -47,10 +47,4 @@ DEFAULT_MECHANISMS = ("PLAIN",) DEFAULT_LOCALES = ("en_US",) -DEFAULT_PUBLISHER_CONFIRMS = True -DEFAULT_BASIC_NACK = True -DEFAULT_CONSUMER_CANCEL_NOTIFY = True -DEFAULT_CHANNEL_MAX = Short(2047) -DEFAULT_FRAME_MAX = Long(131072) -DEFAULT_HEARTBEAT = Short(0) DEFAULT_VHOST = ShortStr("/") diff --git a/src/tests/amqp_imposter/amqp_imposter/model/docs/AMBIGUITIES.md b/src/tests/amqp_imposter/amqp_imposter/model/docs/AMBIGUITIES.md new file mode 100644 index 00000000..dca090f3 --- /dev/null +++ b/src/tests/amqp_imposter/amqp_imposter/model/docs/AMBIGUITIES.md @@ -0,0 +1,99 @@ +We err on the side of weaker rules in order to capture the whole state space. +If the spec does not specify something adequately, it may be left deliberately Unrepresentable, so that a client does not depend on it. +These interpretative judgements are listed here. + +----------- + +- "Published messages are assigned ascending sequence numbers, starting at 1 with the first Confirm.Select method." + "The server MUST acknowledge all messages received after the channel was put into confirm mode." + - Numbering starts when `confirm.select` is received; publishes that come after `confirm.select` was sent need to be confirmed. + - However the confirms are held back until `confirm.select-ok` is sent. + - This is the interpretation that makes sense, and allows consistency from the point of view of the client. + +- "The requested QoS applies to all active consumers until a new QoS is defined." + - New prefetch-count updates existing consumers. + - Takes effect after `basic.qos-ok` for consistency from the client point of view. + +- "After sending this method, any received methods except Close and Close-OK MUST be discarded." + - A client close doesn't make the server give up on any pending owed replies. + - The server orders `close-ok` after any currently pending replies. + - If a reply is an error, we get a two-way close handshake. + - Confirms, returns, deliveries can still be sent until the `close-ok`, but they don't _have_ to. + +- "Unroutable mandatory or immediate messages are acknowledged right after the Basic.Return method." + - In practice acks and nacks may come in between. + - So "right after" isn't fully followed, and we prefer to weaken the guarantee, so anything can come in between. + +- "The server could not complete the method because it lacked sufficient resources. This may be due to the client creating too many of some type of entity." + - RESOURCE_ERROR (506) is left as opt-in and not forced. + +- "The server-assigned and channel-specific delivery tag" + - `basic.get-empty` does not use up a tag. + +- "If set, the server will not respond to the method. The client should not wait for a reply method. If the server could not complete the method it will raise a channel or connection exception." + - no-wait methods and `basic.publish` don't owe replies but optional errors have to be offered for them. + - When we send something ordered after these errors we have to discard them. + - This naturally fits the weights and scripts configuration model. + +- "In methods where the queue name may be blank, and that has no specific significance, this refers to the 'current' queue for the channel, meaning the last queue that the client declared on the channel. If the client did not declare a queue, and the method needs a queue name, this will result in a 502 (syntax error) channel exception." + - `queue.bind` also has a "queue-known" rule that names NOT_FOUND (404) for the same failure, so both 404 and SYNTAX_ERROR (502) will be offered for it. + - `basic.consume` and `basic.get` have no such rule, so only 502 applies. + +- "The queue name identifies the queue within the vhost." + - A delivery with the same body or tag delivered via another queue must still be representable. + - Despite the spec "the server SHOULD deliver it to the original client if possible", another client can get a redelivery in practice. Also see below... + +- "This indicates that the message has been previously delivered to this or another client." + - A message requeued during the session is always redelivered with redelivered set, as seeing the same delivery twice is useful for testing by default. + - The downside is we can't currently represent "requeued message delivered to someone else" so this could be loosened when we come up with a good way to do this. + - In particular, we could find a way to weight arbitraries, or at least arbitraries when they concrete (to weight a known redelivery to 0). + - Every other delivery has an arbitrary redelivered flag, since it may have been delivered to another consumer. + +- "Specifies highest channel number that the server permits. Usable channel numbers are in the range 1..channel-max. Zero indicates no specified limit." + - We take "no specified limit" to mean effectively unlimited, as that is the common reading in practice. + - channel-max = 0 from the client is accepted IFF the server also offered 0. + - frame-max is treated the same way. + +- "If the client specifies a channel max that is higher than the value provided by the server, the server MUST close the connection without attempting a negotiated close. The server may report the error in some fashion to assist implementors." + - In practice `connection.close` (NOT_ALLOWED) is common, but we prefer unrepresentable here as the error is unspecified; frame-max is treated the same way. + +- "This method signals to the client that the connection is ready for use." + - A pipelined `connection.close` is answered with `connection.open-ok` and then `connection.close-ok`. + - Repeated `connection.start-ok`, `connection.tune-ok` or `connection.open`, or a `connection.close-ok` on an open connection, is unrepresentable, which in practice means the TCP socket drops; the spec does not seem to prescribe. + - Closes may be sent while `connection.open-ok` is pending. + +- "close-channel = C:CLOSE S:CLOSE-OK / S:CLOSE C:CLOSE-OK" + - After a client `channel.close` or `connection.close`, the server silently discards other methods until it sends `close-ok`, including a repeated close; none is answered or treated as CHANNEL_ERROR. The exceptions are a client `connection.close` after a client `channel.close`, which still closes the connection, and a client `close-ok`, which is unrepresentable. + +- "The server MUST deliver messages of the same priority in order irrespective of their individual persistence." + - Requeued messages can be redelivered in any order and interleaved with fresh ones. + - Priority has no effect. (Note: perhaps it could be modelled for exclusive queues?) + +- "Specifies a prefetch window in terms of whole messages. This field may be used in combination with the prefetch-size field; a message will only be sent in advance if both prefetch windows (and those at the channel and connection level) allow it. The prefetch-count is ignored if the no-ack option is set." + - Unacknowledged `get-ok`s count toward the window and can block consumer deliveries. + - Full prefetch windows will not block `basic.get`. + - no-ack consumers ignore the window. + +- "The client may receive an arbitrary number of messages in between sending the cancel method and receiving the cancel-ok reply." + - This is true until `basic.cancel-ok` is sent, or until a no-wait `basic.cancel` is received. + - As with close handshakes, the cancel handshake can be two-way. + +- "If the queue does not exist the server MUST ignore the cancel method, so long as the consumer tag is valid for that channel." + - The case of a nonexistent consumer tag seems unspecified, so it is unrepresentable (rather than an in-protocol error.) + - Any extra `basic.cancel`s pipelined before cancel-ok are also answered with `cancel-ok`s. + +- "The server MUST NOT deliver the message to the same client within the context of the current channel. The recommended strategy is to attempt to deliver the message to an alternative consumer, and if that is not possible, to move the message to a dead-letter queue. The server MAY use more sophisticated tracking to hold the message on the queue and redeliver it to the same client at a later stage." + - A requeued message may be redelivered straight away to the same consumer on the same channel, as a consumer can see duplicate deliveries. + +- "The server confirms messages by sending Basic.Ack methods referring to these sequence numbers." + - A server nack's requeue bit is arbitrary, since "Clients receiving the Nack methods should ignore this flag" -- so we allow both values. + +- "use-channel = ... / functional-class" + - Each class has its own grammar which orders replies _within_ a class. + - For simplicity, we strengthen this so that replies go out in FIFO order, regardless of class. + - This could probably be weakened. We could replace `revealing_line` with a more general form like a dependency graph in the future. + +----------- + +All quotes reference https://www.rabbitmq.com/resources/specs/amqp0-9-1.extended.xml. + diff --git a/src/tests/amqp_imposter/amqp_imposter/model/docs/ERRORS.md b/src/tests/amqp_imposter/amqp_imposter/model/docs/ERRORS.md index 5a58c673..4e31a7d9 100644 --- a/src/tests/amqp_imposter/amqp_imposter/model/docs/ERRORS.md +++ b/src/tests/amqp_imposter/amqp_imposter/model/docs/ERRORS.md @@ -54,3 +54,4 @@ There are also certain conditions on which the model will short-circuit for now Known gaps: - Passive declares with no-wait still offer errors, although the spec says they have no effect +- The current queue is not tracked, so a blank queue name in `queue.bind`, `basic.consume` or `basic.get` is accepted even if no queue was declared on the channel diff --git a/src/tests/amqp_imposter/amqp_imposter/model/docs/INTRO.md b/src/tests/amqp_imposter/amqp_imposter/model/docs/INTRO.md index 9f41c008..6249a0e0 100644 --- a/src/tests/amqp_imposter/amqp_imposter/model/docs/INTRO.md +++ b/src/tests/amqp_imposter/amqp_imposter/model/docs/INTRO.md @@ -19,4 +19,3 @@ We make some simplifications while also adhering to the spec: - Every method in send/receive is assumed to belong this channel. - Topology is volatile: declaring and binding never affect routability, and message counts are arbitrary. - Messages are produced arbitrarily. Exchange, routing key, properties and body are generated (but of course requeues and returns do match the originals). -- The server is constructed with the exact capabilities and limits it'll accept in the handshake. diff --git a/src/tests/amqp_imposter/amqp_imposter/model/docs/TOPOLOGY.md b/src/tests/amqp_imposter/amqp_imposter/model/docs/TOPOLOGY.md new file mode 100644 index 00000000..95c13867 --- /dev/null +++ b/src/tests/amqp_imposter/amqp_imposter/model/docs/TOPOLOGY.md @@ -0,0 +1,22 @@ +Everything here is downstream of topology being a shared resource. + +There is no persistent broker state; anything is fair game on a connection as long as it does not contradict the state of the interaction. +If your client declares an exchange, that does not permanently make the exchange exist inside the AMQP server you are talking to. +For example, in the imposter, publishing to an undeclared exchange will not deterministically produce a channel error and publishing to a declared one may still 404. + +In practice, vhosts are shared resources and their topologies volatile. +All those states -- existence and non-existence, changed arguments, changed message counts, etc. -- need to be represented by the model, so it does not need to track past declarations and bindings. + +Exclusive queues are still shared resources. One extra restriction applies: consumer count is derived from the actual number of consumers on this connection IF AND ONLY IF it is reported in reply to a successful, non-passive, exclusive declaration or redeclaration by our connection. + +Exclusive queues are known to the connection, so some mismatches seem possible; e.g., it seems like redeclarations of exclusive queues need to actually be resolved. +That is not actually the case because an operator can delete an exclusive queue. +So, exclusive queues behave the same as any other queue here. + +Auto-delete also seems like it has to be enforced, that is, after reconsuming we should encounter a disappeared queue. +But -- the queue name could've been declared by another connection in the meantime! +So, exclusive queues behave the same as any other queue here too. + +Known gaps: +- In exclusive queues the consumer count is arbitrary rather than the number of our consumers on the queue. +- Newly declared exclusive queues don't always report zero messages. diff --git a/src/tests/amqp_imposter/amqp_imposter/model/helpers/revealing_line.py b/src/tests/amqp_imposter/amqp_imposter/model/helpers/revealing_line.py index d9bd4ee1..f65b1229 100644 --- a/src/tests/amqp_imposter/amqp_imposter/model/helpers/revealing_line.py +++ b/src/tests/amqp_imposter/amqp_imposter/model/helpers/revealing_line.py @@ -46,6 +46,22 @@ class RevealingLine[T]: def push(self, revealed: Revealed[T]) -> RevealingLine[T]: return RevealingLine((*self.line, revealed)) + def push_coalescent( + self, item: T, coalesces_with: Callable[[T, T], bool] + ) -> RevealingLine[T]: + # drop the most recent item indicated by `coalesces_with` + # only if they're only visible when the new item is also visible + # basically -- does the new item make an existing one redundant? + for i in reversed(range(len(self.line))): + match self.line[i]: + case Opaque(): + break + case Transparent(existing) if coalesces_with(existing, item): + before, after = self.line[:i], self.line[i + 1 :] + return RevealingLine((*before, *after, Transparent(item))) + + return self.push(Transparent(item)) + def split(self, n: int | None = None) -> tuple[RevealingLine[T], RevealingLine[T]]: if n is not None: before = self.line[:n] @@ -59,21 +75,16 @@ def split(self, n: int | None = None) -> tuple[RevealingLine[T], RevealingLine[T def split_while( self, predicate: Callable[[Revealed[T]], bool] ) -> tuple[RevealingLine[T], RevealingLine[T]]: - before: list[Revealed[T]] = [] - after: list[Revealed[T]] = [] - - splitting = True - for item in self.line: - if splitting and predicate(item): - before.append(item) - else: - splitting = False - after.append(item) - - return RevealingLine(tuple(before)), RevealingLine(tuple(after)) - - def last(self) -> Revealed[T] | None: - return self.line[-1] if self.line else None + n = next( + (i for i, revealed in enumerate(self.line) if not predicate(revealed)), + len(self.line), + ) + return self.split(n) + + def filter(self, predicate: Callable[[Revealed[T]], bool]) -> RevealingLine[T]: + return RevealingLine( + tuple(revealed for revealed in self.line if predicate(revealed)) + ) def items(self) -> tuple[T, ...]: return tuple(revealed.item for revealed in self.line) diff --git a/src/tests/amqp_imposter/amqp_imposter/model/method_bag.py b/src/tests/amqp_imposter/amqp_imposter/model/method_bag.py index e7599c01..afa87e05 100644 --- a/src/tests/amqp_imposter/amqp_imposter/model/method_bag.py +++ b/src/tests/amqp_imposter/amqp_imposter/model/method_bag.py @@ -17,16 +17,11 @@ from . import method_fields as mf from . import methods as m from . import model_state as ms +from .negotiation_options import Capabilities def sendables(state: ms.ModelState) -> tuple[m.Method, ...]: match connection_state := state.connection_state: - case ms.ClosingConnectionState( - close_handshake=ms.OwingCloseOk() | ms.OwedAndOwingCloseOk() - ): - return (m.ConnectionCloseOk(),) - case ms.ClosedConnectionState() | ms.ClosingConnectionState(): # owed close-ok - return () case ms.OpenConnectionState(): return sendable_ordered_methods(state) + sendable_standby_methods( state, connection_state @@ -64,11 +59,12 @@ def expected_consumer_methods( ) -> tuple[m.Method, ...]: match state.connection_state: case ms.OpenConnectionState( + capabilities=capabilities, channel_state=ms.OpenChannelState( consumer_state=ms.ActiveConsumerState(consumer_tag=consumer_tag) - ) as channel_state + ) as channel_state, ) if consumer_tag == consume.consumer_tag: - return sendable_consumer_methods(state, channel_state) + return sendable_consumer_methods(state, capabilities, channel_state) case _: return () @@ -108,18 +104,17 @@ def sendable_standby_methods( ) -> tuple[m.Method, ...]: match channel_state := connection_state.channel_state: case ms.OpenChannelState(): - return sendable_unprompted_closes() + sendable_standby_messages( - state, channel_state + return sendable_unprompted_closes(state) + sendable_standby_messages( + state, connection_state.capabilities, channel_state ) - case ms.ClosingChannelState( - close_handshake=ms.OwingCloseOk() | ms.OwedAndOwingCloseOk() - ): - return (m.ChannelCloseOk(), *sendable_unprompted_closes()) case ms.ClosingChannelState() | ms.ClosedChannelState(): - return sendable_unprompted_closes() + return sendable_unprompted_closes(state) -def sendable_unprompted_closes() -> tuple[m.Method, ...]: +def sendable_unprompted_closes(state: ms.ModelState) -> tuple[m.Method, ...]: + if ms.has_pending_reply_to(state, m.ConnectionClose): + return () + return tuple( m.ConnectionClose( reply_code=reply_code, @@ -132,43 +127,49 @@ def sendable_unprompted_closes() -> tuple[m.Method, ...]: def sendable_standby_messages( - state: ms.ModelState, channel_state: ms.OpenChannelState + state: ms.ModelState, + capabilities: Capabilities, + channel_state: ms.OpenChannelState, ) -> tuple[m.Method, ...]: standby_publishes = channel_state.unconfirmed_states + ms.observable_publishes( state ) return ( - sendable_standby_consumer_methods(state, channel_state) + sendable_standby_consumer_methods(state, capabilities, channel_state) + sendable_returns_for(standby_publishes) - + sendable_confirms_for(standby_publishes) + + sendable_confirms_for(capabilities, standby_publishes) ) def sendable_standby_consumer_methods( - state: ms.ModelState, channel_state: ms.OpenChannelState + state: ms.ModelState, + capabilities: Capabilities, + channel_state: ms.OpenChannelState, ) -> tuple[m.Method, ...]: - if ms.has_pending_consume(state): + if ms.has_pending_reply_to(state, m.BasicConsume): return () - return sendable_consumer_methods(state, channel_state) + return sendable_consumer_methods(state, capabilities, channel_state) def sendable_consumer_methods( - state: ms.ModelState, channel_state: ms.OpenChannelState + state: ms.ModelState, + capabilities: Capabilities, + channel_state: ms.OpenChannelState, ) -> tuple[m.Method, ...]: match consumer_state := channel_state.consumer_state: case ms.ActiveConsumerState(): return sendable_consumer_cancels( - state, consumer_state + capabilities, consumer_state ) + sendable_consumer_deliveries(state, channel_state, consumer_state) case ms.CancelledConsumerState() | ms.NoConsumerState(): return () def sendable_consumer_cancels( - state: ms.ModelState, consumer_state: ms.ActiveConsumerState + capabilities: Capabilities, consumer_state: ms.ActiveConsumerState ) -> tuple[m.Method, ...]: - if not state.negotiation_options.consumer_cancel_notify: + if not capabilities.consumer_cancel_notify: return () return (m.BasicCancel(consumer_tag=consumer_state.consumer_tag, no_wait=True),) @@ -222,9 +223,12 @@ def sendable_returns_for( def sendable_confirms_for( + capabilities: Capabilities, publishes: tuple[ms.PublishState, ...], ) -> tuple[m.Method, ...]: - return sendable_ack_confirms_for(publishes) + sendable_nack_confirms_for(publishes) + return sendable_ack_confirms_for(publishes) + sendable_nack_confirms_for( + capabilities, publishes + ) def sendable_ack_confirms_for( @@ -242,8 +246,12 @@ def sendable_ack_confirms_for( def sendable_nack_confirms_for( + capabilities: Capabilities, publishes: tuple[ms.PublishState, ...], ) -> tuple[m.Method, ...]: + if not capabilities.basic_nack: + return () + returned = ms.returned_confirm_seqs(publishes) min_returned = min(returned, default=None) diff --git a/src/tests/amqp_imposter/amqp_imposter/model/method_sampling.py b/src/tests/amqp_imposter/amqp_imposter/model/method_sampling.py index df5f8e98..45122240 100644 --- a/src/tests/amqp_imposter/amqp_imposter/model/method_sampling.py +++ b/src/tests/amqp_imposter/amqp_imposter/model/method_sampling.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +from collections import defaultdict from dataclasses import dataclass from random import Random @@ -33,7 +34,7 @@ class Stop: @dataclass(frozen=True, slots=True) class MethodSampler(Gen[m.Method | Stop]): - unified_by_weighted_selector: tuple[SelectorMethods, ...] + matched_by_weighted_selector: tuple[SelectorMethods, ...] stop_weight: int def __post_init__(self) -> None: @@ -42,11 +43,11 @@ def __post_init__(self) -> None: def from_randomness(self, randomness: Random) -> m.Method | Stop: groups: tuple[tuple[m.Method | Stop, ...], ...] = ( - *(unified for _, unified in self.unified_by_weighted_selector), + *(matched for _, matched in self.matched_by_weighted_selector), (Stop(),), ) weights = ( - *(ws.weight for ws, _ in self.unified_by_weighted_selector), + *(ws.weight for ws, _ in self.matched_by_weighted_selector), self.stop_weight, ) @@ -57,21 +58,27 @@ def from_randomness(self, randomness: Random) -> m.Method | Stop: def methods_by_weighted_selector( methods: tuple[m.Method, ...], weighted_selectors: tuple[mw.WeightedSelector, ...] ) -> tuple[SelectorMethods, ...]: - unified_by_selector: list[SelectorMethods] = [] + matched_by_selector: list[SelectorMethods] = [] - remaining = methods + remaining_by_kind: defaultdict[type[m.Method], list[m.Method]] = defaultdict(list) + for method in methods: + remaining_by_kind[type(method)].append(method) for ws in weighted_selectors: # take all the methods we can match by unifying with the selector - pairs = tuple((method, mu.unify(ws.selector, method)) for method in remaining) - # partition to those that could unify and those that couldn't - unified = tuple(u for _, u in pairs if u is not None) - remaining = tuple(method for method, u in pairs if u is None) + matched: list[m.Method] = [] + unmatched: list[m.Method] = [] + for method in remaining_by_kind[type(ws.selector)]: + if mu.unifiable(ws.selector, method): + matched.append(method) + else: + unmatched.append(method) - unified_by_selector.append((ws, unified)) + remaining_by_kind[type(ws.selector)] = unmatched + matched_by_selector.append((ws, tuple(matched))) - return tuple(unified_by_selector) + return tuple(matched_by_selector) def make_sampler( @@ -85,9 +92,9 @@ def make_sampler( ) return MethodSampler( tuple( - (ws, unified) - for ws, unified in methods_by_weighted_selector(methods, effective_wss) - if ws.weight > 0 and unified + (ws, matched) + for ws, matched in methods_by_weighted_selector(methods, effective_wss) + if ws.weight > 0 and matched ), stop_weight, ) diff --git a/src/tests/amqp_imposter/amqp_imposter/model/method_scripts.py b/src/tests/amqp_imposter/amqp_imposter/model/method_scripts.py index b97c12df..2d21af8c 100644 --- a/src/tests/amqp_imposter/amqp_imposter/model/method_scripts.py +++ b/src/tests/amqp_imposter/amqp_imposter/model/method_scripts.py @@ -41,6 +41,5 @@ def match_rules( return tuple( rule for rule in script - if type(rule.when) is type(when) - and mu.unify(rule.when.method, when.method) is not None + if type(rule.when) is type(when) and mu.unifiable(rule.when.method, when.method) ) diff --git a/src/tests/amqp_imposter/amqp_imposter/model/method_unification.py b/src/tests/amqp_imposter/amqp_imposter/model/method_unification.py index 765057ad..b18553eb 100644 --- a/src/tests/amqp_imposter/amqp_imposter/model/method_unification.py +++ b/src/tests/amqp_imposter/amqp_imposter/model/method_unification.py @@ -21,30 +21,33 @@ from . import methods as m +def unifiable(method: m.Method, other: m.Method) -> bool: + return m.is_same_kind(method, other) and all( + not mf.is_concrete(value) + or not mf.is_concrete(other_value) + or value == other_value + for value, other_value in zip( + m.get_fields(method).values(), m.get_fields(other).values(), strict=True + ) + ) + + def unify[M: m.Method](method: M, other: m.Method) -> M | None: """ The unification of two methods, or None if it does not exist. If both are arbitrary, the other value is taken. """ - if not m.is_same_kind(method, other): + if not unifiable(method, other): return None - unified_fields: dict[str, Any] = {} - - method_fields = m.get_fields(method) other_fields = m.get_fields(other) - - for name, value in method_fields.items(): - other_value = other_fields[name] - - if not mf.is_concrete(value): - unified_fields[name] = other_value - elif not mf.is_concrete(other_value) or value == other_value: - unified_fields[name] = value - else: - return None - - return m.set_fields(method, unified_fields) + return m.set_fields( + method, + { + name: value if mf.is_concrete(value) else other_fields[name] + for name, value in m.get_fields(method).items() + }, + ) def unify_any[M: m.Method](method: M, others: Iterable[m.Method]) -> M | None: diff --git a/src/tests/amqp_imposter/amqp_imposter/model/methods.py b/src/tests/amqp_imposter/amqp_imposter/model/methods.py index 33c12aef..46055d94 100644 --- a/src/tests/amqp_imposter/amqp_imposter/model/methods.py +++ b/src/tests/amqp_imposter/amqp_imposter/model/methods.py @@ -53,11 +53,9 @@ class ConnectionStart: version_major: Exact[Octet] = HOLE version_minor: Exact[Octet] = HOLE + server_properties: Exact[Table] = HOLE mechanisms: Exact[tuple[str, ...]] = HOLE locales: Exact[tuple[str, ...]] = HOLE - publisher_confirms: Exact[bool] = HOLE - basic_nack: Exact[bool] = HOLE - consumer_cancel_notify: Exact[bool] = HOLE @dataclass(frozen=True, slots=True) @@ -65,6 +63,7 @@ class ConnectionStartOk: CLASS_ID: ClassVar[ClassId] = ClassId.CONNECTION METHOD_ID: ClassVar[int] = 11 + client_properties: Arbitrary[Table] = GEN_EMPTY_TABLE mechanism: Exact[ShortStr] = HOLE locale: Exact[ShortStr] = HOLE response: Arbitrary[str] = GEN_EMPTY_STR diff --git a/src/tests/amqp_imposter/amqp_imposter/model/model_server.py b/src/tests/amqp_imposter/amqp_imposter/model/model_server.py index b8ad8f93..b1b8e38b 100644 --- a/src/tests/amqp_imposter/amqp_imposter/model/model_server.py +++ b/src/tests/amqp_imposter/amqp_imposter/model/model_server.py @@ -49,6 +49,9 @@ def receive_protocol_header(self) -> ms.Unrepresentable | None: self.model_state = model_state return None + def receive_hard_disconnect(self) -> None: + self.model_state = transition_receive.apply_hard_disconnect(self.model_state) + def receive(self, method: m.Method) -> m.Method | ms.Unrepresentable: if m.is_method_pattern(method): return ms.Unrepresentable(method) @@ -143,3 +146,6 @@ def send_gens( def sendables(self) -> tuple[m.Method, ...]: return mb.sendables(self.model_state) + + def negotiated_tunables(self) -> no.Tunables | None: + return ms.negotiated_tunables(self.model_state.connection_state) diff --git a/src/tests/amqp_imposter/amqp_imposter/model/model_state.py b/src/tests/amqp_imposter/amqp_imposter/model/model_state.py index 960fa97f..0668ed30 100644 --- a/src/tests/amqp_imposter/amqp_imposter/model/model_state.py +++ b/src/tests/amqp_imposter/amqp_imposter/model/model_state.py @@ -27,7 +27,12 @@ Transparent, is_opaque, ) -from .negotiation_options import DEFAULT_NEGOTIATION_OPTIONS, NegotiationOptions +from .negotiation_options import ( + DEFAULT_NEGOTIATION_OPTIONS, + Capabilities, + NegotiationOptions, + Tunables, +) FIRST_CONFIRM_SEQ = LongLong(1) FIRST_DELIVERY_TAG = LongLong(1) @@ -121,12 +126,7 @@ class OwingCloseOk: pass -@dataclass(frozen=True, slots=True) -class OwedAndOwingCloseOk: - pass - - -type CloseHandshake = OwedCloseOk | OwingCloseOk | OwedAndOwingCloseOk +type CloseHandshake = OwedCloseOk | OwingCloseOk @dataclass(frozen=True, slots=True) @@ -167,21 +167,25 @@ class GreetedConnectionState: @dataclass(frozen=True, slots=True) class StartedConnectionState: - pass + capabilities: Capabilities @dataclass(frozen=True, slots=True) class TunedConnectionState: - pass + capabilities: Capabilities + tunables: Tunables @dataclass(frozen=True, slots=True) class OpenConnectionState: + capabilities: Capabilities + tunables: Tunables channel_state: ChannelState = ClosedChannelState() @dataclass(frozen=True, slots=True) class ClosingConnectionState: + tunables: Tunables close_handshake: CloseHandshake @@ -273,14 +277,18 @@ def awaits_consume_ok(state: ModelState) -> bool: ) -def has_pending_consume(state: ModelState) -> bool: - return any( - isinstance(revealed.item, KnownReplyState) - and isinstance(revealed.item.causing_method, m.BasicConsume) - for revealed in state.line +def is_reply_to( + revealed: Revealed[RevealedState], kinds: tuple[type[m.Method], ...] +) -> bool: + return isinstance(revealed.item, KnownReplyState) and isinstance( + revealed.item.causing_method, kinds ) +def has_pending_reply_to(state: ModelState, *kinds: type[m.Method]) -> bool: + return any(is_reply_to(revealed, kinds) for revealed in state.line) + + def is_deferred_publish(revealed: Revealed[RevealedState]) -> bool: return isinstance(revealed.item, DeferredPublishState) @@ -346,6 +354,22 @@ def is_acknowledgeable( ) +def negotiated_tunables(connection_state: ConnectionState) -> Tunables | None: + match connection_state: + case ( + TunedConnectionState(tunables=tunables) + | OpenConnectionState(tunables=tunables) + | ClosingConnectionState(tunables=tunables) + ): + return tunables + case ( + ClosedConnectionState() + | GreetedConnectionState() + | StartedConnectionState() + ): + return None + + def has_prefetch_space( channel_state: OpenChannelState, consumer_state: ActiveConsumerState ) -> bool: @@ -399,22 +423,37 @@ def owe_reply( return state -def owe_optional_reply(state: ModelState, causing_method: m.Method) -> ModelState: - to_schedule: Revealed[RevealedState] = Transparent( - KnownReplyState((), causing_method) - ) - match state.line.last(): - case Transparent(KnownReplyState((), last_causing_method)) if ( - # optimisation - # we can merge identical error replies for different transparent causing methods - # as we ne never need to correlate them back to the cause - er.optional_error_replies(last_causing_method) - == er.optional_error_replies(causing_method) +def revealed_state_coalesces_with(item: RevealedState, other: RevealedState) -> bool: + match item, other: + case (KnownReplyState(causing_method=m.BasicConsume()), _) | ( + _, + KnownReplyState(causing_method=m.BasicConsume()), ): - line, _ = state.line.split(len(state.line) - 1) - return replace(state, line=line.push(to_schedule)) + # consume is special because we must preserve its position + # the consume reply also contains deliveries, and if we send one of them we need to + # drop everything that was in the line before it + # therefore we can't coalesce -- see below + return False + case ( + KnownReplyState((), causing_method), + KnownReplyState((), other_causing_method), + ): + # optimisation + # we can merge identical ERROR replies for different transparent causing methods + # as we never need to correlate them back to the cause + # since they close the channel/connection anyway + return er.optional_error_replies( + causing_method + ) == er.optional_error_replies(other_causing_method) case _: - return replace(state, line=state.line.push(to_schedule)) + return False + + +def owe_optional_reply(state: ModelState, causing_method: m.Method) -> ModelState: + line = state.line.push_coalescent( + KnownReplyState((), causing_method), revealed_state_coalesces_with + ) + return replace(state, line=line) def owe_get_reply(state: ModelState, get: m.BasicGet) -> ModelState: @@ -429,6 +468,12 @@ def owe_no_replies(state: ModelState) -> ModelState: return state +def owe_only_replies_to(state: ModelState, *kinds: type[m.Method]) -> ModelState: + line = state.line.filter(lambda revealed: is_reply_to(revealed, kinds)) + state = replace(state, line=line) + return state + + def set_prefetch_count( state: ModelState, connection_state: OpenConnectionState, @@ -692,6 +737,18 @@ def requeue_deliveries( return state +def requeue_unacked( + state: ModelState, connection_state: OpenConnectionState +) -> ModelState: + match connection_state.channel_state: + case OpenChannelState() as channel_state: + return requeue_deliveries( + state, connection_state, channel_state, channel_state.unacked_states + ) + case ClosingChannelState() | ClosedChannelState(): + return state + + ### ========================== ### Simple state transitions ### ========================== @@ -772,14 +829,13 @@ def to_closing_channel_state( state: ModelState, connection_state: OpenConnectionState, channel_state: OpenChannelState, - close_handshake: OwedCloseOk | OwingCloseOk, ) -> ModelState: - state = owe_no_replies(state) + state = owe_only_replies_to(state, m.ConnectionClose, m.ChannelClose) state = requeue_deliveries( state, connection_state, channel_state, channel_state.unacked_states ) connection_state = replace( - connection_state, channel_state=ClosingChannelState(close_handshake) + connection_state, channel_state=ClosingChannelState(OwedCloseOk()) ) state = replace(state, connection_state=connection_state) return state @@ -788,9 +844,17 @@ def to_closing_channel_state( def to_closed_channel_state( state: ModelState, connection_state: OpenConnectionState, - channel_state: ClosingChannelState, + channel_state: OpenChannelState | ClosingChannelState, ) -> ModelState: - state = owe_no_replies(state) + match channel_state: + case OpenChannelState(): + state = requeue_deliveries( + state, connection_state, channel_state, channel_state.unacked_states + ) + case ClosingChannelState(): + pass + + state = owe_only_replies_to(state, m.ConnectionClose) connection_state = replace(connection_state, channel_state=ClosedChannelState()) state = replace(state, connection_state=connection_state) return state @@ -809,27 +873,34 @@ def to_channel_close_handshake_state( def to_closing_connection_state( - state: ModelState, - connection_state: TunedConnectionState | OpenConnectionState, - close_handshake: OwedCloseOk | OwingCloseOk, + state: ModelState, connection_state: OpenConnectionState ) -> ModelState: - state = owe_no_replies(state) - - match connection_state: - case OpenConnectionState(channel_state=OpenChannelState() as channel_state): - state = requeue_deliveries( - state, connection_state, channel_state, channel_state.unacked_states - ) - case _: - pass - - state = replace(state, connection_state=ClosingConnectionState(close_handshake)) + state = owe_only_replies_to(state, m.ConnectionClose) + state = requeue_unacked(state, connection_state) + state = replace( + state, + connection_state=ClosingConnectionState( + tunables=connection_state.tunables, close_handshake=OwedCloseOk() + ), + ) return state def to_closed_connection_state( - state: ModelState, connection_state: ClosingConnectionState + state: ModelState, connection_state: ConnectionState ) -> ModelState: + match connection_state: + case OpenConnectionState(): + state = requeue_unacked(state, connection_state) + case ( + ClosedConnectionState() + | GreetedConnectionState() + | StartedConnectionState() + | TunedConnectionState() + | ClosingConnectionState() + ): + pass + state = owe_no_replies(state) state = replace(state, connection_state=ClosedConnectionState()) return state @@ -854,18 +925,25 @@ def to_greeted_connection_state( def to_started_connection_state( - state: ModelState, connection_state: GreetedConnectionState + state: ModelState, + connection_state: GreetedConnectionState, + capabilities: Capabilities, ) -> ModelState: state = owe_no_replies(state) - state = replace(state, connection_state=StartedConnectionState()) + state = replace(state, connection_state=StartedConnectionState(capabilities)) return state def to_tuned_connection_state( - state: ModelState, connection_state: StartedConnectionState + state: ModelState, + connection_state: StartedConnectionState, + tunables: Tunables, ) -> ModelState: state = owe_no_replies(state) - state = replace(state, connection_state=TunedConnectionState()) + state = replace( + state, + connection_state=TunedConnectionState(connection_state.capabilities, tunables), + ) return state @@ -873,7 +951,12 @@ def to_open_connection_state( state: ModelState, connection_state: TunedConnectionState ) -> ModelState: state = owe_no_replies(state) - state = replace(state, connection_state=OpenConnectionState()) + state = replace( + state, + connection_state=OpenConnectionState( + connection_state.capabilities, connection_state.tunables + ), + ) return state diff --git a/src/tests/amqp_imposter/amqp_imposter/model/negotiation_options.py b/src/tests/amqp_imposter/amqp_imposter/model/negotiation_options.py index 13ce146c..76b97516 100644 --- a/src/tests/amqp_imposter/amqp_imposter/model/negotiation_options.py +++ b/src/tests/amqp_imposter/amqp_imposter/model/negotiation_options.py @@ -16,34 +16,87 @@ from dataclasses import dataclass from ..helpers.nonempty_tuple import NonEmptyTuple -from .constants import ( - DEFAULT_BASIC_NACK, - DEFAULT_CHANNEL_MAX, - DEFAULT_CONSUMER_CANCEL_NOTIFY, - DEFAULT_FRAME_MAX, - DEFAULT_HEARTBEAT, - DEFAULT_LOCALES, - DEFAULT_MECHANISMS, - DEFAULT_PUBLISHER_CONFIRMS, +from .constants import DEFAULT_LOCALES, DEFAULT_MECHANISMS +from .domains import Long, Short, ShortStr +from .method_fields import Table + +CAPABILITIES = ShortStr("capabilities") +PUBLISHER_CONFIRMS = ShortStr("publisher_confirms") +BASIC_NACK = ShortStr("basic.nack") +CONSUMER_CANCEL_NOTIFY = ShortStr("consumer_cancel_notify") + + +@dataclass(frozen=True, slots=True) +class Capabilities: + publisher_confirms: bool + basic_nack: bool + consumer_cancel_notify: bool + + +DEFAULT_CAPABILITIES = Capabilities( + publisher_confirms=True, basic_nack=True, consumer_cancel_notify=True +) + + +@dataclass(frozen=True, slots=True) +class Tunables: + channel_max: Short + frame_max: Long + heartbeat: Short + + +DEFAULT_TUNABLES = Tunables( + channel_max=Short(2047), frame_max=Long(131072), heartbeat=Short(0) ) -from .domains import Long, Short @dataclass(frozen=True, slots=True) class NegotiationOptions: """ - Configures how the server initiates ConnectionStart and ConnectionTune. - The server will only accept exact matches of these values in the replies. + Configures what the server offers in ConnectionStart and ConnectionTune. """ mechanisms: NonEmptyTuple[str] = DEFAULT_MECHANISMS locales: NonEmptyTuple[str] = DEFAULT_LOCALES - publisher_confirms: bool = DEFAULT_PUBLISHER_CONFIRMS - basic_nack: bool = DEFAULT_BASIC_NACK - consumer_cancel_notify: bool = DEFAULT_CONSUMER_CANCEL_NOTIFY - channel_max: Short = DEFAULT_CHANNEL_MAX - frame_max: Long = DEFAULT_FRAME_MAX - heartbeat: Short = DEFAULT_HEARTBEAT + capabilities: Capabilities = DEFAULT_CAPABILITIES + tunables: Tunables = DEFAULT_TUNABLES DEFAULT_NEGOTIATION_OPTIONS = NegotiationOptions() + + +def server_properties_of(capabilities: Capabilities) -> Table: + return Table( + { + CAPABILITIES: Table( + { + PUBLISHER_CONFIRMS: capabilities.publisher_confirms, + BASIC_NACK: capabilities.basic_nack, + CONSUMER_CANCEL_NOTIFY: capabilities.consumer_cancel_notify, + } + ) + } + ) + + +def client_capabilities_of(client_properties: Table) -> Capabilities: + match client_properties.get(CAPABILITIES): + case frozendict() as capabilities: + return Capabilities( + publisher_confirms=capabilities.get(PUBLISHER_CONFIRMS) is True, + basic_nack=capabilities.get(BASIC_NACK) is True, + consumer_cancel_notify=capabilities.get(CONSUMER_CANCEL_NOTIFY) is True, + ) + case _: + return Capabilities( + publisher_confirms=False, basic_nack=False, consumer_cancel_notify=False + ) + + +def intersect_capabilities(server: Capabilities, client: Capabilities) -> Capabilities: + return Capabilities( + publisher_confirms=server.publisher_confirms and client.publisher_confirms, + basic_nack=server.basic_nack and client.basic_nack, + consumer_cancel_notify=server.consumer_cancel_notify + and client.consumer_cancel_notify, + ) diff --git a/src/tests/amqp_imposter/amqp_imposter/model/transition_receive.py b/src/tests/amqp_imposter/amqp_imposter/model/transition_receive.py index 7d71afff..17e3e691 100644 --- a/src/tests/amqp_imposter/amqp_imposter/model/transition_receive.py +++ b/src/tests/amqp_imposter/amqp_imposter/model/transition_receive.py @@ -13,19 +13,28 @@ # See the License for the specific language governing permissions and # limitations under the License. +import math + from . import error_replies as er from . import method_fields as mf from . import methods as m from . import model_state as ms from .constants import ( DELIVERY_MODES, + FRAME_MIN_FLOOR, PRIORITY_MAX, PRIORITY_MIN, PROTOCOL_MAJOR, PROTOCOL_MINOR, ) -from .domains import NonEmptyShortStr, ShortStr +from .domains import Long, NonEmptyShortStr, ShortStr from .method_fields import assert_concrete +from .negotiation_options import ( + Tunables, + client_capabilities_of, + intersect_capabilities, + server_properties_of, +) def apply(state: ms.ModelState, method: m.Method) -> ms.TransitionOutcome: @@ -45,6 +54,8 @@ def apply(state: ms.ModelState, method: m.Method) -> ms.TransitionOutcome: def apply_protocol_header(state: ms.ModelState) -> ms.TransitionOutcome: + options = state.negotiation_options + match state.connection_state: case ms.ClosedConnectionState(): state = ms.to_greeted_connection_state(state, state.connection_state) @@ -53,11 +64,9 @@ def apply_protocol_header(state: ms.ModelState) -> ms.TransitionOutcome: m.ConnectionStart( version_major=PROTOCOL_MAJOR, version_minor=PROTOCOL_MINOR, + server_properties=server_properties_of(options.capabilities), mechanisms=state.negotiation_options.mechanisms, locales=state.negotiation_options.locales, - publisher_confirms=state.negotiation_options.publisher_confirms, - basic_nack=state.negotiation_options.basic_nack, - consumer_cancel_notify=state.negotiation_options.consumer_cancel_notify, ), ) return state @@ -65,6 +74,10 @@ def apply_protocol_header(state: ms.ModelState) -> ms.TransitionOutcome: return ms.Unrepresentable() +def apply_hard_disconnect(state: ms.ModelState) -> ms.ModelState: + return ms.to_closed_connection_state(state, state.connection_state) + + def owe_error( state: ms.ModelState, reply_code: mf.ReplyCode, causing_method: m.Method ) -> ms.ModelState: @@ -75,12 +88,17 @@ def owe_error( def method_queue_declare_ok(method: m.QueueDeclare) -> m.QueueDeclareOk: queue = assert_concrete(method.queue) - - if queue == "": - # anonymous queue; owe a reply with arbitrary queue name - return m.QueueDeclareOk() - else: - return m.QueueDeclareOk(queue=NonEmptyShortStr(queue)) + passive = assert_concrete(method.passive) + + match queue, passive: + case "", False: + # anonymous queue; owe a reply with arbitrary queue name + # always fresh so we can fix counts to zero + return m.QueueDeclareOk(message_count=Long(0), consumer_count=Long(0)) + case "", True: + return m.QueueDeclareOk() + case _: + return m.QueueDeclareOk(queue=NonEmptyShortStr(queue)) def method_basic_consume_ok(consumer_tag: ShortStr) -> m.BasicConsumeOk: @@ -91,6 +109,18 @@ def method_basic_consume_ok(consumer_tag: ShortStr) -> m.BasicConsumeOk: return m.BasicConsumeOk(consumer_tag=NonEmptyShortStr(consumer_tag)) +def is_ok_tune_ok(server_tunables: Tunables, tune_ok: m.ConnectionTuneOk) -> bool: + client_channel_max = assert_concrete(tune_ok.channel_max) or math.inf + client_frame_max = assert_concrete(tune_ok.frame_max) or math.inf + + server_channel_max = server_tunables.channel_max or math.inf + server_frame_max = server_tunables.frame_max or math.inf + + return client_channel_max <= server_channel_max and ( + FRAME_MIN_FLOOR <= client_frame_max <= server_frame_max + ) + + def apply_greeted( state: ms.ModelState, connection_state: ms.GreetedConnectionState, method: m.Method ) -> ms.TransitionOutcome: @@ -101,13 +131,20 @@ def apply_greeted( assert_concrete(method.mechanism) in options.mechanisms and assert_concrete(method.locale) in options.locales ): - state = ms.to_started_connection_state(state, connection_state) + state = ms.to_started_connection_state( + state, + connection_state, + intersect_capabilities( + options.capabilities, + client_capabilities_of(assert_concrete(method.client_properties)), + ), + ) state = ms.owe_reply( state, m.ConnectionTune( - channel_max=options.channel_max, - frame_max=options.frame_max, - heartbeat=options.heartbeat, + channel_max=options.tunables.channel_max, + frame_max=options.tunables.frame_max, + heartbeat=options.tunables.heartbeat, ), ) return state @@ -123,12 +160,13 @@ def apply_started( options = state.negotiation_options match method: - case m.ConnectionTuneOk() if ( - method.channel_max, - method.frame_max, - method.heartbeat, - ) == (options.channel_max, options.frame_max, options.heartbeat): - state = ms.to_tuned_connection_state(state, connection_state) + case m.ConnectionTuneOk() if is_ok_tune_ok(options.tunables, method): + tunables = Tunables( + channel_max=assert_concrete(method.channel_max), + frame_max=assert_concrete(method.frame_max), + heartbeat=assert_concrete(method.heartbeat), + ) + state = ms.to_tuned_connection_state(state, connection_state, tunables) return state case _: return ms.Unrepresentable(method) @@ -141,7 +179,7 @@ def apply_tuned( ) -> ms.TransitionOutcome: match method: case m.ConnectionOpen(): - # not an open connection just yet; cannot be pipelined with e.g. Channel.Open + state = ms.to_open_connection_state(state, connection_state) state = ms.owe_reply(state, m.ConnectionOpenOk(), method) return state case _: @@ -153,19 +191,19 @@ def apply_closing( connection_state: ms.ClosingConnectionState, method: m.Method, ) -> ms.TransitionOutcome: + owing_close_ok = ms.has_pending_reply_to(state, m.ConnectionClose) + match method, connection_state.close_handshake: - case m.ConnectionClose(), ms.OwedCloseOk(): - return ms.to_connection_close_handshake_state( - state, connection_state, ms.OwedAndOwingCloseOk() - ) - case m.ConnectionClose(), (ms.OwingCloseOk() | ms.OwedAndOwingCloseOk()): + case m.ConnectionClose(), _ if owing_close_ok: return state - case m.ConnectionCloseOk(), ms.OwedCloseOk(): - return ms.to_closed_connection_state(state, connection_state) - case m.ConnectionCloseOk(), ms.OwedAndOwingCloseOk(): + case m.ConnectionClose(), _: + return ms.owe_reply(state, m.ConnectionCloseOk(), method) + case m.ConnectionCloseOk(), ms.OwedCloseOk() if owing_close_ok: return ms.to_connection_close_handshake_state( state, connection_state, ms.OwingCloseOk() ) + case m.ConnectionCloseOk(), ms.OwedCloseOk(): + return ms.to_closed_connection_state(state, connection_state) case m.ConnectionCloseOk(), ms.OwingCloseOk(): return ms.Unrepresentable(method) case _: @@ -176,6 +214,10 @@ def apply_open( state: ms.ModelState, connection_state: ms.OpenConnectionState, method: m.Method ) -> ms.TransitionOutcome: match method: + case m.ConnectionCloseOk(): + return ms.Unrepresentable(method) + case _ if ms.has_pending_reply_to(state, m.ConnectionClose): + return state case ( m.ConnectionStart() | m.ConnectionStartOk() @@ -183,13 +225,10 @@ def apply_open( | m.ConnectionTuneOk() | m.ConnectionOpen() | m.ConnectionOpenOk() - | m.ConnectionCloseOk() ): return ms.Unrepresentable(method) case m.ConnectionClose(): - return ms.to_closing_connection_state( - state, connection_state, ms.OwingCloseOk() - ) + return ms.owe_reply(state, m.ConnectionCloseOk(), method) case _: return apply_channel(state, connection_state, method) @@ -217,8 +256,6 @@ def apply_closed_channel( state = ms.to_open_channel_state(state, connection_state, channel_state) state = ms.owe_reply(state, m.ChannelOpenOk(), method) return state - case m.ChannelCloseOk(): - return ms.Unrepresentable(method) case _: state = owe_error(state, mf.ReplyCode.CHANNEL_ERROR, method) return state @@ -230,19 +267,19 @@ def apply_closing_channel( channel_state: ms.ClosingChannelState, method: m.Method, ) -> ms.TransitionOutcome: + owing_close_ok = ms.has_pending_reply_to(state, m.ChannelClose) + match method, channel_state.close_handshake: - case m.ChannelClose(), ms.OwedCloseOk(): - return ms.to_channel_close_handshake_state( - state, connection_state, channel_state, ms.OwedAndOwingCloseOk() - ) - case m.ChannelClose(), (ms.OwingCloseOk() | ms.OwedAndOwingCloseOk()): + case m.ChannelClose(), _ if owing_close_ok: return state - case m.ChannelCloseOk(), ms.OwedCloseOk(): - return ms.to_closed_channel_state(state, connection_state, channel_state) - case m.ChannelCloseOk(), ms.OwedAndOwingCloseOk(): + case m.ChannelClose(), _: + return ms.owe_reply(state, m.ChannelCloseOk(), method) + case m.ChannelCloseOk(), ms.OwedCloseOk() if owing_close_ok: return ms.to_channel_close_handshake_state( state, connection_state, channel_state, ms.OwingCloseOk() ) + case m.ChannelCloseOk(), ms.OwedCloseOk(): + return ms.to_closed_channel_state(state, connection_state, channel_state) case m.ChannelCloseOk(), ms.OwingCloseOk(): return ms.Unrepresentable(method) case _: @@ -255,22 +292,17 @@ def apply_open_channel( channel_state: ms.OpenChannelState, method: m.Method, ) -> ms.TransitionOutcome: - if isinstance(method, m.ChannelCloseOk): - return ms.Unrepresentable(method) - - if ms.has_terminal_error(state): - return state - match method: - case m.ChannelOpen(): - state = owe_error(state, mf.ReplyCode.CHANNEL_ERROR, method) + case m.ChannelCloseOk(): + return ms.Unrepresentable(method) + case _ if ms.has_pending_reply_to(state, m.ChannelClose): return state case m.ChannelClose(): - return ms.to_closing_channel_state( - state, connection_state, channel_state, ms.OwingCloseOk() - ) - case m.ConfirmSelect(): - return apply_confirm_select(state, connection_state, channel_state, method) + return ms.owe_reply(state, m.ChannelCloseOk(), method) + case _ if ms.has_terminal_error(state): + return state + case m.ChannelOpen(): + return owe_error(state, mf.ReplyCode.CHANNEL_ERROR, method) case m.ExchangeDeclare(): return apply_unless_no_wait(state, method, m.ExchangeDeclareOk()) case m.ExchangeBind(): @@ -291,10 +323,14 @@ def apply_open_channel( return apply_basic_publish(state, connection_state, channel_state, method) case m.BasicAck(): return apply_ack(state, connection_state, channel_state, method) - case m.BasicNack(): - return apply_nack(state, connection_state, channel_state, method) case m.BasicReject(): return apply_reject(state, connection_state, channel_state, method) + case m.BasicNack() if state.negotiation_options.capabilities.basic_nack: + return apply_nack(state, connection_state, channel_state, method) + case m.ConfirmSelect() if ( + state.negotiation_options.capabilities.publisher_confirms + ): + return apply_confirm_select(state, connection_state, channel_state, method) case _: return ms.Unrepresentable(method) diff --git a/src/tests/amqp_imposter/amqp_imposter/model/transition_send.py b/src/tests/amqp_imposter/amqp_imposter/model/transition_send.py index 44ba2376..aafda721 100644 --- a/src/tests/amqp_imposter/amqp_imposter/model/transition_send.py +++ b/src/tests/amqp_imposter/amqp_imposter/model/transition_send.py @@ -46,16 +46,10 @@ def apply_connection( connection_state = state.connection_state match connection_state, method: - case ms.TunedConnectionState(), m.ConnectionOpenOk(): - state = ms.to_open_connection_state(state, connection_state) - return state - case ( - (ms.TunedConnectionState() | ms.OpenConnectionState()), - m.ConnectionClose(), - ): - return ms.to_closing_connection_state( - state, connection_state, ms.OwedCloseOk() - ) + case ms.OpenConnectionState(), m.ConnectionClose(): + return ms.to_closing_connection_state(state, connection_state) + case ms.OpenConnectionState(), m.ConnectionCloseOk(): + return ms.to_closed_connection_state(state, connection_state) case ms.ClosingConnectionState(), _: return apply_closing(state, connection_state, method) case ms.OpenConnectionState(), _: @@ -72,10 +66,6 @@ def apply_closing( match method, connection_state.close_handshake: case m.ConnectionCloseOk(), ms.OwingCloseOk(): return ms.to_closed_connection_state(state, connection_state) - case m.ConnectionCloseOk(), ms.OwedAndOwingCloseOk(): - return ms.to_connection_close_handshake_state( - state, connection_state, ms.OwedCloseOk() - ) case _: return state @@ -109,10 +99,6 @@ def apply_closing_channel( match method, channel_state.close_handshake: case m.ChannelCloseOk(), ms.OwingCloseOk(): return ms.to_closed_channel_state(state, connection_state, channel_state) - case m.ChannelCloseOk(), ms.OwedAndOwingCloseOk(): - return ms.to_channel_close_handshake_state( - state, connection_state, channel_state, ms.OwedCloseOk() - ) case _: return state @@ -126,9 +112,9 @@ def apply_open_channel( ) -> ms.ModelState: match method: case m.ChannelClose(): - return ms.to_closing_channel_state( - state, connection_state, channel_state, ms.OwedCloseOk() - ) + return ms.to_closing_channel_state(state, connection_state, channel_state) + case m.ChannelCloseOk(): + return ms.to_closed_channel_state(state, connection_state, channel_state) case m.BasicQosOk(): return apply_basic_qos_ok( state, connection_state, channel_state, causing_method diff --git a/src/tests/amqp_imposter/proto/amqp_imposter/control/v1/imposter.proto b/src/tests/amqp_imposter/proto/amqp_imposter/control/v1/imposter.proto index 0448a347..b0324d1f 100644 --- a/src/tests/amqp_imposter/proto/amqp_imposter/control/v1/imposter.proto +++ b/src/tests/amqp_imposter/proto/amqp_imposter/control/v1/imposter.proto @@ -79,43 +79,39 @@ message ConnectionStart { uint32 version_minor = 2; repeated string mechanisms = 3; repeated string locales = 4; - bool publisher_confirms = 5; - bool basic_nack = 6; - bool consumer_cancel_notify = 7; + optional AmqpTable server_properties = 5; } message ConnectionStartSelector { optional uint32 version_major = 1; optional uint32 version_minor = 2; optional StringList mechanisms = 3; optional StringList locales = 4; - optional bool publisher_confirms = 5; - optional bool basic_nack = 6; - optional bool consumer_cancel_notify = 7; + optional AmqpTable server_properties = 5; } message ConnectionStartPattern { optional uint32 version_major = 1; optional uint32 version_minor = 2; optional StringList mechanisms = 3; optional StringList locales = 4; - optional bool publisher_confirms = 5; - optional bool basic_nack = 6; - optional bool consumer_cancel_notify = 7; + optional AmqpTable server_properties = 5; } message ConnectionStartOk { string mechanism = 1; string locale = 2; string response = 3; + optional AmqpTable client_properties = 4; } message ConnectionStartOkSelector { optional string mechanism = 1; optional string locale = 2; - reserved 3; + reserved 3, 4; } message ConnectionStartOkPattern { optional string mechanism = 1; optional string locale = 2; optional string response = 3; + optional AmqpTable client_properties = 4; } message ConnectionTune { @@ -729,10 +725,12 @@ enum TranscriptEvent { TRANSCRIPT_EVENT_IDLE_TIMEOUT = 5; TRANSCRIPT_EVENT_PROTOCOL_HEADER = 6; TRANSCRIPT_EVENT_FRAME_MALFORMED = 7; - TRANSCRIPT_EVENT_FRAME_HEARTBEAT = 8; + TRANSCRIPT_EVENT_HEARTBEAT_INGRESS = 8; TRANSCRIPT_EVENT_METHOD_INGRESS = 9; TRANSCRIPT_EVENT_METHOD_EGRESS = 10; TRANSCRIPT_EVENT_METHOD_UNREPRESENTABLE = 11; + TRANSCRIPT_EVENT_HEARTBEAT_EGRESS = 12; + TRANSCRIPT_EVENT_HEARTBEAT_TIMEOUT = 13; } message TranscriptLine { diff --git a/src/tests/amqp_imposter/pyproject.toml b/src/tests/amqp_imposter/pyproject.toml index e23b87c3..89cf9742 100644 --- a/src/tests/amqp_imposter/pyproject.toml +++ b/src/tests/amqp_imposter/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "amqp-imposter" -version = "0.17.0" +version = "1.0.0" requires-python = ">=3.15" dependencies = [ "pika == 1.4.4", diff --git a/src/tests/amqp_imposter/tests/amqp/helpers.py b/src/tests/amqp_imposter/tests/amqp/helpers.py index d67e8492..14aec1e1 100644 --- a/src/tests/amqp_imposter/tests/amqp/helpers.py +++ b/src/tests/amqp_imposter/tests/amqp/helpers.py @@ -31,8 +31,13 @@ BASE_WEIGHT, WeightedSelector, ) +from amqp_imposter.model.negotiation_options import ( + DEFAULT_NEGOTIATION_OPTIONS, + server_properties_of, +) FRAME_MAX = 131072 +MAX_BUFFER = se.DEFAULT_MAX_BUFFER GLOBAL_CHANNEL = 0 CHANNEL = 1 OTHER_CHANNEL = 2 @@ -49,11 +54,9 @@ CONNECTION_START = m.ConnectionStart( version_major=d.Octet(0), version_minor=d.Octet(9), + server_properties=server_properties_of(DEFAULT_NEGOTIATION_OPTIONS.capabilities), mechanisms=("PLAIN",), locales=("en_US",), - publisher_confirms=True, - basic_nack=True, - consumer_cancel_notify=True, ) CONNECTION_START_OK = m.ConnectionStartOk( mechanism=d.ShortStr("PLAIN"), locale=d.ShortStr("en_US") @@ -96,9 +99,12 @@ def filter_action_methods( for act in acts: match act: case se.SocketWrite(): - items, _ = fr.decode(act.payload, FRAME_MAX) sent.extend( - item for item in items if isinstance(item, fr.MethodOnChannel) + item + for item, _ in fr.decode_many( + act.payload, lambda: FRAME_MAX, MAX_BUFFER + ) + if isinstance(item, fr.MethodOnChannel) ) case _: continue diff --git a/src/tests/amqp_imposter/tests/amqp/test_method_framing.py b/src/tests/amqp_imposter/tests/amqp/test_method_framing.py index df5646ad..8fd1677c 100644 --- a/src/tests/amqp_imposter/tests/amqp/test_method_framing.py +++ b/src/tests/amqp_imposter/tests/amqp/test_method_framing.py @@ -26,7 +26,7 @@ from amqp_imposter.model import domains as d from amqp_imposter.model import method_fields as mf from amqp_imposter.model import methods as m -from tests.amqp.helpers import CONNECTION_START +from tests.amqp.helpers import CONNECTION_START, MAX_BUFFER from ..helpers import concrete @@ -60,15 +60,18 @@ def test_decode_protocol_header() -> None: - assert fr.decode(fr.PROTOCOL_HEADER_091, FRAME_MAX) == ( - (fr.ProtocolHeader(fr.PROTOCOL_HEADER_091),), - b"", + assert fr.decode_one(fr.PROTOCOL_HEADER_091, FRAME_MAX, MAX_BUFFER) == ( + fr.ProtocolHeader(fr.PROTOCOL_HEADER_091), + len(fr.PROTOCOL_HEADER_091), ) def test_heartbeat_compose_decode_encode() -> None: assert fr.encode(fr.Heartbeat(), FRAME_MAX) == B_HEARTBEAT - assert fr.decode(B_HEARTBEAT, FRAME_MAX) == ((fr.Heartbeat(),), b"") + assert fr.decode_one(B_HEARTBEAT, FRAME_MAX, MAX_BUFFER) == ( + fr.Heartbeat(), + len(B_HEARTBEAT), + ) @pytest.mark.parametrize( @@ -81,7 +84,7 @@ def test_heartbeat_compose_decode_encode() -> None: ) def test_encodings(egress: fr.MethodOnChannel, encoded: bytes) -> None: assert fr.encode(egress, FRAME_MAX) == encoded - assert fr.decode(encoded, FRAME_MAX) == ((egress,), b"") + assert fr.decode_one(encoded, FRAME_MAX, MAX_BUFFER) == (egress, len(encoded)) # fmt: off @@ -90,13 +93,14 @@ def test_encodings(egress: fr.MethodOnChannel, encoded: bytes) -> None: ( fr.MethodOnChannel(1, m.BasicAck(delivery_tag=d.LongLong(7), multiple=True)), fr.MethodOnChannel(1, m.ChannelOpenOk()), - fr.MethodOnChannel(0, m.ConnectionStart(version_major=d.Octet(0), version_minor=d.Octet(9), mechanisms=("PLAIN", "AMQPLAIN"), locales=("en_US",), publisher_confirms=True, basic_nack=True, consumer_cancel_notify=True,)), + fr.MethodOnChannel(0, m.ConnectionStart(version_major=d.Octet(0), version_minor=d.Octet(9), server_properties=mf.Table({d.ShortStr("capabilities"): mf.Table({d.ShortStr("basic.nack"): True})}), mechanisms=("PLAIN", "AMQPLAIN"), locales=("en_US",))), fr.MethodOnChannel(1, m.QueueDeclare(queue=d.ShortStr("q"), passive=False, durable=True, exclusive=False, auto_delete=False, no_wait=False, arguments=mf.Table({d.ShortStr("x-max-length"): d.SignedLongLong(10)}))), fr.MethodOnChannel(1, m.BasicDeliver(consumer_tag=d.ShortStr("ct"), delivery_tag=d.LongLong(1), redelivered=False, exchange=d.ShortStr("ex"), routing_key=d.ShortStr("rk"), properties=mf.MessageProperties(content_type=d.ShortStr("text/plain")), body=b"hi")), ), ) def test_compose_decode_encode(egress: fr.MethodOnChannel) -> None: - assert fr.decode(fr.encode(egress, FRAME_MAX), FRAME_MAX) == ((egress,), b"") + encoded = fr.encode(egress, FRAME_MAX) + assert fr.decode_one(encoded, FRAME_MAX, MAX_BUFFER) == (egress, len(encoded)) # fmt: on @@ -107,29 +111,28 @@ def test_decode_in_increments() -> None: ) buffer = fr.encode(ACK, FRAME_MAX) + fr.encode(other, FRAME_MAX) - initial_items, initial_carry = fr.decode(buffer, FRAME_MAX) - assert initial_items == (ACK, other) - assert initial_carry == b"" + assert list(fr.decode_many(buffer, lambda: FRAME_MAX, MAX_BUFFER)) == [ + (ACK, fr.encode(other, FRAME_MAX)), + (other, b""), + ] seen_items: list[fr.Ingress] = [] carry = b"" for byte in buffer: - items, carry = fr.decode(carry + bytes([byte]), FRAME_MAX) - seen_items.extend(items) + carry += bytes([byte]) + for item, rest in fr.decode_many(carry, lambda: FRAME_MAX, MAX_BUFFER): + carry = rest + seen_items.append(item) - assert tuple(seen_items) == initial_items - assert carry == b"" + assert seen_items == [ACK, other] def test_frame_remainder() -> None: encoded = fr.encode(PUBLISH, FRAME_MAX) i_cut = len(encoded) - 3 - items, rest = fr.decode(encoded[:i_cut], FRAME_MAX) - assert items == () - assert rest == encoded[:i_cut] - - assert fr.decode(rest + encoded[i_cut:], FRAME_MAX) == ((PUBLISH,), b"") + assert fr.decode_one(encoded[:i_cut], FRAME_MAX, MAX_BUFFER)[0] is None + assert fr.decode_one(encoded, FRAME_MAX, MAX_BUFFER) == (PUBLISH, len(encoded)) def test_frame_body_remainder() -> None: @@ -145,7 +148,11 @@ def test_frame_body_remainder() -> None: body=b"x" * 5000, ), ) - assert fr.decode(fr.encode(big, FRAME_MIN), FRAME_MAX) == ((big,), b"") + split = fr.encode(big, FRAME_MIN) + unsplit = fr.encode(big, 0) + + assert fr.decode_one(split, FRAME_MAX, MAX_BUFFER) == (big, len(split)) + assert fr.decode_one(unsplit, 0, MAX_BUFFER) == (big, len(unsplit)) @pytest.mark.parametrize( @@ -170,17 +177,27 @@ def test_frame_body_remainder() -> None: ), ) def test_bad_frames(bad: bytes) -> None: - items, rest = fr.decode(bad, FRAME_MAX) - assert [type(one) for one in items] == [fr.Undecodable] - assert rest == b"" + assert isinstance(fr.decode_one(bad, FRAME_MAX, MAX_BUFFER)[0], fr.Undecodable) + + +def test_frame_max() -> None: + assert fr.decode_one(B_ACK, len(B_ACK), MAX_BUFFER) == (ACK, len(B_ACK)) + assert isinstance( + fr.decode_one(B_ACK, len(B_ACK) - 1, MAX_BUFFER)[0], fr.Undecodable + ) + assert isinstance( + fr.decode_one(B_ACK[: ps.FRAME_HEADER_SIZE], len(B_ACK) - 1, MAX_BUFFER)[0], + fr.Undecodable, + ) + assert isinstance( + fr.decode_one(B_PUBLISH, len(B_ACK), MAX_BUFFER)[0], fr.Undecodable + ) def test_buffer_maxed() -> None: huge = b"\x01\x00\x01" + (10_000_000).to_bytes(4, "big") + b"\x00" * 200 - items, rest = fr.decode(huge, 100) - assert [type(one) for one in items] == [fr.Undecodable] - assert rest == b"" + assert isinstance(fr.decode_one(huge, 0, 100)[0], fr.Undecodable) EMPTY_ON_THE_WIRE: dict[str, Any] = { @@ -224,41 +241,20 @@ def has_field_domains(value: Any) -> bool: def test_every_kind_compose_decode_encode(kind: type[m.Method]) -> None: egress = fr.MethodOnChannel(1, concrete(kind, SEED)) received = fr.MethodOnChannel(egress.channel, as_received(egress.method)) - decoded = fr.decode(fr.encode(egress, FRAME_MAX), FRAME_MAX) - - assert decoded == ((received,), b"") - assert has_field_domains(decoded[0][0].method) - - -CONNECTION_START_CAPABILITIES_OFF = replace( - CONNECTION_START, - publisher_confirms=False, - basic_nack=False, - consumer_cancel_notify=False, -) - - -def start_spec(capabilities: Any) -> Any: - spec = ps.Connection.Start(server_properties={fr.CAPABILITIES: capabilities}) - spec.mechanisms, spec.locales = "PLAIN", "en_US" - - return spec - - -@pytest.mark.parametrize("capabilities", ("nonsense", 7, [], None), ids=repr) -def test_unusable_capabilities_are_absent(capabilities: Any) -> None: - assert fr.from_pika(start_spec(capabilities)) == CONNECTION_START_CAPABILITIES_OFF - - -def test_capabilities_are_read() -> None: - method = fr.from_pika(start_spec({fr.BASIC_NACK: True})) + encoded = fr.encode(egress, FRAME_MAX) + decoded, len_consumed = fr.decode_one(encoded, FRAME_MAX, MAX_BUFFER) - assert method == replace(CONNECTION_START_CAPABILITIES_OFF, basic_nack=True) + assert (decoded, len_consumed) == (received, len(encoded)) + assert isinstance(decoded, fr.MethodOnChannel) + assert has_field_domains(decoded.method) def test_absent_longstr_is_empty() -> None: assert fr.from_pika(ps.Connection.StartOk()) == m.ConnectionStartOk( - mechanism=d.ShortStr("PLAIN"), locale=d.ShortStr("en_US"), response="" + client_properties=mf.Table(), + mechanism=d.ShortStr("PLAIN"), + locale=d.ShortStr("en_US"), + response="", ) @@ -267,5 +263,5 @@ def test_absent_delimited_longstr_is_empty() -> None: spec.mechanisms, spec.locales = "", "" assert fr.from_pika(spec) == replace( - CONNECTION_START_CAPABILITIES_OFF, mechanisms=(), locales=() + CONNECTION_START, server_properties=mf.Table(), mechanisms=(), locales=() ) diff --git a/src/tests/amqp_imposter/tests/amqp/test_server.py b/src/tests/amqp_imposter/tests/amqp/test_server.py index 50bedfbf..514b751a 100644 --- a/src/tests/amqp_imposter/tests/amqp/test_server.py +++ b/src/tests/amqp_imposter/tests/amqp/test_server.py @@ -18,7 +18,7 @@ import struct from collections.abc import Callable from contextlib import suppress -from dataclasses import replace +from dataclasses import dataclass, replace import pytest @@ -26,6 +26,7 @@ from amqp_imposter.amqp import session as se from amqp_imposter.amqp.server import HOST, AmqpServer from amqp_imposter.amqp.transcript import TranscriptEvent as ev +from amqp_imposter.model import domains as d from amqp_imposter.model import methods as m from amqp_imposter.model.method_weights import ( UNPROMPTED_CONNECTION_CLOSE, @@ -39,6 +40,7 @@ CONNECTION_TUNE_OK, FRAME_MAX, GREETING_WEIGHTS, + MAX_BUFFER, SCRIPTED_REPLIES, SEED, STOP_WEIGHT_DRAIN, @@ -80,11 +82,14 @@ def make_amqp_server(idle_millis: int = se.DEFAULT_IDLE_MILLIS) -> AmqpServer: return AmqpServer(se.Session(make_config(idle_millis))) +@dataclass(slots=True) class SlowAmqpServer(AmqpServer): + action_delay_s: float = ACTION_DELAY_S + async def do_actions( self, actions: tuple[se.SocketAction, ...], writer: asyncio.StreamWriter ) -> bool: - await asyncio.sleep(ACTION_DELAY_S) + await asyncio.sleep(self.action_delay_s) return await super().do_actions(actions, writer) @@ -105,7 +110,10 @@ async def egress_of(reader: asyncio.StreamReader) -> tuple[fr.Ingress, ...]: async with asyncio.timeout(2.0): while True: buffer += await reader.read(4096) - items, buffer = fr.decode(buffer, FRAME_MAX) + items = tuple( + item + for item, _ in fr.decode_many(buffer, lambda: FRAME_MAX, MAX_BUFFER) + ) if items: return items @@ -129,8 +137,9 @@ async def decode_until_eof(reader: asyncio.StreamReader) -> tuple[fr.Ingress, .. while chunk := await reader.read(4096): buffer += chunk - items, _ = fr.decode(buffer, FRAME_MAX) - return items + return tuple( + item for item, _ in fr.decode_many(buffer, lambda: FRAME_MAX, MAX_BUFFER) + ) async def test_start_ephemeral_port() -> None: @@ -385,7 +394,65 @@ async def test_heartbeat_does_not_reset_idle_timer() -> None: await writer.drain() await asyncio.sleep(0.01) - assert ev.IDLE_TIMEOUT in transcript_events(server.session.transcript_lines()) + events = transcript_events(server.session.transcript_lines()) + assert ev.HEARTBEAT_INGRESS in events + assert ev.IDLE_TIMEOUT in events + + await close_writer(writer) + await server.stop() + + +async def test_heartbeat_negotiated() -> None: + loop = asyncio.get_running_loop() + server = make_amqp_server() + port = await server.start() + reader, writer = await make_amqp_client(port) + + writer.write(fr.PROTOCOL_HEADER_091) + writer.write(encoded_method(CONNECTION_START_OK)) + writer.write(encoded_method(replace(CONNECTION_TUNE_OK, heartbeat=d.Short(1)))) + await writer.drain() + await asyncio.sleep(1.5) + writer.write(fr.encode(fr.Heartbeat(), FRAME_MAX)) + await writer.drain() + silent_since = loop.time() + + buffer = b"" + async with asyncio.timeout(4.0): + while chunk := await reader.read(4096): + buffer += chunk + + items = [item for item, _ in fr.decode_many(buffer, lambda: FRAME_MAX, MAX_BUFFER)] + events = transcript_events(server.session.transcript_lines()) + + assert fr.Heartbeat() in items + assert loop.time() - silent_since >= 1.5 + assert ev.HEARTBEAT_EGRESS in events + assert ev.HEARTBEAT_TIMEOUT in events + + await close_writer(writer) + await server.stop() + + +async def test_slow_egress_does_not_starve_heartbeat() -> None: + server = SlowAmqpServer(se.Session(make_config()), action_delay_s=2.1) + port = await server.start() + _, writer = await make_amqp_client(port) + + writer.write(fr.PROTOCOL_HEADER_091) + writer.write(encoded_method(CONNECTION_START_OK)) + writer.write(encoded_method(replace(CONNECTION_TUNE_OK, heartbeat=d.Short(1)))) + await writer.drain() + + with suppress(ConnectionError): + for _ in range(14): + await asyncio.sleep(0.5) + writer.write(fr.encode(fr.Heartbeat(), FRAME_MAX)) + await writer.drain() + + events = transcript_events(server.session.transcript_lines()) + assert ev.HEARTBEAT_INGRESS in events + assert ev.HEARTBEAT_TIMEOUT not in events await close_writer(writer) await server.stop() diff --git a/src/tests/amqp_imposter/tests/amqp/test_session.py b/src/tests/amqp_imposter/tests/amqp/test_session.py index 696c5468..660d2680 100644 --- a/src/tests/amqp_imposter/tests/amqp/test_session.py +++ b/src/tests/amqp_imposter/tests/amqp/test_session.py @@ -13,11 +13,15 @@ # See the License for the specific language governing permissions and # limitations under the License. +from dataclasses import replace + import pytest from amqp_imposter.amqp import method_framing as fr from amqp_imposter.amqp import session as se from amqp_imposter.amqp.transcript import TranscriptEvent as ev +from amqp_imposter.model import constants as c +from amqp_imposter.model import domains as d from amqp_imposter.model import methods as m from amqp_imposter.model.method_scripts import Received, ScriptRule from amqp_imposter.model.method_weights import WeightedSelector @@ -33,7 +37,9 @@ CONNECTION_START, CONNECTION_START_OK, CONNECTION_TUNE_OK, + FRAME_MAX, GLOBAL_CHANNEL, + MAX_BUFFER, OTHER_CHANNEL, SCRIPTED_REPLIES, SEED, @@ -191,6 +197,85 @@ def test_wrong_channel() -> None: assert has_socket_close_action(acts) +def test_channel_max() -> None: + session = session_connected(STOP_WEIGHT_DRAIN) + session.on_ingress(fr.PROTOCOL_HEADER_091) + session.on_ingress(encoded_method(CONNECTION_START_OK)) + session.on_ingress( + encoded_method(replace(CONNECTION_TUNE_OK, channel_max=d.Short(CHANNEL))) + ) + session.on_ingress(encoded_method(m.ConnectionOpen())) + + ok = session.on_ingress(encoded_method(m.ChannelOpen(), CHANNEL)) + session.on_ingress(encoded_method(CHANNEL_CLOSE, CHANNEL)) + too_high = session.on_ingress(encoded_method(m.ChannelOpen(), OTHER_CHANNEL)) + + assert not has_socket_close_action(ok) + assert has_socket_close_action(too_high) + + +def test_frame_max() -> None: + frame_max = c.FRAME_MIN_FLOOR + session = session_connected( + STOP_WEIGHT_DRAIN, + ( + *SCRIPTED_REPLIES, + ScriptRule(Received(m.BasicPublish()), then_send=m.BasicReturn()), + ), + ) + publish = fr.MethodOnChannel( + CHANNEL, replace(BASIC_PUBLISH, mandatory=True, body=bytes(2 * frame_max)) + ) + + acts = session.on_ingress( + fr.PROTOCOL_HEADER_091 + + encoded_method(CONNECTION_START_OK) + + encoded_method(replace(CONNECTION_TUNE_OK, frame_max=d.Long(frame_max))) + + encoded_method(m.ConnectionOpen()) + + encoded_method(m.ChannelOpen(), CHANNEL) + + fr.encode(publish, frame_max) + + fr.encode(publish, FRAME_MAX) + ) + payload = b"".join(act.payload for act in acts if isinstance(act, se.SocketWrite)) + + assert m.BasicReturn in [ + type(item.method) + for item, _ in fr.decode_many(payload, lambda: frame_max, MAX_BUFFER) + if isinstance(item, fr.MethodOnChannel) + ] + assert has_socket_close_action(acts) + + +def test_frame_max_during_close() -> None: + frame_max = c.FRAME_MIN_FLOOR + session = session_connected( + STOP_WEIGHT_DRAIN, + ( + ScriptRule( + Received(m.ConnectionClose()), + then_send=m.BasicDeliver(body=bytes(3 * frame_max)), + ), + *SCRIPTED_REPLIES, + ), + ) + session.on_ingress(fr.PROTOCOL_HEADER_091) + session.on_ingress(encoded_method(CONNECTION_START_OK)) + session.on_ingress( + encoded_method(replace(CONNECTION_TUNE_OK, frame_max=d.Long(frame_max))) + ) + session.on_ingress(encoded_method(m.ConnectionOpen())) + session.on_ingress(encoded_method(m.ChannelOpen(), CHANNEL)) + session.on_ingress(encoded_method(replace(BASIC_CONSUME, no_wait=True), CHANNEL)) + + acts = session.on_ingress(encoded_method(CONNECTION_CLOSE)) + payload = b"".join(act.payload for act in acts if isinstance(act, se.SocketWrite)) + assert [ + type(item.method) + for item, _ in fr.decode_many(payload, lambda: frame_max, MAX_BUFFER) + if isinstance(item, fr.MethodOnChannel) + ] == [m.BasicDeliver, m.ConnectionCloseOk] + + def test_duplicate_open() -> None: session = session_connected(STOP_WEIGHT_DRAIN) connection_open_handshake(session) @@ -275,6 +360,34 @@ def test_reconnect_clean_slate() -> None: assert filter_action_method_kinds(acts) == [m.ConnectionStart] +def test_reconnect_then_redeliver() -> None: + session = session_connected( + STOP_WEIGHT_DRAIN, + script=( + *SCRIPTED_REPLIES, + ScriptRule(Received(m.BasicGet()), then_send=m.BasicGetOk(body=b"unacked")), + ), + ) + connection_open_handshake(session) + session.on_ingress(encoded_method(m.ChannelOpen(), CHANNEL)) + session.on_ingress( + encoded_method(m.BasicGet(queue=d.ShortStr("q"), no_ack=False), CHANNEL) + ) + session.on_disconnected() + + session.on_connected() + connection_open_handshake(session) + session.on_ingress(encoded_method(m.ChannelOpen(), CHANNEL)) + acts = session.on_ingress(encoded_method(BASIC_CONSUME, CHANNEL)) + + assert any( + isinstance(sent.method, m.BasicDeliver) + and sent.method.redelivered is True + and sent.method.body == b"unacked" + for sent in filter_action_methods(acts) + ) + + def test_nothing_to_send() -> None: session = session_connected(STOP_WEIGHT_DRAIN) connection_open_handshake(session) diff --git a/src/tests/amqp_imposter/tests/control/client/test_configuration_util.py b/src/tests/amqp_imposter/tests/control/client/test_configuration_util.py index bd8a4db1..49e3509b 100644 --- a/src/tests/amqp_imposter/tests/control/client/test_configuration_util.py +++ b/src/tests/amqp_imposter/tests/control/client/test_configuration_util.py @@ -13,8 +13,15 @@ # See the License for the specific language governing permissions and # limitations under the License. +import pytest + from amqp_imposter.control import client as cl +from amqp_imposter.control import config_proto as cp +from amqp_imposter.control import method_proto as mp from amqp_imposter.control.v1 import imposter_pb2 as pb +from amqp_imposter.model import methods as m + +from ...helpers import concrete, filled def test_wrap_selector_method() -> None: @@ -29,3 +36,25 @@ def test_wrap_pattern_method() -> None: method = getattr(pb.Pattern(), field.name) assert cl.pattern(method) == pb.Pattern(**{field.name: method}) + + +@pytest.mark.parametrize("seed", range(10)) +@pytest.mark.parametrize("kind", m.METHOD_KINDS, ids=lambda k: k.__name__) +def test_pattern_matches_same_kind(kind: type[m.Method], seed: int) -> None: + ((_, method),) = mp.to_proto(concrete(kind, seed)).ListFields() + + for pattern in (kind(), filled(kind), concrete(kind, seed)): + ((_, pattern_method),) = cp.pattern_to_proto(pattern).ListFields() + assert cl.pattern_matches(pattern_method, method) + + for other_kind in m.METHOD_KINDS: + if other_kind is not kind: + ((_, pattern_method),) = cp.pattern_to_proto(other_kind()).ListFields() + assert not cl.pattern_matches(pattern_method, method) + + +def test_pattern_does_not_match_different_field() -> None: + assert not cl.pattern_matches( + pb.BasicRejectPattern(requeue=False), + pb.BasicReject(delivery_tag=3, requeue=True), + ) diff --git a/src/tests/amqp_imposter/tests/control/test_config_proto.py b/src/tests/amqp_imposter/tests/control/test_config_proto.py index a559b721..c1a4cfa9 100644 --- a/src/tests/amqp_imposter/tests/control/test_config_proto.py +++ b/src/tests/amqp_imposter/tests/control/test_config_proto.py @@ -44,12 +44,21 @@ negotiation_options=no.NegotiationOptions( mechanisms=("PLAIN", "AMQPLAIN"), locales=("en_US", "en_GB"), - publisher_confirms=False, - basic_nack=False, - consumer_cancel_notify=False, - channel_max=d.Short(7), - frame_max=d.Long(8192), - heartbeat=d.Short(60), + capabilities=no.Capabilities( + publisher_confirms=False, basic_nack=False, consumer_cancel_notify=False + ), + tunables=no.Tunables( + channel_max=d.Short(7), frame_max=d.Long(8192), heartbeat=d.Short(60) + ), + ), + ), + replace( + se.DEFAULT_SESSION_CONFIG, + negotiation_options=replace( + no.DEFAULT_NEGOTIATION_OPTIONS, + tunables=no.Tunables( + channel_max=d.Short(0), frame_max=d.Long(0), heartbeat=d.Short(0) + ), ), ), replace( @@ -111,7 +120,8 @@ def test_negotiation_partial() -> None: message = pb.SessionConfig(negotiation_options=pb.NegotiationOptions(heartbeat=60)) assert cp.from_proto(message).negotiation_options == replace( - no.DEFAULT_NEGOTIATION_OPTIONS, heartbeat=d.Short(60) + no.DEFAULT_NEGOTIATION_OPTIONS, + tunables=replace(no.DEFAULT_TUNABLES, heartbeat=d.Short(60)), ) diff --git a/src/tests/amqp_imposter/tests/e2e/resilient_consumer/consumer_properties.py b/src/tests/amqp_imposter/tests/e2e/resilient_consumer/consumer_properties.py index fbf31ac4..ff335f61 100644 --- a/src/tests/amqp_imposter/tests/e2e/resilient_consumer/consumer_properties.py +++ b/src/tests/amqp_imposter/tests/e2e/resilient_consumer/consumer_properties.py @@ -13,34 +13,22 @@ # See the License for the specific language governing permissions and # limitations under the License. -from dataclasses import dataclass from functools import partial -from amqp_imposter.control.client import Transcript, pb +from amqp_imposter.control.client import ( + ConcreteMethod, + PatternMethod, + Transcript, + format_method, + pattern_matches, + pb, +) from amqp_imposter.control.client.transcript_util import ( format_line_name, ) from ..property import Failure, Property, event_and_method - -@dataclass(frozen=True, slots=True) -class Exchange: - name: str - - -@dataclass(frozen=True, slots=True) -class Queue: - name: str - - -@dataclass(frozen=True, slots=True) -class Binding: - exchange: str - routing_key: str - - -type Declaration = Exchange | Queue | Binding type Settlement = pb.BasicAck | pb.BasicNack | pb.BasicReject @@ -128,9 +116,9 @@ def check_after_teardown_reconsume( def check_before_consume_declare( - transcript: Transcript, topology: frozenset[Declaration] + transcript: Transcript, topology: tuple[PatternMethod, ...] ) -> Failure | None: - declared: set[Declaration] = set() + declared: list[ConcreteMethod] = [] declared_queue_names: set[str] = set() for line in transcript: @@ -142,23 +130,22 @@ def check_before_consume_declare( declared.clear() declared_queue_names.clear() - case (pb.TRANSCRIPT_EVENT_METHOD_INGRESS, pb.ExchangeDeclare() as declare): - declared.add(Exchange(declare.exchange)) - - case (pb.TRANSCRIPT_EVENT_METHOD_INGRESS, pb.QueueDeclare() as declare): - declared.add(Queue(declare.queue)) - - case (pb.TRANSCRIPT_EVENT_METHOD_INGRESS, pb.QueueBind() as bind): - declared.add(Binding(bind.exchange, bind.routing_key)) + case ( + pb.TRANSCRIPT_EVENT_METHOD_INGRESS, + pb.ExchangeDeclare() | pb.QueueDeclare() | pb.QueueBind() as declare, + ): + declared.append(declare) case (pb.TRANSCRIPT_EVENT_METHOD_EGRESS, pb.QueueDeclareOk() as declare_ok): declared_queue_names.add(declare_ok.queue) - case (pb.TRANSCRIPT_EVENT_METHOD_INGRESS, pb.BasicConsume()) if ( - missing := topology - declared - ): + case (pb.TRANSCRIPT_EVENT_METHOD_INGRESS, pb.BasicConsume()) if missing := [ + pattern + for pattern in topology + if not any(pattern_matches(pattern, method) for method in declared) + ]: return Failure( - f"Consumed before declaring {', '.join(sorted(map(repr, missing)))}", + f"Consumed before declaring {', '.join(map(format_method, missing))}", line.index, ) @@ -175,7 +162,7 @@ def check_before_consume_declare( def properties( - prefetch_count: int, deliveries: int, topology: frozenset[Declaration] + prefetch_count: int, deliveries: int, topology: tuple[PatternMethod, ...] ) -> tuple[Property, ...]: return ( partial(check_deliveries_acknowledged, prefetch_count=prefetch_count), diff --git a/src/tests/amqp_imposter/tests/e2e/resilient_consumer/consumer_test.py b/src/tests/amqp_imposter/tests/e2e/resilient_consumer/consumer_test.py index d4f619ef..f32d7ea0 100644 --- a/src/tests/amqp_imposter/tests/e2e/resilient_consumer/consumer_test.py +++ b/src/tests/amqp_imposter/tests/e2e/resilient_consumer/consumer_test.py @@ -22,6 +22,7 @@ from amqp_imposter.control.client import ( NOT_FORCED_REPLY_TEXT, AmqpImposter, + PatternMethod, amqp_imposter, pb, weighted, @@ -40,7 +41,7 @@ ) from ..property import Property, assert_properties from .consumer import Delivery, ResilientConsumer -from .consumer_properties import Binding, Declaration, Exchange, Queue, properties +from .consumer_properties import properties SEEDS = range(100) TIMEOUT = 10 # real clients often have backoff so they may not be this fast by default @@ -58,16 +59,14 @@ class ConsumerScenario: prefetch_count: int deliveries: int - def topology(self) -> frozenset[Declaration]: - return frozenset( - ( - Exchange(self.exchange), - Exchange(self.dl_exchange), - Queue(self.dl_queue), - Queue(ANONYMOUS_QUEUE), - Binding(self.dl_exchange, ""), - Binding(self.exchange, self.routing_key), - ) + def topology(self) -> tuple[PatternMethod, ...]: + return ( + pb.ExchangeDeclarePattern(exchange=self.exchange), + pb.ExchangeDeclarePattern(exchange=self.dl_exchange), + pb.QueueDeclarePattern(queue=self.dl_queue), + pb.QueueDeclarePattern(queue=ANONYMOUS_QUEUE), + pb.QueueBindPattern(exchange=self.dl_exchange, routing_key=""), + pb.QueueBindPattern(exchange=self.exchange, routing_key=self.routing_key), ) def declare_topology(self, channel: BlockingChannel) -> str: diff --git a/src/tests/amqp_imposter/tests/helpers.py b/src/tests/amqp_imposter/tests/helpers.py index bfc3f696..8cc7922a 100644 --- a/src/tests/amqp_imposter/tests/helpers.py +++ b/src/tests/amqp_imposter/tests/helpers.py @@ -17,6 +17,7 @@ from amqp_imposter.model import domains as d from amqp_imposter.model import generators as g +from amqp_imposter.model import method_fields as mf from amqp_imposter.model import method_unification as mu from amqp_imposter.model import methods as m @@ -25,9 +26,12 @@ "version_minor": d.Octet(9), "mechanisms": ("PLAIN", "AMQPLAIN"), "locales": ("en_US",), - "publisher_confirms": True, - "basic_nack": True, - "consumer_cancel_notify": True, + "server_properties": mf.Table( + { + d.ShortStr("product"): "RabbitMQ", + d.ShortStr("capabilities"): mf.Table({d.ShortStr("basic.nack"): True}), + } + ), "mechanism": d.ShortStr("PLAIN"), "locale": d.ShortStr("en_US"), "channel_max": d.Short(2047), diff --git a/src/tests/amqp_imposter/tests/model/class_basic/test_consume.py b/src/tests/amqp_imposter/tests/model/class_basic/test_consume.py index 438382d2..79c564b6 100644 --- a/src/tests/amqp_imposter/tests/model/class_basic/test_consume.py +++ b/src/tests/amqp_imposter/tests/model/class_basic/test_consume.py @@ -63,6 +63,20 @@ def test_consume_error_options(no_wait: bool) -> None: ) | connection_errors(mf.ReplyCode.RESOURCE_ERROR) +@pytest.mark.xfail(strict=True, reason="last declared queue is not tracked yet") +def test_consume_blank_queue_without_declare() -> None: + server = channelled() + + receive_unwrap( + server, m.BasicConsume(queue=d.ShortStr(""), consumer_tag=CONSUMER_TAG) + ) + + assert not subsets_any_sendable(server, m.BasicConsumeOk) + assert error_replies_to(server, m.BasicConsume) == connection_errors( + mf.ReplyCode.SYNTAX_ERROR + ) + + def test_no_consume_ok_if_nowait() -> None: server = channelled() @@ -82,7 +96,7 @@ def test_consume_anonymous_tag() -> None: assert lookup_unique_sendable(server, m.BasicConsumeOk).consumer_tag -@pytest.mark.xfail(strict=True, reason="anonymous consumer tag is left to future work") +@pytest.mark.xfail(strict=True, reason="anonymous consumer tag is not modelled yet") def test_consume_anonymous_tag_nowait() -> None: server = channelled() diff --git a/src/tests/amqp_imposter/tests/model/class_basic/test_get.py b/src/tests/amqp_imposter/tests/model/class_basic/test_get.py index 6799f168..ad8f5980 100644 --- a/src/tests/amqp_imposter/tests/model/class_basic/test_get.py +++ b/src/tests/amqp_imposter/tests/model/class_basic/test_get.py @@ -24,10 +24,11 @@ from ..helpers import ( DO_CHANNEL_CLOSE, DO_CONNECTION_CLOSE, + GRACEFUL_CHANNEL_CLOSE, DoTeardown, channel_errors, channelled, - close_channel_from_client, + connection_errors, consume, consuming, deliver, @@ -74,6 +75,18 @@ def test_get_error_options() -> None: ) +@pytest.mark.xfail(strict=True, reason="last declared queue is not tracked yet") +def test_get_blank_queue_without_declare() -> None: + server = channelled() + + receive_unwrap(server, m.BasicGet(queue=d.ShortStr(""))) + + assert not subsets_any_sendable(server, m.BasicGetEmpty) + assert error_replies_to(server, m.BasicGet) == connection_errors( + mf.ReplyCode.SYNTAX_ERROR + ) + + def test_get_empty_spends_no_delivery_tag() -> None: server = polling() @@ -312,14 +325,21 @@ def test_pending_get_precedes_channel_error() -> None: assert error_replies_to(server, m.BasicAck) -def test_channel_close_discards_pending_get() -> None: +def test_pending_get_owed_before_channel_close() -> None: server = polling() - close_channel_from_client(server) + receive_unwrap(server, GRACEFUL_CHANNEL_CLOSE) + # because get is synchronous: + assert not subsets_any_sendable(server, m.ChannelCloseOk) + + send_get_ok(server, body=b"blabla") + send_unwrap(server, m.ChannelCloseOk) reopen_channel(server) + consume(server) - assert not subsets_any_sendable(server, m.BasicGetOk) - assert not subsets_any_sendable(server, m.BasicGetEmpty) + assert lookup_unique_sendable(server, m.BasicDeliver, redelivered=True).body == ( + b"blabla" + ) @pytest.mark.parametrize("close", DO_CHANNEL_CLOSE, ids=lambda c: c.__name__) diff --git a/src/tests/amqp_imposter/tests/model/class_basic/test_many_unconfirmed.py b/src/tests/amqp_imposter/tests/model/class_basic/test_many_unconfirmed.py index 993d4960..905705b2 100644 --- a/src/tests/amqp_imposter/tests/model/class_basic/test_many_unconfirmed.py +++ b/src/tests/amqp_imposter/tests/model/class_basic/test_many_unconfirmed.py @@ -69,6 +69,15 @@ def test_number_of_confirms_in_bag() -> None: assert len(lookup_sendables(server, m.BasicAck)) == 2 * UNCONFIRMED assert len(lookup_sendables(server, m.BasicNack)) == 2 * UNCONFIRMED + publish_errors = lookup_sendables( + server, + m.ChannelClose, + class_id=m.BasicPublish.CLASS_ID, + method_id=m.BasicPublish.METHOD_ID, + ) + assert publish_errors + assert len(publish_errors) == len(set(publish_errors)) + def test_multiple_ack() -> None: server = unconfirmed(UNCONFIRMED) diff --git a/src/tests/amqp_imposter/tests/model/class_basic/test_publish.py b/src/tests/amqp_imposter/tests/model/class_basic/test_publish.py index b32ce2e1..b53edcae 100644 --- a/src/tests/amqp_imposter/tests/model/class_basic/test_publish.py +++ b/src/tests/amqp_imposter/tests/model/class_basic/test_publish.py @@ -15,12 +15,12 @@ import pytest -from amqp_imposter.model import Unrepresentable from amqp_imposter.model import domains as d from amqp_imposter.model import method_fields as mf from amqp_imposter.model import methods as m from ..helpers import ( + CONSUMER_TAG, EXCHANGE, QUEUE, ROUTING_KEY, @@ -35,6 +35,7 @@ error_replies_to, publish, receive_unwrap, + reopen_channel, send_unwrap, subsets_any_sendable, ) @@ -76,7 +77,9 @@ def test_publish_error_closes_channel() -> None: send_unwrap(server, m.ChannelClose, reply_code=mf.ReplyCode.NOT_FOUND) assert not subsets_any_sendable(server, m.BasicAck) - assert not isinstance(server.receive(m.ChannelCloseOk()), Unrepresentable) + + receive_unwrap(server, m.ChannelCloseOk()) + reopen_channel(server) @pytest.mark.parametrize( @@ -131,6 +134,16 @@ def test_return_discards_publish_error() -> None: assert not error_replies_to(server, m.BasicPublish) +def test_return_keeps_later_publish_error() -> None: + server = channelled() + + publish(server, mandatory=True) + publish(server) + send_unwrap(server, m.BasicReturn) + + assert error_replies_to(server, m.BasicPublish) + + def test_reply_discards_publish_error() -> None: server = channelled() @@ -144,6 +157,16 @@ def test_reply_discards_publish_error() -> None: assert not error_replies_to(server, m.BasicPublish) +def test_pending_reply_keeps_publish_error() -> None: + server = confirming() + + publish(server) + receive_unwrap(server, m.QueueDeclare(queue=QUEUE)) + publish(server) + + assert error_replies_to(server, m.BasicPublish) + + def test_delivery_keeps_publish_error() -> None: server = consuming() @@ -153,6 +176,22 @@ def test_delivery_keeps_publish_error() -> None: assert error_replies_to(server, m.BasicPublish) +def test_reconsumed_delivery_keeps_publish_error() -> None: + server = channelled() + consume = m.BasicConsume(queue=QUEUE, consumer_tag=CONSUMER_TAG, no_wait=True) + + receive_unwrap(server, consume) + publish(server) + receive_unwrap(server, m.BasicCancel(consumer_tag=CONSUMER_TAG, no_wait=True)) + receive_unwrap(server, consume) + delivered = server.send( + m.BasicDeliver(consumer_tag=CONSUMER_TAG, delivery_tag=d.LongLong(1)) + ) + + assert isinstance(delivered, m.BasicDeliver) + assert error_replies_to(server, m.BasicPublish) + + def test_publish_error_ordered() -> None: server = channelled() diff --git a/src/tests/amqp_imposter/tests/model/class_channel/test_channel.py b/src/tests/amqp_imposter/tests/model/class_channel/test_channel.py index 675cdf63..c024ab20 100644 --- a/src/tests/amqp_imposter/tests/model/class_channel/test_channel.py +++ b/src/tests/amqp_imposter/tests/model/class_channel/test_channel.py @@ -15,6 +15,7 @@ import pytest +from amqp_imposter.model import Unrepresentable from amqp_imposter.model import method_fields as mf from amqp_imposter.model import methods as m @@ -64,13 +65,26 @@ def test_reopen_open_channel_closes_connection() -> None: ) +def test_close_ok_on_open_channel_raises() -> None: + server = channelled() + + assert isinstance(server.receive(m.ChannelCloseOk()), Unrepresentable) + + @pytest.mark.parametrize("close", DO_CHANNEL_CLOSE, ids=lambda c: c.__name__) -def test_method_on_closed_channel_closes_connection(close: DoTeardown) -> None: +@pytest.mark.parametrize( + "method", + (m.ConfirmSelect(), m.ChannelCloseOk()), + ids=lambda method: type(method).__name__, +) +def test_method_on_closed_channel_closes_connection( + close: DoTeardown, method: m.Method +) -> None: server = channelled() close(server) - receive_unwrap(server, m.ConfirmSelect()) + receive_unwrap(server, method) - assert error_replies_to(server, m.ConfirmSelect) == connection_errors( + assert error_replies_to(server, type(method)) == connection_errors( mf.ReplyCode.CHANNEL_ERROR ) diff --git a/src/tests/amqp_imposter/tests/model/class_channel/test_teardown.py b/src/tests/amqp_imposter/tests/model/class_channel/test_teardown.py index 8135a742..cae27051 100644 --- a/src/tests/amqp_imposter/tests/model/class_channel/test_teardown.py +++ b/src/tests/amqp_imposter/tests/model/class_channel/test_teardown.py @@ -37,6 +37,7 @@ consuming, deliver, enable_channel_error, + error_replies_to, lookup_sendables, message_content, publish, @@ -80,6 +81,16 @@ def test_channel_close_destroys_confirms() -> None: assert not subsets_any_sendable(server, m.BasicNack) +def test_client_close_keeps_confirms() -> None: + server = confirming() + + publish(server, mandatory=True) + receive_unwrap(server, GRACEFUL_CHANNEL_CLOSE) + + assert subsets_any_sendable(server, m.BasicAck) + assert subsets_any_sendable(server, m.BasicReturn) + + def test_close_preempts_confirms() -> None: server = confirming() @@ -150,6 +161,18 @@ def test_channel_close_bags_close_ok() -> None: assert not subsets_any_sendable(server, m.ChannelClose) +def test_channel_close_during_forced_error_bags_close_ok() -> None: + # even if our error is forced, we still owe close-ok + server = channelled() + + enable_channel_error(server) + receive_unwrap(server, GRACEFUL_CHANNEL_CLOSE) + send_channel_error(server) + send_unwrap(server, m.ChannelCloseOk) + receive_unwrap(server, m.ChannelCloseOk()) + reopen_channel(server) + + def test_both_sides_close_channel_can_accept_close_ok() -> None: server = closing_channel_from_client_and_server() send_unwrap(server, m.ChannelCloseOk) @@ -173,13 +196,34 @@ def test_both_sides_close_channel_closes_owe_close_ok() -> None: def test_client_close_owes_close_ok(make_server: MakeServer) -> None: server = make_server() receive_unwrap(server, GRACEFUL_CHANNEL_CLOSE) + closing = server.sendables() receive_unwrap(server, GRACEFUL_CHANNEL_CLOSE) - assert not subsets_any_sendable(server, m.ChannelClose) + assert server.sendables() == closing assert isinstance(server.receive(m.ChannelCloseOk()), Unrepresentable) + +def test_client_close_answers_owed_replies() -> None: + server = consuming(prefetch_count=2) + + delivered = deliver(server, 1) + receive_unwrap(server, m.QueueDeclare(queue=QUEUE)) + receive_unwrap(server, GRACEFUL_CHANNEL_CLOSE) + + assert error_replies_to(server, m.QueueDeclare) + assert not subsets_any_sendable(server, m.ChannelCloseOk) + + late = deliver(server, 2) + send_unwrap(server, m.QueueDeclareOk) send_unwrap(server, m.ChannelCloseOk) reopen_channel(server) + consume(server) + + redeliveries = lookup_sendables(server, m.BasicDeliver, redelivered=True) + + assert {message_content(d) for d in redeliveries} == { + message_content(d) for d in (delivered, late) + } @pytest.mark.parametrize( diff --git a/src/tests/amqp_imposter/tests/model/class_connection/test_connection.py b/src/tests/amqp_imposter/tests/model/class_connection/test_connection.py index c261df96..80684926 100644 --- a/src/tests/amqp_imposter/tests/model/class_connection/test_connection.py +++ b/src/tests/amqp_imposter/tests/model/class_connection/test_connection.py @@ -19,6 +19,8 @@ ModelServer, Unrepresentable, ) +from amqp_imposter.model import domains as d +from amqp_imposter.model import method_fields as mf from amqp_imposter.model import methods as m from ..helpers import ( @@ -30,6 +32,7 @@ connected, greeted, lookup_unique_sendable, + opening, receive_unwrap, send_unwrap, start_ok_of, @@ -66,9 +69,17 @@ def test_open_and_close() -> None: def test_start_has_capabilities() -> None: start = lookup_unique_sendable(greeted(), m.ConnectionStart) - assert start.publisher_confirms - assert start.basic_nack - assert start.consumer_cancel_notify + assert start.server_properties == mf.Table( + { + d.ShortStr("capabilities"): mf.Table( + { + d.ShortStr("publisher_confirms"): True, + d.ShortStr("basic.nack"): True, + d.ShortStr("consumer_cancel_notify"): True, + } + ) + } + ) def test_start_is_alone_in_bag() -> None: @@ -100,6 +111,22 @@ def test_reopen_connection(close: DoTeardown) -> None: assert subsets_any_sendable(server, m.ConnectionStart) +@pytest.mark.parametrize( + "method", + ( + m.ConnectionStartOk(mechanism=d.ShortStr("PLAIN"), locale=d.ShortStr("en_US")), + m.ConnectionTuneOk(d.Short(2047), d.Long(131072), d.Short(0)), + m.ConnectionOpen(), + m.ConnectionCloseOk(), + ), + ids=lambda method: type(method).__name__, +) +def test_wrong_connection_method_for_handshake(method: m.Method) -> None: + server = opening() + + assert isinstance(server.receive(method), Unrepresentable) + + def test_simultaneous_connections_raise() -> None: server = connected() diff --git a/src/tests/amqp_imposter/tests/model/class_connection/test_handshake.py b/src/tests/amqp_imposter/tests/model/class_connection/test_handshake.py index 0361d910..1e159f84 100644 --- a/src/tests/amqp_imposter/tests/model/class_connection/test_handshake.py +++ b/src/tests/amqp_imposter/tests/model/class_connection/test_handshake.py @@ -15,10 +15,11 @@ from dataclasses import replace -import pytest - from amqp_imposter.model import ( + DEFAULT_NEGOTIATION_OPTIONS, + Capabilities, NegotiationOptions, + Tunables, Unrepresentable, constants, ) @@ -27,11 +28,15 @@ from amqp_imposter.model import methods as m from ..helpers import ( + channelled, connection_errors, + consume, + deliver, error_replies_to, greeted, lookup_unique_sendable, opening, + publish, receive_unwrap, send_unwrap, start_ok_of, @@ -44,12 +49,14 @@ NEGOTIATION_OPTIONS = NegotiationOptions( mechanisms=("EXTERNAL", "PLAIN"), locales=("en_GB",), - publisher_confirms=False, - basic_nack=False, - consumer_cancel_notify=False, - channel_max=d.Short(7), - frame_max=d.Long(constants.FRAME_MIN_FLOOR), - heartbeat=d.Short(60), + capabilities=Capabilities( + publisher_confirms=False, basic_nack=False, consumer_cancel_notify=False + ), + tunables=Tunables( + channel_max=d.Short(7), + frame_max=d.Long(constants.FRAME_MIN_FLOOR), + heartbeat=d.Short(60), + ), ) @@ -59,11 +66,19 @@ def test_start_with_options() -> None: assert start == m.ConnectionStart( version_major=constants.PROTOCOL_MAJOR, version_minor=constants.PROTOCOL_MINOR, + server_properties=mf.Table( + { + d.ShortStr("capabilities"): mf.Table( + { + d.ShortStr("publisher_confirms"): False, + d.ShortStr("basic.nack"): False, + d.ShortStr("consumer_cancel_notify"): False, + } + ) + } + ), mechanisms=NEGOTIATION_OPTIONS.mechanisms, locales=NEGOTIATION_OPTIONS.locales, - publisher_confirms=NEGOTIATION_OPTIONS.publisher_confirms, - basic_nack=NEGOTIATION_OPTIONS.basic_nack, - consumer_cancel_notify=NEGOTIATION_OPTIONS.consumer_cancel_notify, ) @@ -71,9 +86,9 @@ def test_tune_with_options() -> None: tune = lookup_unique_sendable(tuning(NEGOTIATION_OPTIONS), m.ConnectionTune) assert tune == m.ConnectionTune( - channel_max=NEGOTIATION_OPTIONS.channel_max, - frame_max=NEGOTIATION_OPTIONS.frame_max, - heartbeat=NEGOTIATION_OPTIONS.heartbeat, + channel_max=NEGOTIATION_OPTIONS.tunables.channel_max, + frame_max=NEGOTIATION_OPTIONS.tunables.frame_max, + heartbeat=NEGOTIATION_OPTIONS.tunables.heartbeat, ) @@ -107,36 +122,82 @@ def test_open_error_closes_connection() -> None: assert server.receive_protocol_header() is None -@pytest.mark.parametrize( - "mechanism", - ("whatever", ""), -) -def test_start_ok_contradicts_mechanism(mechanism: str) -> None: - # TODO edit once meaningful negotiation is implemented +def test_start_ok_contradicts_start() -> None: server = greeted(NEGOTIATION_OPTIONS) start_ok = start_ok_of(send_unwrap(server, m.ConnectionStart)) assert isinstance( - server.receive(replace(start_ok, mechanism=d.ShortStr(mechanism))), + server.receive(replace(start_ok, mechanism=d.ShortStr("whatever"))), Unrepresentable, ) - - -def test_start_ok_contradicts_locale() -> None: - # TODO edit once meaningful negotiation is implemented, we should remove this - server = greeted(NEGOTIATION_OPTIONS) - start_ok = start_ok_of(send_unwrap(server, m.ConnectionStart)) - + assert isinstance( + server.receive(replace(start_ok, mechanism=d.ShortStr(""))), Unrepresentable + ) assert isinstance( server.receive(replace(start_ok, locale=d.ShortStr("fr_FR"))), Unrepresentable ) -@pytest.mark.parametrize("name", ("channel_max", "frame_max", "heartbeat")) -def test_tune_ok_contradicts_tune(name: str) -> None: +def test_tune_ok_contradicts_tune() -> None: server = tuning(NEGOTIATION_OPTIONS) tune_ok = tune_ok_of(send_unwrap(server, m.ConnectionTune)) - value = getattr(tune_ok, name) - altered = replace(tune_ok, **{name: type(value)(value + 1)}) - assert isinstance(server.receive(altered), Unrepresentable) + assert isinstance( + server.receive(replace(tune_ok, channel_max=d.Short(8))), Unrepresentable + ) + assert isinstance( + server.receive(replace(tune_ok, frame_max=d.Long(0))), Unrepresentable + ) + assert isinstance( + server.receive( + replace(tune_ok, frame_max=d.Long(constants.FRAME_MIN_FLOOR - 1)) + ), + Unrepresentable, + ) + + +def test_tune_ok_negotiates() -> None: + unlimited = Tunables(d.Short(0), d.Long(0), d.Short(0)) + server = tuning(replace(DEFAULT_NEGOTIATION_OPTIONS, tunables=unlimited)) + send_unwrap(server, m.ConnectionTune) + + receive_unwrap(server, m.ConnectionTuneOk(d.Short(7), d.Long(8192), d.Short(60))) + receive_unwrap(server, m.ConnectionOpen()) + send_unwrap(server, m.ConnectionOpenOk) + + assert server.negotiated_tunables() == Tunables( + d.Short(7), d.Long(8192), d.Short(60) + ) + + +def test_capabilities_not_offered() -> None: + server = channelled(NEGOTIATION_OPTIONS) + consume(server) + deliver(server, delivery_tag=1) + + assert isinstance(server.receive(m.ConfirmSelect()), Unrepresentable) + assert isinstance( + server.receive(m.BasicNack(delivery_tag=d.LongLong(1))), Unrepresentable + ) + + +def test_capabilities_not_accepted() -> None: + server = greeted() + start = send_unwrap(server, m.ConnectionStart) + receive_unwrap(server, replace(start_ok_of(start), client_properties=mf.Table())) + receive_unwrap(server, tune_ok_of(send_unwrap(server, m.ConnectionTune))) + receive_unwrap(server, m.ConnectionOpen()) + send_unwrap(server, m.ConnectionOpenOk) + receive_unwrap(server, m.ChannelOpen()) + send_unwrap(server, m.ChannelOpenOk) + receive_unwrap(server, m.ConfirmSelect()) + send_unwrap(server, m.ConfirmSelectOk) + publish(server) + + assert not subsets_any_sendable(server, m.BasicNack) + + consume(server) + deliver(server, delivery_tag=1) + + assert not subsets_any_sendable(server, m.BasicCancel) + receive_unwrap(server, m.BasicNack(delivery_tag=d.LongLong(1))) diff --git a/src/tests/amqp_imposter/tests/model/class_connection/test_teardown.py b/src/tests/amqp_imposter/tests/model/class_connection/test_teardown.py index 24330519..23e876b3 100644 --- a/src/tests/amqp_imposter/tests/model/class_connection/test_teardown.py +++ b/src/tests/amqp_imposter/tests/model/class_connection/test_teardown.py @@ -21,10 +21,13 @@ from amqp_imposter.model import methods as m from ..helpers import ( + CHANNEL_CLOSING_STATES, CONNECTED_STATES, CONNECTING_STATES, DO_CONNECTION_CLOSE, GRACEFUL_CONNECTION_CLOSE, + GREETED_STATES, + QUEUE, DoTeardown, MakeServer, channelled, @@ -34,6 +37,8 @@ consume, consuming, deliver, + error_replies_to, + greeted, lookup_sendables, message_content, publish, @@ -96,6 +101,8 @@ def test_connection_close_requeues_unacked(close: DoTeardown) -> None: delivered = tuple(deliver(server, delivery_tag) for delivery_tag in (1, 2)) close(server) + assert server.receive_protocol_header() is None + server.receive_hard_disconnect() reconnect(server) consume(server) @@ -106,6 +113,26 @@ def test_connection_close_requeues_unacked(close: DoTeardown) -> None: } +@pytest.mark.parametrize( + "make_server", + ( + greeted, + *GREETED_STATES, + *CHANNEL_CLOSING_STATES, + closing_connection_from_client_and_server, + closed, + ), + ids=lambda b: b.__name__, +) +def test_hard_disconnect_owes_nothing(make_server: MakeServer) -> None: + server = make_server() + server.receive_hard_disconnect() + + assert server.sendables() == () + + reconnect(server) + + def test_received_methods_discarded_after_connection_close() -> None: server = channelled() @@ -144,6 +171,16 @@ def test_connection_close_destroys_everything() -> None: assert server.sendables() == () +def test_client_close_keeps_confirms() -> None: + server = confirming() + + publish(server, mandatory=True) + receive_unwrap(server, GRACEFUL_CONNECTION_CLOSE) + + assert subsets_any_sendable(server, m.BasicAck) + assert subsets_any_sendable(server, m.BasicReturn) + + def test_both_sides_close_connection_can_accept_close_ok() -> None: server = closing_connection_from_client_and_server() send_unwrap(server, m.ConnectionCloseOk) @@ -167,10 +204,37 @@ def test_both_sides_close_connection_owes_close_ok() -> None: def test_client_close_owes_close_ok(make_server: MakeServer) -> None: server = make_server() receive_unwrap(server, GRACEFUL_CONNECTION_CLOSE) + closing = server.sendables() receive_unwrap(server, GRACEFUL_CONNECTION_CLOSE) - assert not subsets_any_sendable(server, m.ConnectionClose) + assert server.sendables() == closing + assert not subsets_any_sendable( + server, + m.ConnectionClose, + class_id=mf.UNPROMPTED_CLASS_ID, + method_id=mf.UNPROMPTED_METHOD_ID, + ) assert isinstance(server.receive(m.ConnectionCloseOk()), Unrepresentable) + +def test_owed_replies_before_client_close() -> None: + server = consuming(prefetch_count=2) + + delivered = deliver(server, 1) + receive_unwrap(server, m.QueueDeclare(queue=QUEUE)) + receive_unwrap(server, GRACEFUL_CONNECTION_CLOSE) + + assert error_replies_to(server, m.QueueDeclare) + assert not subsets_any_sendable(server, m.ConnectionCloseOk) + + late = deliver(server, 2) + send_unwrap(server, m.QueueDeclareOk) send_unwrap(server, m.ConnectionCloseOk) reconnect(server) + consume(server) + + redeliveries = lookup_sendables(server, m.BasicDeliver, redelivered=True) + + assert {message_content(d) for d in redeliveries} == { + message_content(d) for d in (delivered, late) + } diff --git a/src/tests/amqp_imposter/tests/model/class_queue/test_declare.py b/src/tests/amqp_imposter/tests/model/class_queue/test_declare.py index c523935b..9dd87300 100644 --- a/src/tests/amqp_imposter/tests/model/class_queue/test_declare.py +++ b/src/tests/amqp_imposter/tests/model/class_queue/test_declare.py @@ -92,12 +92,27 @@ def test_bind_without_queue() -> None: assert subsets_any_sendable(server, m.QueueBindOk) +@pytest.mark.xfail(strict=True, reason="last declared queue is not tracked yet") +def test_bind_blank_queue_without_declare() -> None: + server = channelled() + + receive_unwrap(server, m.QueueBind(queue=d.ShortStr(""), exchange=EXCHANGE)) + + assert not subsets_any_sendable(server, m.QueueBindOk) + assert error_replies_to(server, m.QueueBind) == channel_errors( + mf.ReplyCode.NOT_FOUND + ) | connection_errors(mf.ReplyCode.SYNTAX_ERROR) + + def test_declare_anonymous_queue() -> None: server = channelled() receive_unwrap(server, m.QueueDeclare(queue=d.ShortStr(""))) + declare_ok = lookup_unique_sendable(server, m.QueueDeclareOk) - assert lookup_unique_sendable(server, m.QueueDeclareOk).queue + assert declare_ok.queue + # anonymously declared queues are always fresh + assert (declare_ok.message_count, declare_ok.consumer_count) == (0, 0) def test_no_declare_ok_if_nowait() -> None: diff --git a/src/tests/amqp_imposter/tests/model/class_queue/test_exclusive.py b/src/tests/amqp_imposter/tests/model/class_queue/test_exclusive.py new file mode 100644 index 00000000..829fdbdd --- /dev/null +++ b/src/tests/amqp_imposter/tests/model/class_queue/test_exclusive.py @@ -0,0 +1,238 @@ +# Copyright 2026 Bloomberg Finance L.P. +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from dataclasses import replace + +import pytest + +from amqp_imposter.model import ( + DEFAULT_NEGOTIATION_OPTIONS, + ModelServer, +) +from amqp_imposter.model import domains as d +from amqp_imposter.model import method_fields as mf +from amqp_imposter.model import methods as m + +from ..helpers import ( + CONSUMER_TAG, + DO_CANCEL, + DO_CHANNEL_CLOSE, + DO_CONNECTION_CLOSE, + EXCHANGE, + OTHER_QUEUE, + QUEUE, + QUEUE_ARGUMENTS, + DoTeardown, + channel_errors, + channelled, + consume, + error_replies_to, + get, + lookup_sendables, + lookup_unique_sendable, + receive_unwrap, + reconnect, + reopen_channel, + send_unwrap, + subsets_any_sendable, +) + + +def declare_exclusive(server: ModelServer) -> None: + receive_unwrap(server, m.QueueDeclare(queue=QUEUE, exclusive=True)) + send_unwrap(server, m.QueueDeclareOk) + + +@pytest.mark.xfail( + strict=True, + reason="counts are not yet derived for exclusive declarations", +) +def test_declare_new_exclusive_counts_zero() -> None: + server = channelled() + + receive_unwrap(server, m.QueueDeclare(queue=QUEUE, exclusive=True)) + declare_ok = lookup_unique_sendable(server, m.QueueDeclareOk) + + # only our own queue can satisfy an exclusive declare, and we haven't declared one yet + assert (declare_ok.message_count, declare_ok.consumer_count) == (0, 0) + + +def test_declare_new_exclusive_errors() -> None: + server = channelled() + + receive_unwrap(server, m.QueueDeclare(queue=QUEUE, exclusive=True)) + + assert channel_errors( + mf.ReplyCode.RESOURCE_LOCKED, mf.ReplyCode.PRECONDITION_FAILED + ) <= error_replies_to(server, m.QueueDeclare) + + +def test_redeclare_exclusive_message_count_is_arbitrary() -> None: + server = channelled() + + declare_exclusive(server) + receive_unwrap(server, m.QueueDeclare(queue=QUEUE, exclusive=True)) + + assert lookup_unique_sendable(server, m.QueueDeclareOk).message_count == mf.GEN_LONG + + +@pytest.mark.parametrize( + "redeclare", + ( + m.QueueDeclare(queue=QUEUE, exclusive=True, durable=True), + m.QueueDeclare(queue=QUEUE, exclusive=True, arguments=QUEUE_ARGUMENTS), + m.QueueDeclare(queue=QUEUE, exclusive=True, auto_delete=True), + m.QueueDeclare(queue=QUEUE), + ), + ids=("durable", "arguments", "auto_delete", "exclusive"), +) +def test_redeclare_exclusive_mismatch(redeclare: m.QueueDeclare) -> None: + server = channelled() + + declare_exclusive(server) + receive_unwrap(server, redeclare) + + # it may have been deleted and is then declared afresh + assert subsets_any_sendable(server, m.QueueDeclareOk) + assert channel_errors( + mf.ReplyCode.PRECONDITION_FAILED, mf.ReplyCode.RESOURCE_LOCKED + ) <= error_replies_to(server, m.QueueDeclare) + + +@pytest.mark.parametrize( + "method", + ( + m.QueueDeclare(queue=QUEUE, passive=True), + m.QueueBind(queue=QUEUE, exchange=EXCHANGE), + m.BasicConsume(queue=QUEUE, consumer_tag=CONSUMER_TAG), + m.BasicGet(queue=QUEUE), + ), + ids=lambda method: type(method).__name__, +) +def test_use_exclusive_errors(method: m.Method) -> None: + server = channelled() + + declare_exclusive(server) + receive_unwrap(server, method) + + # it may have been deleted, and the name taken by another connection + assert channel_errors( + mf.ReplyCode.NOT_FOUND, mf.ReplyCode.RESOURCE_LOCKED + ) <= error_replies_to(server, type(method)) + + +@pytest.mark.xfail( + strict=True, + reason="counts are not yet derived for exclusive declarations", +) +@pytest.mark.parametrize( + ("consumed", "consumer_count"), + ((QUEUE, 1), (OTHER_QUEUE, 0)), + ids=("same", "other"), +) +@pytest.mark.parametrize("cancel", DO_CANCEL, ids=lambda c: c.__name__) +def test_redeclare_exclusive_counts_consumer( + consumed: d.ShortStr, consumer_count: int, cancel: DoTeardown +) -> None: + server = channelled() + + declare_exclusive(server) + receive_unwrap(server, m.BasicConsume(queue=consumed, consumer_tag=CONSUMER_TAG)) + send_unwrap(server, m.BasicConsumeOk) + receive_unwrap(server, m.QueueDeclare(queue=QUEUE, exclusive=True)) + + assert ( + lookup_unique_sendable(server, m.QueueDeclareOk).consumer_count + == consumer_count + ) + + send_unwrap(server, m.QueueDeclareOk) + cancel(server) + receive_unwrap(server, m.QueueDeclare(queue=QUEUE, exclusive=True)) + + assert lookup_unique_sendable(server, m.QueueDeclareOk).consumer_count == 0 + + +@pytest.mark.xfail( + strict=True, + reason="counts are not yet derived for exclusive declarations", +) +def test_redeclare_exclusive_without_cancel_notify() -> None: + server = channelled( + replace( + DEFAULT_NEGOTIATION_OPTIONS, + capabilities=replace( + DEFAULT_NEGOTIATION_OPTIONS.capabilities, consumer_cancel_notify=False + ), + ) + ) + + declare_exclusive(server) + consume(server) + receive_unwrap(server, m.QueueDeclare(queue=QUEUE, exclusive=True)) + + # the queue may have been deleted, silently cancelling our consumer + assert { + declare_ok.consumer_count + for declare_ok in lookup_sendables(server, m.QueueDeclareOk) + } == {0, 1} + + +def test_exclusive_deliveries_are_arbitrary() -> None: + server = channelled() + + declare_exclusive(server) + get(server) + + assert subsets_any_sendable(server, m.BasicGetOk, redelivered=mf.GEN_BIT) + + send_unwrap(server, m.BasicGetEmpty) + consume(server) + + assert subsets_any_sendable(server, m.BasicDeliver, redelivered=mf.GEN_BIT) + + +@pytest.mark.xfail( + strict=True, + reason="counts are not yet derived for exclusive declarations", +) +@pytest.mark.parametrize("close", DO_CHANNEL_CLOSE, ids=lambda c: c.__name__) +def test_exclusive_survives_channel_close(close: DoTeardown) -> None: + server = channelled() + + declare_exclusive(server) + close(server) + reopen_channel(server) + receive_unwrap(server, m.QueueDeclare(queue=QUEUE, exclusive=True)) + declare_ok = lookup_unique_sendable(server, m.QueueDeclareOk) + + assert (declare_ok.message_count, declare_ok.consumer_count) == (mf.GEN_LONG, 0) + + +@pytest.mark.xfail( + strict=True, + reason="counts are not yet derived for exclusive declarations", +) +@pytest.mark.parametrize("close", DO_CONNECTION_CLOSE, ids=lambda c: c.__name__) +def test_exclusive_dies_with_connection(close: DoTeardown) -> None: + server = channelled() + + declare_exclusive(server) + close(server) + reconnect(server) + receive_unwrap(server, m.QueueDeclare(queue=QUEUE, exclusive=True)) + declare_ok = lookup_unique_sendable(server, m.QueueDeclareOk) + + assert (declare_ok.message_count, declare_ok.consumer_count) == (0, 0) diff --git a/src/tests/amqp_imposter/tests/model/generative/test_sampler.py b/src/tests/amqp_imposter/tests/model/generative/test_sampler.py index a1a4a77a..44375f1a 100644 --- a/src/tests/amqp_imposter/tests/model/generative/test_sampler.py +++ b/src/tests/amqp_imposter/tests/model/generative/test_sampler.py @@ -186,8 +186,8 @@ def test_selector_too_specific() -> None: sampler = msa.make_sampler(server.sendables(), (specific,), mw.STOP_WEIGHT) cancels = [ - (ws.selector, len(unified)) - for ws, unified in sampler.unified_by_weighted_selector + (ws.selector, len(matched)) + for ws, matched in sampler.matched_by_weighted_selector if isinstance(ws.selector, m.BasicCancel) ] assert cancels == [(specific.selector, 1)] @@ -213,7 +213,7 @@ def test_spurious_weighted_selector() -> None: sampler = msa.make_sampler(server.sendables(), spurious, mw.STOP_WEIGHT) - weights = [ws.weight for ws, _ in sampler.unified_by_weighted_selector] + weights = [ws.weight for ws, _ in sampler.matched_by_weighted_selector] assert WEIGHT not in weights diff --git a/src/tests/amqp_imposter/tests/model/helpers.py b/src/tests/amqp_imposter/tests/model/helpers.py index 7ba32bab..725fdca3 100644 --- a/src/tests/amqp_imposter/tests/model/helpers.py +++ b/src/tests/amqp_imposter/tests/model/helpers.py @@ -168,7 +168,9 @@ def start_ok_of(start: m.ConnectionStart) -> m.ConnectionStartOk: mechanisms = assert_concrete(start.mechanisms) locales = assert_concrete(start.locales) return m.ConnectionStartOk( - mechanism=d.ShortStr(mechanisms[0]), locale=d.ShortStr(locales[0]) + client_properties=assert_concrete(start.server_properties), + mechanism=d.ShortStr(mechanisms[0]), + locale=d.ShortStr(locales[0]), ) @@ -367,6 +369,14 @@ def closed() -> ModelServer: return server +def closing_connection_from_client() -> ModelServer: + server = consuming(prefetch_count=2) + deliver(server, 1) + receive_unwrap(server, m.QueueDeclare(queue=QUEUE)) + receive_unwrap(server, GRACEFUL_CONNECTION_CLOSE) + return server + + def closing_connection_from_client_and_server() -> ModelServer: server = channelled() send_unwrap(server, m.ConnectionClose, reply_code=mf.ReplyCode.CONNECTION_FORCED) @@ -382,7 +392,9 @@ def closing_channel_from_server() -> ModelServer: def closing_channel_from_client() -> ModelServer: - server = channelled() + server = consuming(prefetch_count=2) + deliver(server, 1) + receive_unwrap(server, m.QueueDeclare(queue=QUEUE)) receive_unwrap(server, GRACEFUL_CHANNEL_CLOSE) return server @@ -418,9 +430,10 @@ def reconnect(server: ModelServer) -> None: DO_CONNECTION_CLOSE: tuple[DoTeardown, ...] = ( close_connection_from_server, close_connection_from_client, + ModelServer.receive_hard_disconnect, ) -CONNECTING_STATES: tuple[MakeServer, ...] = (starting, tuning, tuned, opening) +CONNECTING_STATES: tuple[MakeServer, ...] = (starting, tuning, tuned) CHANNELLED_STATES: tuple[MakeServer, ...] = ( channelled, confirming, @@ -433,11 +446,22 @@ def reconnect(server: ModelServer) -> None: polling, polled, ) -CONNECTED_STATES: tuple[MakeServer, ...] = (connected, *CHANNELLED_STATES) -GREETED_STATES: tuple[MakeServer, ...] = CONNECTING_STATES + CONNECTED_STATES +CONNECTED_STATES: tuple[MakeServer, ...] = (opening, connected, *CHANNELLED_STATES) CHANNEL_CLOSING_STATES: tuple[MakeServer, ...] = ( closing_channel_from_server, closing_channel_from_client, closing_channel_from_client_and_server, ) + +CONNECTION_CLOSING_STATES: tuple[MakeServer, ...] = ( + closing_connection_from_client, + closing_connection_from_client_and_server, +) + +GREETED_STATES: tuple[MakeServer, ...] = ( + CONNECTING_STATES + + CONNECTED_STATES + + CHANNEL_CLOSING_STATES + + CONNECTION_CLOSING_STATES +) diff --git a/src/tests/amqp_imposter/tests/model/scenarios/test_pipelined_methods.py b/src/tests/amqp_imposter/tests/model/scenarios/test_pipelined_methods.py index 5280df9b..f3f142f6 100644 --- a/src/tests/amqp_imposter/tests/model/scenarios/test_pipelined_methods.py +++ b/src/tests/amqp_imposter/tests/model/scenarios/test_pipelined_methods.py @@ -21,6 +21,8 @@ from ..helpers import ( CONSUMER_TAG, EXCHANGE, + GRACEFUL_CHANNEL_CLOSE, + GRACEFUL_CONNECTION_CLOSE, QUEUE, ROUTING_KEY, channel_errors, @@ -36,6 +38,7 @@ lookup_unique_sendable, publish, receive_unwrap, + reopen_channel, send_unwrap, subsets_any_sendable, tuned, @@ -286,7 +289,8 @@ def test_send_nowait_error() -> None: send_unwrap(server, m.ChannelClose, reply_code=mf.ReplyCode.PRECONDITION_FAILED) # of course there's still ok even if the causing method was nowait - assert not isinstance(server.receive(m.ChannelCloseOk()), Unrepresentable) + receive_unwrap(server, m.ChannelCloseOk()) + reopen_channel(server) def test_pipelined_declare_after_channel_open() -> None: @@ -364,6 +368,33 @@ def test_nowait_declare_after_channel_open() -> None: def test_pipelined_channel_open_before_connection_open_ok() -> None: server = tuned() - receive_unwrap(server, m.ConnectionOpen(d.ShortStr("/"))) + receive_unwrap(server, m.ConnectionOpen()) + receive_unwrap(server, m.ChannelOpen()) + receive_unwrap(server, m.QueueDeclare(queue=QUEUE)) + + assert not subsets_any_sendable(server, m.ChannelOpenOk) + + send_unwrap(server, m.ConnectionOpenOk) + send_unwrap(server, m.ChannelOpenOk) + + assert subsets_any_sendable(server, m.QueueDeclareOk, queue=QUEUE) + + +def test_pipelined_open_and_close() -> None: + server = tuned() + + receive_unwrap(server, m.ConnectionOpen()) + receive_unwrap(server, m.ChannelOpen()) + receive_unwrap(server, GRACEFUL_CHANNEL_CLOSE) + receive_unwrap(server, GRACEFUL_CONNECTION_CLOSE) + + assert error_replies_to(server, m.ConnectionOpen) + assert not subsets_any_sendable(server, m.ChannelCloseOk) + assert not subsets_any_sendable(server, m.ConnectionCloseOk) + + send_unwrap(server, m.ConnectionOpenOk) + send_unwrap(server, m.ChannelOpenOk) + send_unwrap(server, m.ChannelCloseOk) + send_unwrap(server, m.ConnectionCloseOk) - assert isinstance(server.receive(m.ChannelOpen()), Unrepresentable) + assert server.sendables() == () diff --git a/src/tests/amqp_imposter/tests/model/scenarios/test_trace.py b/src/tests/amqp_imposter/tests/model/scenarios/test_trace.py index cdd2fafe..99b72f7f 100644 --- a/src/tests/amqp_imposter/tests/model/scenarios/test_trace.py +++ b/src/tests/amqp_imposter/tests/model/scenarios/test_trace.py @@ -13,7 +13,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -from amqp_imposter.model import ModelServer, NegotiationOptions +from dataclasses import replace + +from amqp_imposter.model import ( + DEFAULT_NEGOTIATION_OPTIONS, + ModelServer, + NegotiationOptions, +) from amqp_imposter.model import domains as d from amqp_imposter.model import methods as m @@ -34,7 +40,9 @@ PREFETCH_COUNT = 10 CHANNEL_MAX = d.Short(d.Short.MAX) -NEGOTIATION_OPTIONS = NegotiationOptions(channel_max=CHANNEL_MAX) +NEGOTIATION_OPTIONS = NegotiationOptions( + tunables=replace(DEFAULT_NEGOTIATION_OPTIONS.tunables, channel_max=CHANNEL_MAX) +) def traced_connect(server: ModelServer) -> None: diff --git a/src/tests/amqp_imposter/tests/model/test_revealing_line.py b/src/tests/amqp_imposter/tests/model/test_revealing_line.py index 94cba074..4c2fd06c 100644 --- a/src/tests/amqp_imposter/tests/model/test_revealing_line.py +++ b/src/tests/amqp_imposter/tests/model/test_revealing_line.py @@ -13,10 +13,13 @@ # See the License for the specific language governing permissions and # limitations under the License. +from operator import eq + from amqp_imposter.model.helpers.revealing_line import ( Opaque, RevealingLine, Transparent, + is_opaque, is_transparent, ) @@ -86,3 +89,41 @@ def test_split_while() -> None: front, back = line.split_while(is_transparent) assert tuple(revealed.item for revealed in front) == (1, 2) assert tuple(revealed.item for revealed in back) == (3, 4) + + +def test_push_coalescent() -> None: + line = ( + RevealingLine[int]() + .push(Transparent(1)) + .push(Opaque(2)) + .push(Transparent(1)) + .push(Transparent(3)) + .push_coalescent(1, eq) + ) + assert line.items() == (1, 2, 3, 1) + + _, after_3 = line.split(3) + assert after_3.observe() == (1,) + + +def test_push_coalescent_observes_same() -> None: + pushes = ( + Transparent(1), + Transparent(2), + Transparent(1), + Opaque(3), + Transparent(1), + Transparent(2), + Opaque(4), + Transparent(1), + Transparent(1), + ) + pushed = coalesced = RevealingLine[int]() + for revealed in pushes: + pushed = pushed.push(revealed) + coalesced = ( + coalesced.push(revealed) + if is_opaque(revealed) + else coalesced.push_coalescent(revealed.item, eq) + ) + assert set(pushed.observe()) == set(coalesced.observe()) diff --git a/src/tests/integration/rmqapitests/fuzz/consumer_fuzztests.py b/src/tests/integration/rmqapitests/fuzz/consumer_fuzztests.py index c866826d..d850d051 100644 --- a/src/tests/integration/rmqapitests/fuzz/consumer_fuzztests.py +++ b/src/tests/integration/rmqapitests/fuzz/consumer_fuzztests.py @@ -35,7 +35,7 @@ check_consumer_recovers_within, check_consumes, check_delivery_count, - check_expected_requeue, + check_expected_settlements, check_qos_before_consuming, ) from .prop_general import ( @@ -109,15 +109,22 @@ def consumer_args(consumer: ConsumerScenario) -> tuple[str, ...]: def consumer_properties( consumer: ConsumerScenario, *, minimum_acks: int ) -> tuple[Property, ...]: - exchange_declare = pb.ExchangeDeclare( - exchange=consumer.exchange, exchange_type="direct", durable=True + exchange_declare = pb.ExchangeDeclarePattern( + exchange=consumer.exchange, + exchange_type="direct", + durable=True, + auto_delete=False, + internal=False, + arguments=pb.AmqpTable(), ) - queue_declare = pb.QueueDeclare( + queue_declare = pb.QueueDeclarePattern( queue=consumer.queue, durable=not consumer.auto_delete, + exclusive=False, auto_delete=consumer.auto_delete, + arguments=pb.AmqpTable(), ) - queue_bind = pb.QueueBind( + queue_bind = pb.QueueBindPattern( queue=consumer.queue, exchange=consumer.exchange, routing_key=consumer.routing_key, @@ -126,15 +133,12 @@ def consumer_properties( check_protocol_legal, check_connections_closed, check_stays_stopped, + check_expected_settlements, partial(check_qos_before_consuming, prefetch_count=consumer.prefetch_count), partial(check_consumes, queue=consumer.queue, priority=consumer.priority), partial(check_delivery_count, messages=consumer.messages), partial(check_ack_count, minimum=minimum_acks, maximum=consumer.messages), partial(check_consumer_recovers_within, messages=consumer.messages), - partial( - check_expected_requeue, - requeue=True, # TODO could try to vary this via perftest - ), partial( check_declarations_before_work, required=(exchange_declare, queue_declare, queue_bind), diff --git a/src/tests/integration/rmqapitests/fuzz/producer_fuzztests.py b/src/tests/integration/rmqapitests/fuzz/producer_fuzztests.py index 7094e5ba..f9186bc8 100644 --- a/src/tests/integration/rmqapitests/fuzz/producer_fuzztests.py +++ b/src/tests/integration/rmqapitests/fuzz/producer_fuzztests.py @@ -107,13 +107,20 @@ def producer_args(producer: ProducerScenario) -> tuple[str, ...]: def producer_properties(producer: ProducerScenario) -> tuple[Property, ...]: - exchange_declare = pb.ExchangeDeclare( - exchange=producer.exchange, exchange_type="direct", durable=True + exchange_declare = pb.ExchangeDeclarePattern( + exchange=producer.exchange, + exchange_type="direct", + durable=True, + auto_delete=False, + internal=False, + arguments=pb.AmqpTable(), ) - queue_declare = pb.QueueDeclare( + queue_declare = pb.QueueDeclarePattern( queue=producer.queue, durable=not producer.auto_delete, + exclusive=False, auto_delete=producer.auto_delete, + arguments=pb.AmqpTable(), ) return ( check_protocol_legal, @@ -196,13 +203,13 @@ def test_producer_with_returns(seed: int, imposter: AmqpImposter) -> None: # GIVEN producer = producer_scenario(seed) script = ( - when_receive(pb.BasicPublishPattern(), then_send=pb.BasicReturnPattern()), + when_receive( + pb.BasicPublishPattern(), + then_send=pb.BasicReturnPattern(), + ), ) weights = ( - weighted( - pb.BasicAckSelector(), - pb.BASE_WEIGHT // 2, - ), + weighted(pb.BasicAckSelector(), pb.BASE_WEIGHT // 2), weighted( pb.ConnectionCloseSelector(class_id=0, method_id=0), pb.BASE_WEIGHT // 20, diff --git a/src/tests/integration/rmqapitests/fuzz/prop_consumer.py b/src/tests/integration/rmqapitests/fuzz/prop_consumer.py index 1e321153..93fe5ca9 100644 --- a/src/tests/integration/rmqapitests/fuzz/prop_consumer.py +++ b/src/tests/integration/rmqapitests/fuzz/prop_consumer.py @@ -18,64 +18,105 @@ from collections.abc import Iterator -from amqp_imposter.control.client import Transcript, pb -from amqp_imposter.control.client.transcript_util import ( - format_line_name, - format_proto_message, +from amqp_imposter.control.client import ( + Transcript, + format_method, + pattern_matches, + pb, ) from .prop_general import ( PropertyViolation, + Settlement, check_recovers_within, client_stop_index, event_and_method, - matches_event_method, - settled_tags, + is_channel_invalidated, + tags_settled_by, ) from .runner import ImposterCapture +type SettlementPattern = ( + pb.BasicAckPattern | pb.BasicNackPattern | pb.BasicRejectPattern +) + + +def expected_settlements(deliver: pb.BasicDeliver) -> tuple[SettlementPattern, ...]: + return ( + pb.BasicAckPattern(), + pb.BasicNackPattern(requeue=True), + pb.BasicRejectPattern(requeue=True), + ) + + +def is_expected_settlement(deliver: pb.BasicDeliver, settlement: Settlement) -> bool: + return any( + pattern_matches(pattern, settlement) + for pattern in expected_settlements(deliver) + ) -def delivery_ack_indices(transcript: Transcript) -> Iterator[int]: - unsettled: frozenset[int] = frozenset() + +def list_delivery_settlements( + transcript: Transcript, +) -> Iterator[tuple[pb.BasicDeliver, Settlement, pb.TranscriptLine]]: + unsettled: dict[int, pb.BasicDeliver] = {} + highest_settled_tag = 0 for line in transcript: match event_and_method(line): - case (pb.TRANSCRIPT_EVENT_METHOD_INGRESS, pb.ChannelOpen()) | ( - pb.TRANSCRIPT_EVENT_METHOD_INGRESS | pb.TRANSCRIPT_EVENT_METHOD_EGRESS, - pb.ChannelClose() | pb.ConnectionClose(), - ): - unsettled = frozenset() - case (pb.TRANSCRIPT_EVENT_METHOD_EGRESS, pb.BasicDeliver(delivery_tag=tag)): - unsettled |= {tag} + case (pb.TRANSCRIPT_EVENT_METHOD_EGRESS, pb.BasicDeliver() as deliver): + unsettled[deliver.delivery_tag] = deliver case ( pb.TRANSCRIPT_EVENT_METHOD_INGRESS, - pb.BasicAck(delivery_tag=tag, multiple=multiple), + pb.BasicAck() | pb.BasicNack() | pb.BasicReject() as settlement, ): - acked = settled_tags(unsettled, tag, multiple) - yield from [line.index] * len(acked) - unsettled -= acked + settled = tags_settled_by(frozenset(unsettled), settlement) + highest_settled_tag = max((highest_settled_tag, *settled)) + for tag in sorted(settled): + yield unsettled.pop(tag), settlement, line case ( pb.TRANSCRIPT_EVENT_METHOD_INGRESS, - pb.BasicNack(delivery_tag=tag, multiple=multiple), + pb.ChannelClose() | pb.ConnectionClose(), ): - unsettled -= settled_tags(unsettled, tag, multiple) - case (pb.TRANSCRIPT_EVENT_METHOD_INGRESS, pb.BasicReject(delivery_tag=tag)): - unsettled -= {tag} + for tag in sorted(unsettled): + if tag <= highest_settled_tag: + requeue = pb.BasicReject(delivery_tag=tag, requeue=True) + yield unsettled[tag], requeue, line + if is_channel_invalidated(line): + unsettled = {} + highest_settled_tag = 0 -def check_expected_requeue( - capture: ImposterCapture, requeue: bool -) -> PropertyViolation | None: - for line in capture.transcript: + +def list_delivery_ack_indices(transcript: Transcript) -> Iterator[int]: + return ( + line.index + for _, settlement, line in list_delivery_settlements(transcript) + if isinstance(settlement, pb.BasicAck) + ) + + +def filter_delivery_indices_by_settlement( + transcript: Transcript, settlement: Settlement +) -> Iterator[int]: + for line in transcript: match event_and_method(line): case ( - pb.TRANSCRIPT_EVENT_METHOD_INGRESS, - (pb.BasicNack() | pb.BasicReject()) as method, - ) if method.requeue != requeue: - return PropertyViolation( - f"{format_line_name(line)} with requeue={method.requeue}", - line.index, - ) + pb.TRANSCRIPT_EVENT_METHOD_EGRESS, + pb.BasicDeliver() as deliver, + ) if is_expected_settlement(deliver, settlement): + yield line.index + + +def check_expected_settlements(capture: ImposterCapture) -> PropertyViolation | None: + for deliver, settlement, line in list_delivery_settlements(capture.transcript): + if not is_expected_settlement(deliver, settlement): + return PropertyViolation( + f"Settled delivery_tag={deliver.delivery_tag} " + f"as {format_method(settlement)!r}: " + f"expected one of {list(map(format_method, expected_settlements(deliver)))}", + line.index, + ) return None @@ -94,7 +135,7 @@ def check_consumes( ) != expected: # TODO we could generalise this check if we expose more in perftest return PropertyViolation( - f"Consumed {format_proto_message(consume)!r}: " + f"Consumed with {format_method(consume)!r}: " f"expected queue={queue!r}, no_ack=false, x-priority={priority}", line.index, ) @@ -118,7 +159,7 @@ def check_qos_before_consuming( prior_qos != expected_qos ): return PropertyViolation( - f"Missed QoS before consuming: {format_proto_message(expected_qos)!r}", + f"Missed {format_method(expected_qos)!r} before consuming", line.index, ) @@ -128,14 +169,15 @@ def check_qos_before_consuming( def check_delivery_count( capture: ImposterCapture, messages: int ) -> PropertyViolation | None: - deliveries = sum( - matches_event_method(line, pb.TRANSCRIPT_EVENT_METHOD_EGRESS, pb.BasicDeliver) - for line in capture.transcript + deliveries = len( + tuple(filter_delivery_indices_by_settlement(capture.transcript, pb.BasicAck())) ) if deliveries < messages: return PropertyViolation( - f"Got {deliveries} deliveries: expected >={messages}", None + f"Got {deliveries} deliveries expecting {format_method(pb.BasicAck())!r}: " + f"expected >={messages}", + None, ) return None @@ -144,7 +186,7 @@ def check_delivery_count( def check_ack_count( capture: ImposterCapture, minimum: int, maximum: int ) -> PropertyViolation | None: - ack_indices = tuple(delivery_ack_indices(capture.transcript)) + ack_indices = tuple(list_delivery_ack_indices(capture.transcript)) if len(ack_indices) < minimum: return PropertyViolation( @@ -162,12 +204,9 @@ def check_ack_count( def check_consumer_recovers_within( capture: ImposterCapture, messages: int ) -> PropertyViolation | None: - delivery_indices = ( - line.index - for line in capture.transcript - if matches_event_method( - line, pb.TRANSCRIPT_EVENT_METHOD_EGRESS, pb.BasicDeliver - ) + i_stop = client_stop_index( + capture.transcript, + filter_delivery_indices_by_settlement(capture.transcript, pb.BasicAck()), + messages, ) - i_stop = client_stop_index(capture.transcript, delivery_indices, messages) return check_recovers_within(capture.transcript, i_stop) diff --git a/src/tests/integration/rmqapitests/fuzz/prop_general.py b/src/tests/integration/rmqapitests/fuzz/prop_general.py index adf2446e..34999105 100644 --- a/src/tests/integration/rmqapitests/fuzz/prop_general.py +++ b/src/tests/integration/rmqapitests/fuzz/prop_general.py @@ -17,23 +17,24 @@ from __future__ import annotations from collections import defaultdict -from collections.abc import Callable, Iterable, Iterator -from copy import deepcopy +from collections.abc import Callable, Iterable, Iterator, Sequence from dataclasses import dataclass from itertools import islice import pytest from amqp_imposter.control.client import ( FORCED_REPLY_TEXT, + ConcreteMethod, Transcript, + format_method, format_transcript_around, + pattern_matches, pb, transcript_line_method, ) from amqp_imposter.control.client.transcript_util import ( format_line_name, ) -from google.protobuf.message import Message from .runner import ImposterCapture @@ -46,21 +47,29 @@ class PropertyViolation: type Property = Callable[[ImposterCapture], PropertyViolation | None] +type DeclarationPattern = pb.ExchangeDeclarePattern | pb.QueueDeclarePattern + +type TopologyPattern = DeclarationPattern | pb.QueueBindPattern + +type Settlement = pb.BasicAck | pb.BasicNack | pb.BasicReject + # N.b. the imposter supports one channel # If that changes, change to track by channel number, e.g. return it here def event_and_method( line: pb.TranscriptLine, -) -> tuple[pb.TranscriptEvent.ValueType, Message] | None: - if (method := transcript_line_method(line)) is not None: - return line.event, method - return None +) -> tuple[pb.TranscriptEvent.ValueType, ConcreteMethod] | None: + match transcript_line_method(line): + case None: + return None + case method: + return (line.event, method) def matches_event_method( line: pb.TranscriptLine, event: pb.TranscriptEvent.ValueType, - *methods: type[Message], + *methods: type[ConcreteMethod], ) -> bool: match event_and_method(line): case (line_event, method): @@ -69,14 +78,84 @@ def matches_event_method( return False -def settled_tags( - unsettled: frozenset[int], delivery_tag: int, multiple: bool -) -> frozenset[int]: - if multiple: - return frozenset( - tag for tag in unsettled if delivery_tag == 0 or tag <= delivery_tag +def is_channel_invalidated(line: pb.TranscriptLine) -> bool: + return ( + line.event in (pb.TRANSCRIPT_EVENT_TCP_CONNECTED, pb.TRANSCRIPT_EVENT_TCP_DOWN) + or matches_event_method( + line, + pb.TRANSCRIPT_EVENT_METHOD_INGRESS, + pb.ChannelOpen, + pb.ChannelClose, + pb.ConnectionClose, ) - return unsettled & {delivery_tag} + or matches_event_method( + line, pb.TRANSCRIPT_EVENT_METHOD_EGRESS, pb.ChannelClose, pb.ConnectionClose + ) + ) + + +def tags_settled_by( + unsettled: frozenset[int], settlement: Settlement +) -> frozenset[int]: + match settlement: + case ( + pb.BasicAck(delivery_tag=delivery_tag, multiple=True) + | pb.BasicNack(delivery_tag=delivery_tag, multiple=True) + ): + return frozenset( + tag for tag in unsettled if delivery_tag == 0 or tag <= delivery_tag + ) + case ( + pb.BasicAck(delivery_tag=delivery_tag) + | pb.BasicNack(delivery_tag=delivery_tag) + | pb.BasicReject(delivery_tag=delivery_tag) + ): + return unsettled & {delivery_tag} + + +def list_client_shutdowns(transcript: Transcript) -> Iterator[pb.TranscriptLine]: + # track methods to be ignored as they are continuations of the shutdown sequence + # so we shouldn't mistake them as having initiated it! + to_ignore: frozenset[type[ConcreteMethod]] = frozenset() + + for line in transcript: + match event_and_method(line): + case (pb.TRANSCRIPT_EVENT_METHOD_EGRESS, pb.BasicCancel()): + to_ignore |= {pb.ChannelClose, pb.ConnectionClose} + case (pb.TRANSCRIPT_EVENT_METHOD_EGRESS, pb.ChannelClose()): + to_ignore |= {pb.ConnectionClose} + case ( + pb.TRANSCRIPT_EVENT_METHOD_INGRESS, + pb.ChannelOpen() | pb.BasicConsume(), + ): + to_ignore = frozenset() + case ( + pb.TRANSCRIPT_EVENT_METHOD_INGRESS, + pb.ChannelClose() | pb.ConnectionClose() as close, + ) if type(close) in to_ignore: + to_ignore -= {type(close)} + case ( + pb.TRANSCRIPT_EVENT_METHOD_INGRESS, + pb.BasicCancel() | pb.ChannelClose() | pb.ConnectionClose(), + ): + yield line + + +def list_client_shutdown_indices(transcript: Transcript) -> Iterator[int]: + return (line.index for line in list_client_shutdowns(transcript)) + + +def first_client_shutdown_index( + transcript: Transcript, *methods: type[ConcreteMethod] +) -> int | None: + return next( + ( + line.index + for line in list_client_shutdowns(transcript) + if matches_event_method(line, pb.TRANSCRIPT_EVENT_METHOD_INGRESS, *methods) + ), + None, + ) def check_protocol_legal(capture: ImposterCapture) -> PropertyViolation | None: @@ -84,12 +163,12 @@ def check_protocol_legal(capture: ImposterCapture) -> PropertyViolation | None: match line.event: case pb.TRANSCRIPT_EVENT_METHOD_UNREPRESENTABLE: return PropertyViolation( - f"Imposter refused to continue after: {format_line_name(line)}, {line.detail}", + f"Imposter reached unrepresentable server state: {format_line_name(line)}, {line.detail}", line.index, ) case pb.TRANSCRIPT_EVENT_TCP_REJECTED: return PropertyViolation( - f"Imposter rejected connection: {line.detail}", line.index + f"Imposter rejected TCP connection: {line.detail}", line.index ) case pb.TRANSCRIPT_EVENT_FRAME_MALFORMED: return PropertyViolation(f"Malformed frame: {line.detail}", line.index) @@ -106,24 +185,10 @@ def check_protocol_legal(capture: ImposterCapture) -> PropertyViolation | None: return None -type TopologyMethod = pb.ExchangeDeclare | pb.QueueDeclare | pb.QueueBind - - -def topology_name(method: TopologyMethod) -> tuple[str, ...]: - match method: - case pb.ExchangeDeclare(exchange=exchange): - return ("exchange", exchange) - case pb.QueueDeclare(queue=queue): - return ("queue", queue) - case pb.QueueBind(queue=queue, exchange=exchange, routing_key=routing_key): - return ("binding", queue, exchange, routing_key) - - def check_declarations_before_work( - capture: ImposterCapture, required: Iterable[TopologyMethod] + capture: ImposterCapture, required: Sequence[TopologyPattern] ) -> PropertyViolation | None: - required_names = set(map(topology_name, required)) - declared_names: set[tuple[str, ...]] = set() + declared: list[ConcreteMethod] = [] for line in capture.transcript: match event_and_method(line): @@ -131,127 +196,55 @@ def check_declarations_before_work( pb.TRANSCRIPT_EVENT_METHOD_EGRESS, pb.BasicCancel(), ): - declared_names = set() + declared = [] case ( pb.TRANSCRIPT_EVENT_METHOD_INGRESS, - pb.ExchangeDeclare() | pb.QueueDeclare() | pb.QueueBind() as method, + pb.ExchangeDeclare() | pb.QueueDeclare() | pb.QueueBind() as declare, ): - declared_names.add(topology_name(method)) + declared.append(declare) case ( pb.TRANSCRIPT_EVENT_METHOD_INGRESS, pb.BasicConsume() | pb.BasicPublish(), - ) if missing := required_names - declared_names: + ) if missing := [ + pattern + for pattern in required + if not any(pattern_matches(pattern, method) for method in declared) + ]: return PropertyViolation( - f"Missed topology declarations before {format_line_name(line)}: " - f"{', '.join(sorted(map(repr, missing)))}", + f"Missed declarations before {format_line_name(line)}: " + f"{list(map(format_method, missing))}", line.index, ) return None -def declaration_identity( - declare: pb.ExchangeDeclare | pb.QueueDeclare, -) -> pb.ExchangeDeclare | pb.QueueDeclare: - identity = deepcopy(declare) - identity.ClearField("passive") - identity.ClearField("no_wait") - if not identity.arguments.entries: - identity.ClearField("arguments") - - return identity - - -def field_mismatches(actual: Message, expected: Message) -> list[str]: - return [ - f"{field.name}={getattr(actual, field.name)!r}, " - f"expected {getattr(expected, field.name)!r}" - for field in actual.DESCRIPTOR.fields - if getattr(actual, field.name) != getattr(expected, field.name) - ] - - def check_expected_declarations( - capture: ImposterCapture, expected: Iterable[pb.ExchangeDeclare | pb.QueueDeclare] + capture: ImposterCapture, expected: Sequence[DeclarationPattern] ) -> PropertyViolation | None: - expected_by_name = { - topology_name(declare): declaration_identity(declare) for declare in expected - } - for line in capture.transcript: match event_and_method(line): case ( pb.TRANSCRIPT_EVENT_METHOD_INGRESS, pb.ExchangeDeclare(passive=False) | pb.QueueDeclare(passive=False) as declare, - ): - name = topology_name(declare) - identity = declaration_identity(declare) - match expected_by_name.get(name): - case None: - return PropertyViolation( - f"Unexpected declaration of {name}", line.index - ) - case expected_identity if identity != expected_identity: - return PropertyViolation( - f"Declared {name} with " - f"{'; '.join(field_mismatches(identity, expected_identity))}", - line.index, - ) + ) if not any(pattern_matches(pattern, declare) for pattern in expected): + return PropertyViolation( + f"Declared {format_method(declare)!r}: " + f"expected one of {list(map(format_method, expected))}", + line.index, + ) return None -def client_shutdowns(transcript: Transcript) -> Iterator[pb.TranscriptLine]: - # track methods to be ignored as they are continuations of the shutdown sequence - # so we shouldn't mistake them as having initiated it! - to_ignore: frozenset[type[Message]] = frozenset() - - for line in transcript: - match event_and_method(line): - case (pb.TRANSCRIPT_EVENT_METHOD_EGRESS, pb.BasicCancel()): - to_ignore |= {pb.ChannelClose, pb.ConnectionClose} - case (pb.TRANSCRIPT_EVENT_METHOD_EGRESS, pb.ChannelClose()): - to_ignore |= {pb.ConnectionClose} - case ( - pb.TRANSCRIPT_EVENT_METHOD_INGRESS, - pb.ChannelOpen() | pb.BasicConsume(), - ): - to_ignore = frozenset() - case ( - pb.TRANSCRIPT_EVENT_METHOD_INGRESS, - pb.ChannelClose() | pb.ConnectionClose() as close, - ) if type(close) in to_ignore: - to_ignore -= {type(close)} - case ( - pb.TRANSCRIPT_EVENT_METHOD_INGRESS, - pb.BasicCancel() | pb.ChannelClose() | pb.ConnectionClose(), - ): - yield line - - -def client_shutdown_indices(transcript: Transcript) -> Iterator[int]: - return (line.index for line in client_shutdowns(transcript)) - - -def first_client_shutdown_index( - transcript: Transcript, *methods: type[Message] -) -> int | None: - return next( - ( - line.index - for line in client_shutdowns(transcript) - if matches_event_method(line, pb.TRANSCRIPT_EVENT_METHOD_INGRESS, *methods) - ), - None, - ) - - def client_stop_index( transcript: Transcript, completion_indices: Iterable[int], messages: int ) -> int | None: final_completion = islice(completion_indices, messages - 1, messages) - return min((*final_completion, *client_shutdown_indices(transcript)), default=None) + return min( + (*final_completion, *list_client_shutdown_indices(transcript)), default=None + ) def check_stays_stopped(capture: ImposterCapture) -> PropertyViolation | None: diff --git a/src/tests/integration/rmqapitests/fuzz/prop_producer.py b/src/tests/integration/rmqapitests/fuzz/prop_producer.py index c5635550..c0f034a6 100644 --- a/src/tests/integration/rmqapitests/fuzz/prop_producer.py +++ b/src/tests/integration/rmqapitests/fuzz/prop_producer.py @@ -19,35 +19,23 @@ from collections.abc import Iterator from itertools import islice -from amqp_imposter.control.client import Transcript, pb +from amqp_imposter.control.client import ( + Transcript, + format_method, + pb, +) from .prop_general import ( PropertyViolation, check_recovers_within, client_stop_index, event_and_method, - matches_event_method, - settled_tags, + is_channel_invalidated, + tags_settled_by, ) from .runner import ImposterCapture -def ends_channel(line: pb.TranscriptLine) -> bool: - return ( - line.event in (pb.TRANSCRIPT_EVENT_TCP_CONNECTED, pb.TRANSCRIPT_EVENT_TCP_DOWN) - or matches_event_method( - line, - pb.TRANSCRIPT_EVENT_METHOD_INGRESS, - pb.ChannelOpen, - pb.ChannelClose, - pb.ConnectionClose, - ) - or matches_event_method( - line, pb.TRANSCRIPT_EVENT_METHOD_EGRESS, pb.ChannelClose, pb.ConnectionClose - ) - ) - - def settled_publishes_by_line( transcript: Transcript, ) -> Iterator[tuple[pb.TranscriptLine, list[bytes]]]: @@ -55,7 +43,7 @@ def settled_publishes_by_line( next_delivery_tag: int | None = None for line in transcript: - if ends_channel(line): + if is_channel_invalidated(line): unconfirmed_publishes = {} next_delivery_tag = None @@ -80,11 +68,7 @@ def settled_publishes_by_line( settled_publishes = [ unconfirmed_publishes.pop(tag) for tag in sorted( - settled_tags( - frozenset(unconfirmed_publishes), - confirm.delivery_tag, - confirm.multiple, - ) + tags_settled_by(frozenset(unconfirmed_publishes), confirm) ) ] @@ -106,7 +90,8 @@ def check_confirm_select_before_publishing( not confirming ): return PropertyViolation( - "Missed Confirm.Select before publishing", line.index + f"Missed {format_method(pb.ConfirmSelect())!r} before publishing", + line.index, ) return None @@ -150,7 +135,7 @@ def check_max_unconfirmed( n_unconfirmed = 0 for line, settled_publish in settled_publishes_by_line(capture.transcript): - if ends_channel(line): + if is_channel_invalidated(line): n_unconfirmed = 0 match event_and_method(line): diff --git a/src/tests/integration/rmqapitests/fuzz/runner.py b/src/tests/integration/rmqapitests/fuzz/runner.py index f5dae139..61db0174 100644 --- a/src/tests/integration/rmqapitests/fuzz/runner.py +++ b/src/tests/integration/rmqapitests/fuzz/runner.py @@ -26,16 +26,15 @@ from amqp_imposter.control.client import AmqpImposter, Transcript, pb IMMEDIATE_RETRY = os.environ.get("RMQAPITESTS_IMMEDIATE_RETRY") == "1" -CLIENT_TIMEOUT = 300.0 SEED_OFFSET = int(os.environ.get("FUZZ_SEED_OFFSET", "0")) SEEDS = range(SEED_OFFSET, SEED_OFFSET + int(os.environ.get("FUZZ_SEED_COUNT", "1000"))) VHOST = "fuzz" - -# TODO amqp_imposter adhere to negotiated parameters NEGOTIATION_OPTIONS = pb.NegotiationOptions(heartbeat=60) +CLIENT_TIMEOUT = 300.0 + @dataclass(frozen=True, slots=True) class ImposterCapture: