|
| 1 | +# Copyright 2025 Bloomberg Finance L.P. |
| 2 | +# SPDX-License-Identifier: Apache-2.0 |
| 3 | +# |
| 4 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +# you may not use this file except in compliance with the License. |
| 6 | +# You may obtain a copy of the License at |
| 7 | +# |
| 8 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# |
| 10 | +# Unless required by applicable law or agreed to in writing, software |
| 11 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +# See the License for the specific language governing permissions and |
| 14 | +# limitations under the License. |
| 15 | + |
| 16 | +""" |
| 17 | +Testing migrating to CSL. |
| 18 | +""" |
| 19 | +import blazingmq.dev.it.testconstants as tc |
| 20 | +from blazingmq.dev.it.fixtures import ( # pylint: disable=unused-import |
| 21 | + Cluster, |
| 22 | + multi_node, |
| 23 | +) |
| 24 | + |
| 25 | + |
| 26 | +def test_assign_queue(multi_node: Cluster): |
| 27 | + """ |
| 28 | + This test is to make sure when a queue assignment happens, |
| 29 | + it goes thought the CSL path, not the non-CSL. |
| 30 | + """ |
| 31 | + proxies = multi_node.proxy_cycle() |
| 32 | + proxy = next(proxies) |
| 33 | + |
| 34 | + leader = multi_node.last_known_leader |
| 35 | + members = multi_node.nodes(exclude=leader) |
| 36 | + |
| 37 | + uri = tc.URI_PRIORITY_SC |
| 38 | + |
| 39 | + producer = proxy.create_client("producer") |
| 40 | + producer.open(uri, flags=["write"], succeed=True) |
| 41 | + |
| 42 | + timeout = 1 |
| 43 | + |
| 44 | + for member in members: |
| 45 | + assert member.outputs_regex( |
| 46 | + "(Applying cluster message with type = UPDATE).*(queueAssignmentAdvisory)", |
| 47 | + timeout, |
| 48 | + ) |
| 49 | + assert member.outputs_regex( |
| 50 | + "(Committed advisory).*queueAssignmentAdvisory", timeout |
| 51 | + ) |
| 52 | + assert not member.outputs_regex( |
| 53 | + "'QueueUnAssignmentAdvisory' will be applied to", timeout |
| 54 | + ) |
0 commit comments