-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Jean-Louis Leroy <[email protected]>
- Loading branch information
Showing
17 changed files
with
2,105 additions
and
2,183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,57 @@ | ||
""" | ||
Testing broker ALARMS. | ||
""" | ||
|
||
import time | ||
|
||
import bmq.dev.it.testconstants as tc | ||
from bmq.dev.it.fixtures import Cluster, cluster, tweak # pylint: disable=unused-import | ||
|
||
|
||
class TestAlarms: | ||
@tweak.cluster.queue_operations.consumption_monitor_period_ms(500) | ||
@tweak.domain.max_idle_time(3) | ||
def test_no_alarms_for_a_slow_queue(cluster: Cluster): | ||
""" | ||
Testing broker ALARMS. | ||
Test no broker ALARMS for a slowly moving queue. | ||
""" | ||
leader = cluster.last_known_leader | ||
proxy = next(cluster.proxy_cycle()) | ||
|
||
@tweak.cluster.queue_operations.consumption_monitor_period_ms(500) | ||
@tweak.domain.max_idle_time(3) | ||
def test_no_alarms_for_a_slow_queue(self, cluster: Cluster): | ||
""" | ||
Test no broker ALARMS for a slowly moving queue. | ||
""" | ||
leader = cluster.last_known_leader | ||
proxy = next(cluster.proxy_cycle()) | ||
|
||
producer = proxy.create_client("producer") | ||
producer.open(tc.URI_PRIORITY, flags=["write,ack"], succeed=True) | ||
producer = proxy.create_client("producer") | ||
producer.open(tc.URI_PRIORITY, flags=["write,ack"], succeed=True) | ||
|
||
consumer1 = proxy.create_client("consumer1") | ||
consumer2 = proxy.create_client("consumer2") | ||
consumer1.open( | ||
tc.URI_PRIORITY, flags=["read"], max_unconfirmed_messages=1, succeed=True | ||
) | ||
consumer1 = proxy.create_client("consumer1") | ||
consumer2 = proxy.create_client("consumer2") | ||
consumer1.open( | ||
tc.URI_PRIORITY, flags=["read"], max_unconfirmed_messages=1, succeed=True | ||
) | ||
|
||
producer.post(tc.URI_PRIORITY, ["msg1"], succeed=True, wait_ack=True) | ||
producer.post(tc.URI_PRIORITY, ["msg1"], succeed=True, wait_ack=True) | ||
|
||
consumer1.confirm(tc.URI_PRIORITY, "*", succeed=True) | ||
consumer1.confirm(tc.URI_PRIORITY, "*", succeed=True) | ||
|
||
producer.post(tc.URI_PRIORITY, ["msg1"], succeed=True, wait_ack=True) | ||
producer.post(tc.URI_PRIORITY, ["msg1"], succeed=True, wait_ack=True) | ||
producer.post(tc.URI_PRIORITY, ["msg1"], succeed=True, wait_ack=True) | ||
producer.post(tc.URI_PRIORITY, ["msg1"], succeed=True, wait_ack=True) | ||
|
||
time.sleep(4) | ||
time.sleep(4) | ||
|
||
# First, test the alarm | ||
assert leader.alarms("QUEUE_CONSUMER_MONITOR", 1) | ||
leader.drain() | ||
# First, test the alarm | ||
assert leader.alarms("QUEUE_CONSUMER_MONITOR", 1) | ||
leader.drain() | ||
|
||
# Then test no alarm while consumer1 slowly confirms | ||
time.sleep(1) | ||
consumer1.confirm(tc.URI_PRIORITY, "*", succeed=True) | ||
# Then test no alarm while consumer1 slowly confirms | ||
time.sleep(1) | ||
consumer1.confirm(tc.URI_PRIORITY, "*", succeed=True) | ||
|
||
time.sleep(1) | ||
consumer1.confirm(tc.URI_PRIORITY, "*", succeed=True) | ||
producer.post(tc.URI_PRIORITY, ["msg1"], succeed=True, wait_ack=True) | ||
time.sleep(1) | ||
consumer1.confirm(tc.URI_PRIORITY, "*", succeed=True) | ||
producer.post(tc.URI_PRIORITY, ["msg1"], succeed=True, wait_ack=True) | ||
|
||
time.sleep(1) | ||
# Consumer2 picks the last message | ||
consumer2.open( | ||
tc.URI_PRIORITY, flags=["read"], max_unconfirmed_messages=1, succeed=True | ||
) | ||
time.sleep(1) | ||
# Consumer2 picks the last message | ||
consumer2.open( | ||
tc.URI_PRIORITY, flags=["read"], max_unconfirmed_messages=1, succeed=True | ||
) | ||
|
||
time.sleep(1) | ||
assert not leader.alarms("QUEUE_CONSUMER_MONITOR", 1) | ||
time.sleep(1) | ||
assert not leader.alarms("QUEUE_CONSUMER_MONITOR", 1) |
Oops, something went wrong.