summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSemyon Danilov <[email protected]>2026-07-07 21:20:46 +0400
committerGitHub <[email protected]>2026-07-07 20:20:46 +0300
commit0d74fb2d00ed2ce2ca90a22606ff7490e6731bf4 (patch)
tree1532548cf89eb5157391441db2b4083a3b13f9c2
parent997c9c62119c750d8605452f2b90ecb5e62e61e4 (diff)
Fix flaky test_viewer_cluster (#45731)
-rw-r--r--ydb/core/viewer/tests/canondata/result.json8
-rw-r--r--ydb/core/viewer/tests/test.py24
2 files changed, 24 insertions, 8 deletions
diff --git a/ydb/core/viewer/tests/canondata/result.json b/ydb/core/viewer/tests/canondata/result.json
index 4b3d2f0657c..9b372b6ea88 100644
--- a/ydb/core/viewer/tests/canondata/result.json
+++ b/ydb/core/viewer/tests/canondata/result.json
@@ -3882,14 +3882,6 @@
{
"ErasureSpecies": "block-4-2",
"PDiskFilter": "Type:SSD"
- },
- {
- "ErasureSpecies": "none",
- "PDiskFilter": "Type:ROT,Kind:0"
- },
- {
- "ErasureSpecies": "none",
- "PDiskFilter": "Type:ROT"
}
],
"StorageTotal": "not-zero-number-text",
diff --git a/ydb/core/viewer/tests/test.py b/ydb/core/viewer/tests/test.py
index 77cffb3cc10..15cdd9a616a 100644
--- a/ydb/core/viewer/tests/test.py
+++ b/ydb/core/viewer/tests/test.py
@@ -23,6 +23,17 @@ class TestViewer(object):
'ImmediateGroupsToCreate',
'ImmediateSizeToCreate',
}
+ # Pool-derived rows depend on the async BSC snapshot; keep only
+ # calculator-prefilled rows in canonical /viewer/cluster output.
+ BSC_STORAGE_STATS_STABLE_KEYS = (
+ ('mirror-3-dc', 'Type:ROT'),
+ ('mirror-3-dc', 'Type:SSD'),
+ ('block-4-2', 'Type:ROT'),
+ ('block-4-2', 'Type:SSD'),
+ )
+ BSC_STORAGE_STATS_STABLE_KEY_ORDER = {
+ key: index for index, key in enumerate(BSC_STORAGE_STATS_STABLE_KEYS)
+ }
@pytest.fixture(autouse=True, scope='class')
@classmethod
@@ -924,6 +935,19 @@ class TestViewer(object):
result = cls.get_viewer_cluster_with_calculated_storage_stats()
result = cls.normalize_result(result)
cls.delete_keys_recursively(result, cls.BSC_STORAGE_STATS_VALUE_FIELDS)
+ if 'StorageStats' in result:
+ stable_key_order = cls.BSC_STORAGE_STATS_STABLE_KEY_ORDER
+
+ def get_storage_stats_key(entry):
+ return (entry.get('ErasureSpecies'), entry.get('PDiskFilter'))
+
+ result['StorageStats'] = sorted(
+ (
+ entry for entry in result['StorageStats']
+ if get_storage_stats_key(entry) in stable_key_order
+ ),
+ key=lambda entry: stable_key_order[get_storage_stats_key(entry)],
+ )
return result
@classmethod