Bug Type (问题类型)
None
Before submit
Environment (环境信息)
Environment
| Item |
Detail |
| HugeGraph Server |
1.7.0 |
| Module |
python-client |
| File |
hugegraph-python-client/src/tests/test_metric.py |
Expected & Actual behavior (期望与实际表现)
Expected & Actual Behavior
Problem
test_metrics_operations (L78–79) contains an if "hugegraph" in backend_metrics: guard that effectively no-ops the backend metrics assertion when running against HugeGraph 1.7.0.
This means shape drift in the API response goes completely undetected — the test passes silently even if the backend metrics structure changes.
Expected
The test should pin the actual 1.7.0 response shape and assert against it deterministically. Any deviation from the known shape should surface as a test failure.
Actual
The guard short-circuits the assertion. On HugeGraph 1.7.0, the block inside the if is never entered, so the backend metrics structure is never validated.
Suggested Fix
- Document the actual
backend_metrics response shape returned by HugeGraph 1.7.0.
- Replace the open-ended guard with a version-gated deterministic assertion — e.g.:
# Before (no-op guard)
if "hugegraph" in backend_metrics:
assert ...
# After (strict, version-aware assertion)
assert "hugegraph" in backend_metrics, (
f"Expected 'hugegraph' key in backend_metrics, got: {list(backend_metrics.keys())}"
)
assert backend_metrics["hugegraph"] == EXPECTED_SHAPE_1_7_0
Vertex/Edge example (问题点 / 边数据举例)
Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)
Bug Type (问题类型)
None
Before submit
Environment (环境信息)
Environment
python-clienthugegraph-python-client/src/tests/test_metric.pyExpected & Actual behavior (期望与实际表现)
Expected & Actual Behavior
Problem
test_metrics_operations(L78–79) contains anif "hugegraph" in backend_metrics:guard that effectively no-ops the backend metrics assertion when running against HugeGraph 1.7.0.This means shape drift in the API response goes completely undetected — the test passes silently even if the backend metrics structure changes.
Expected
The test should pin the actual 1.7.0 response shape and assert against it deterministically. Any deviation from the known shape should surface as a test failure.
Actual
The guard short-circuits the assertion. On HugeGraph 1.7.0, the block inside the
ifis never entered, so the backend metrics structure is never validated.Suggested Fix
backend_metricsresponse shape returned by HugeGraph 1.7.0.Vertex/Edge example (问题点 / 边数据举例)
Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)