-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IT[BMQ]: Add tests to remove an appid with consumer still connected #512
Open
emelialei88
wants to merge
1
commit into
bloomberg:main
Choose a base branch
from
emelialei88:test/appid
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -641,3 +641,105 @@ def test_open_authorize_restart_from_non_FSM_to_FSM(cluster: Cluster): | |
consumers[app_id].close(f"{tc.URI_FANOUT}?id={app_id}", block=True) | ||
== Client.e_SUCCESS | ||
) | ||
|
||
|
||
def test_remove_appid_reconfigure(cluster: Cluster): | ||
proxies = cluster.proxy_cycle() | ||
|
||
producer = next(proxies).create_client("producer") | ||
producer.open(tc.URI_FANOUT, flags=["write,ack"], succeed=True) | ||
|
||
# --------------------------------------------------------------------- | ||
# Create a consumer for each authorized substream. | ||
|
||
consumers = {} | ||
|
||
app_ids = default_app_ids | ||
victim_app_id = app_ids[0] | ||
|
||
for app_id in app_ids: | ||
consumer = next(proxies).create_client(app_id) | ||
consumers[app_id] = consumer | ||
consumer.open(f"{tc.URI_FANOUT}?id={app_id}", flags=["read"], succeed=True) | ||
|
||
# --------------------------------------------------------------------- | ||
# Post 5 messages. | ||
|
||
producer.post( | ||
tc.URI_FANOUT, | ||
["msg1", "msg2", "msg3", "msg4", "msg5"], | ||
succeed=True, | ||
wait_ack=True, | ||
) | ||
|
||
# --------------------------------------------------------------------- | ||
# Reconfigure domain to remove app_id foo. | ||
|
||
app_ids.remove(victim_app_id) | ||
set_app_ids(cluster, app_ids) | ||
|
||
# --------------------------------------------------------------------- | ||
# Consumer connected to foo receives the message and tries to confirm. | ||
|
||
consumers[victim_app_id].wait_push_event(timeout=5) | ||
assert ( | ||
consumers[victim_app_id].confirm( | ||
tc.URI_FANOUT, "+1", succeed=True, no_except=True | ||
) | ||
== Client.e_UNKNOWN | ||
) | ||
|
||
|
||
def test_remove_appid_cluster_restart(cluster: Cluster): | ||
leader = cluster.last_known_leader | ||
proxies = cluster.proxy_cycle() | ||
|
||
producer = next(proxies).create_client("producer") | ||
producer.open(tc.URI_FANOUT, flags=["write,ack"], succeed=True) | ||
|
||
# --------------------------------------------------------------------- | ||
# Create a consumer for each authorized substream. | ||
|
||
consumers = {} | ||
|
||
app_ids = default_app_ids | ||
victim_app_id = app_ids[0] | ||
|
||
for app_id in app_ids: | ||
consumer = next(proxies).create_client(app_id) | ||
consumers[app_id] = consumer | ||
consumer.open(f"{tc.URI_FANOUT}?id={app_id}", flags=["read"], succeed=True) | ||
|
||
# --------------------------------------------------------------------- | ||
# Post 5 messages. | ||
|
||
producer.post( | ||
tc.URI_FANOUT, | ||
["msg1", "msg2", "msg3", "msg4", "msg5"], | ||
succeed=True, | ||
wait_ack=True, | ||
) | ||
|
||
# --------------------------------------------------------------------- | ||
# Remove app_id foo and restart broker | ||
|
||
victim_app_id = app_ids[0] | ||
app_ids.remove(victim_app_id) | ||
|
||
cluster.restart_nodes() | ||
|
||
# --------------------------------------------------------------------- | ||
# Broker can still see the messages | ||
|
||
assert leader.capture_n("msg*", 5, timeout=1) | ||
|
||
# --------------------------------------------------------------------- | ||
# Consumer connected to foo receives the message and tries to confirm. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you also verify that other consumers can confirm normally? |
||
|
||
consumers[victim_app_id].wait_push_event(timeout=5) | ||
assert ( | ||
consumers[victim_app_id].confirm( | ||
tc.URI_FANOUT, "+1", succeed=True, no_except=True | ||
) | ||
== Client.e_UNKNOWN | ||
) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also verify that other consumers can confirm normally?