Skip to content

Commit

Permalink
NEBDUTY-1543: tweak tests/local_ssd (#1464)
Browse files Browse the repository at this point in the history
* NEBDUTY-1543: tweak tests/local_ssd
  • Loading branch information
sharpeye committed Jun 20, 2024
1 parent 7dbf27a commit 861e2ea
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions cloud/blockstore/tests/local_ssd/test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import json
import os
import pytest
import time
import json

from cloud.blockstore.public.sdk.python.client.error_codes import EResult
from cloud.blockstore.public.sdk.python.client import CreateClient
Expand Down Expand Up @@ -159,8 +159,8 @@ def test_add_host_with_legacy_local_ssd(
input_bytes=str.encode('{"State": true}'))
client.update_disk_registry_config(KNOWN_DEVICE_POOLS)

disk_agent = start_disk_agent(disk_agent_config)
disk_agent.wait_for_registration()
disk_agent = start_disk_agent(disk_agent_config, name='disk-agent.1')
assert disk_agent.wait_for_registration()

_add_host(client, agent_id)

Expand Down Expand Up @@ -274,10 +274,12 @@ def test_add_host_with_legacy_local_ssd(
assert action_results[0].Result.Code == EResult.S_OK.value

bkp = _backup(client)

assert len(bkp.get("DirtyDevices", [])) == 0
assert len(bkp["SuspendedDevices"]) == 4

disk_agent.kill()
assert not disk_agent.is_alive()

# wait for DR to mark the agent as unavailable
while True:
Expand All @@ -286,11 +288,11 @@ def test_add_host_with_legacy_local_ssd(
break
time.sleep(1)

disk_agent = start_disk_agent(disk_agent_config)
disk_agent.wait_for_registration()
disk_agent = start_disk_agent(disk_agent_config, name='disk-agent.2')
assert disk_agent.wait_for_registration()

bkp = _backup(client)
assert bkp["Agents"][0]["State"] == 'AGENT_STATE_WARNING'
assert bkp["Agents"][0]["State"] == 'AGENT_STATE_WARNING', json.dumps(bkp)
assert len(bkp.get("SuspendedDevices", [])) == 4

# put the agent back
Expand Down Expand Up @@ -342,8 +344,8 @@ def test_add_host(
input_bytes=str.encode('{"State": true}'))
client.update_disk_registry_config(KNOWN_DEVICE_POOLS)

disk_agent = start_disk_agent(disk_agent_config)
disk_agent.wait_for_registration()
disk_agent = start_disk_agent(disk_agent_config, name='disk-agent.1')
assert disk_agent.wait_for_registration()

_add_host(client, agent_id)

Expand Down Expand Up @@ -418,6 +420,7 @@ def test_add_host(
assert len(bkp["SuspendedDevices"]) == 4

disk_agent.kill()
assert not disk_agent.is_alive()

# wait for DR to mark the agent as unavailable
while True:
Expand All @@ -426,11 +429,11 @@ def test_add_host(
break
time.sleep(1)

disk_agent = start_disk_agent(disk_agent_config)
disk_agent.wait_for_registration()
disk_agent = start_disk_agent(disk_agent_config, name='disk-agent.2')
assert disk_agent.wait_for_registration()

bkp = _backup(client)
assert bkp["Agents"][0]["State"] == 'AGENT_STATE_WARNING'
assert bkp["Agents"][0]["State"] == 'AGENT_STATE_WARNING', json.dumps(bkp)
assert len(bkp.get("SuspendedDevices", [])) == 4

# put the agent back
Expand Down

0 comments on commit 861e2ea

Please sign in to comment.