Skip to content

Commit

Permalink
Fix the breakage in test_grpc.py
Browse files Browse the repository at this point in the history
Fixes ceph#738

Signed-off-by: Gil Bregman <[email protected]>
  • Loading branch information
gbregman committed Jul 28, 2024
1 parent 6ffaf83 commit ccea879
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tests/test_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
created_resource_count = 20
subsys_list_count = 5

def wait_for_string(caplog, str, timeout):
for i in range(timeout):
if str in caplog.text:
return
time.sleep(1)

assert False, f"Couldn't find string \"{str}\" in {timeout} seconds"

def create_resource_by_index(i):
subsystem = f"{subsystem_prefix}{i}"
cli(["subsystem", "add", "--subsystem", subsystem])
Expand Down Expand Up @@ -68,14 +76,16 @@ def test_create_get_subsys(caplog, config):
ceph_utils.execute_ceph_monitor_command("{" + f'"prefix":"nvme-gw create", "id": "{gateway.name}", "pool": "{pool}", "group": ""' + "}")
gateway.serve()

time.sleep(20) # Make sure update() is over
# wait until we see at least one subsystem created
wait_for_string(caplog, f"Received request to create subsystem {subsystem_prefix}", 60)

for i in range(subsys_list_count):
cli(["--format", "plain", "subsystem", "list"])
assert "Exception" not in caplog.text
assert "No subsystems" not in caplog.text
time.sleep(0.1)

time.sleep(20) # Make sure update() is over
assert f"{subsystem_prefix}0 with ANA group id 1" in caplog.text
assert f"Received request to set QOS limits for namespace using NSID 1 on {subsystem_prefix}0, R/W IOs per second: 2000 Read megabytes per second: 5" in caplog.text
caplog.clear()
Expand Down

0 comments on commit ccea879

Please sign in to comment.