Skip to content

Commit 7e0f547

Browse files
authored
IT[test_reconfigure_domains.py]: check structured admin output (#994)
Signed-off-by: Evgenii Malygin <[email protected]>
1 parent 54b40e7 commit 7e0f547

File tree

2 files changed

+32
-7
lines changed

2 files changed

+32
-7
lines changed

src/integration-tests/test_reconfigure_domains.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2024 Bloomberg Finance L.P.
1+
# Copyright 2025 Bloomberg Finance L.P.
22
# SPDX-License-Identifier: Apache-2.0
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -532,16 +532,16 @@ def run_consumers(max_attempts: int) -> int:
532532
admin = AdminClient()
533533
admin.connect(*cluster.admin_endpoint)
534534

535-
res = admin.send_admin(f"DOMAINS DOMAIN {domain_priority} INFOS")
536-
assert '"maxDeliveryAttempts" : 0' in res
535+
domain_cfg = admin.get_domain_config(domain_priority)
536+
assert domain_cfg["maxDeliveryAttempts"] == 0
537537

538538
cluster.config.domains[
539539
domain_priority
540540
].definition.parameters.max_delivery_attempts = 5
541541
cluster.reconfigure_domain(domain_priority, succeed=True)
542542

543-
res = admin.send_admin(f"DOMAINS DOMAIN {domain_priority} INFOS")
544-
assert '"maxDeliveryAttempts" : 5' in res
543+
domain_cfg = admin.get_domain_config(domain_priority)
544+
assert domain_cfg["maxDeliveryAttempts"] == 5
545545

546546
admin.stop()
547547

src/python/blazingmq/dev/it/process/admin.py

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2024 Bloomberg Finance L.P.
1+
# Copyright 2025 Bloomberg Finance L.P.
22
# SPDX-License-Identifier: Apache-2.0
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -20,7 +20,8 @@
2020
PURPOSE: Provide a BMQ admin client.
2121
"""
2222

23-
from typing import Union
23+
import json
24+
from typing import Union, Dict, Any
2425

2526
from blazingmq.schemas import broker
2627
from .rawclient import RawClient
@@ -62,3 +63,27 @@ def connect(self, host: str, port: int) -> None:
6263

6364
self._send_raw(self._wrap_control_event(admin_client_identity))
6465
self._receive_event()
66+
67+
# Admin APIs
68+
def get_domain_config(self, domain_name: str) -> Dict[str, Any]:
69+
"""
70+
Send the "DOMAINS DOMAIN <domain_name> INFOS" admin command, parse the received response and
71+
return the domain configuration as a structured dictionary.
72+
"""
73+
74+
admin_response: str = self.send_admin(
75+
f"ENCODING JSON_COMPACT DOMAINS DOMAIN {domain_name} INFOS"
76+
)
77+
78+
# Top-level domain information has the following structure:
79+
# {
80+
# "domainInfo": {
81+
# "name": str,
82+
# "configJson": str,
83+
# ...
84+
# }
85+
# }
86+
# Need to look up to configJson and parse the string
87+
domain_stats = json.loads(admin_response)
88+
config_json = domain_stats["domainInfo"]["configJson"]
89+
return json.loads(config_json)

0 commit comments

Comments
 (0)