Muawiya-contact opened a new pull request, #342:
URL: https://github.com/apache/hugegraph-ai/pull/342
<html>
<body>
<!--StartFragment--><html><head></head><body><h1>test(client): pin 1.7.0
backend_metrics shape with deterministic structural assertions</h1>
<p>Closes #326</p>
<hr>
<h2>What does this PR do?</h2>
<p>Replaces the loose <code>assertGreater(len(...), 1)</code> check in
<code>test_metric.py</code> with
deterministic structural assertions based on the actual
<code>/metrics/backend</code>
response captured from a real HugeGraph server.</p>
<h2>The problem</h2>
<p>The old assertion only checked length — shape drift in the API response
would pass silently without any test failure.</p>
<pre><code class="language-python"># Before — too loose
self.assertGreater(len(backend_metrics["hugegraph"]), 1)
</code></pre>
<h2>The fix</h2>
<pre><code class="language-python"># After — deterministic structural
assertion
missing_keys = EXPECTED_BACKEND_SERVER_KEYS - set(server_entry.keys())
self.assertFalse(missing_keys, f"Missing expected keys: {missing_keys}")
</code></pre>
<h2>What was verified</h2>
<ul>
<li>Captured the actual <code>/metrics/backend</code> response from a real
HugeGraph server</li>
<li>Pinned <code>EXPECTED_BACKEND_SERVER_KEYS</code> from that real
response</li>
<li>Asserts <code>backend</code>, <code>nodes</code>,
<code>cluster_id</code>, <code>servers</code> fields exist with correct
types</li>
<li>Asserts all expected rocksdb metric keys are present in the server
entry</li>
</ul>
<h2>Test results</h2>
Server version | Result
-- | --
HugeGraph 1.7.0 (Docker) | ✅ PASSED
HugeGraph latest (Docker) | ✅ PASSED
<p>Both versions return identical shapes — one assertion covers both.</p>
<h2>Files changed</h2>
<p>Only one file touched:
<code>hugegraph-python-client/src/tests/api/test_metric.py</code></p></body></html><!--EndFragment-->
</body>
</html>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]