Skip to content

Commit

Permalink
WIP: Add test for auto subscriptions with nonexistent appids
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick M. Niedzielski <[email protected]>
  • Loading branch information
pniedzielski committed Oct 11, 2024
1 parent 03d9f65 commit 1bdcbfa
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions src/integration-tests/test_auto_subscriptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,62 @@ def test_auto_subscription_fanout_all_negative(self, cluster: Cluster):
assert len(self.consumer_bar.list(block=True)) == 0
assert len(self.consumer_baz.list(block=True)) == 0

@tweak.domain.subscriptions(
[
{
"appId": "nonexistent-appid",
"expression": {"version": "E_VERSION_1", "text": "x==1"},
}
]
)
def test_nonexistent_appid(self, cluster: Cluster):
"""
Configure an auto subscription for a fanout App that does not exist.
Make sure all apps continue to receive messages.
"""
proxies = cluster.proxy_cycle()

# 1: Setup producers and consumers

next(proxies)
proxy = next(proxies)

producer = proxy.create_client("producer")
assert (
producer.open(tc.URI_FANOUT_SC, flags=["write", "ack"], block=True)
== Client.e_SUCCESS
)

self.consumer = self._start_client(proxy, tc.URI_FANOUT_SC_FOO, "consumerFoo")

self.consumer_bar = self._start_client(
proxy, tc.URI_FANOUT_SC_BAR, "consumerBar"
)
self.consumer_baz = self._start_client(
proxy, tc.URI_FANOUT_SC_BAZ, "consumerBaz"
)

assert (
producer.post(
tc.URI_FANOUT_SC,
payload=["123"],
block=True,
wait_ack=True,
messageProperties=[{"name": "x", "value": "0", "type": "E_INT"}],
)
== Client.e_SUCCESS
)

self.leader = cluster.last_known_leader

self._verify(tc.DOMAIN_FANOUT_SC, 0)
self._verify_fanout(tc.DOMAIN_FANOUT_SC, [], ["foo", "bar", "baz"], 0)

assert len(self.consumer.list(block=True)) == 0
assert len(self.consumer_bar.list(block=True)) == 0
assert len(self.consumer_baz.list(block=True)) == 0


@tweak.domain.subscriptions(
[
{
Expand Down

0 comments on commit 1bdcbfa

Please sign in to comment.