You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by lh...@apache.org on 2026/05/01 17:32:32 UTC
(pulsar) branch master updated: [fix][test] Fix flaky SchemaServiceTest.testSchemaRegistryMetrics (#25645)
This is an automated email from the ASF dual-hosted git repository.
lhotari pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new c3fde128619 [fix][test] Fix flaky SchemaServiceTest.testSchemaRegistryMetrics (#25645)
c3fde128619 is described below
commit c3fde128619e562d70c77f9a242242a9617d6d3b
Author: Matteo Merli <mm...@apache.org>
AuthorDate: Fri May 1 10:32:26 2026 -0700
[fix][test] Fix flaky SchemaServiceTest.testSchemaRegistryMetrics (#25645)
---
.../apache/pulsar/broker/service/schema/SchemaServiceTest.java | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/schema/SchemaServiceTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/schema/SchemaServiceTest.java
index d164559e858..757dfd827ff 100644
--- a/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/schema/SchemaServiceTest.java
+++ b/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/schema/SchemaServiceTest.java
@@ -173,12 +173,16 @@ public class SchemaServiceTest extends MockedPulsarServiceBaseTest {
String metricsStr = output.toString(StandardCharsets.UTF_8);
Multimap<String, Metric> metrics = parseMetrics(metricsStr);
+ // The *_ops_failed_total counters are registered on the default Prometheus
+ // registry (a JVM-wide static), so labels accumulated by other tests in the
+ // same JVM persist here. Only assert that no failed metric exists for THIS
+ // test's namespace.
Collection<Metric> delMetrics = metrics.get("pulsar_schema_del_ops_failed_total");
- Assert.assertEquals(delMetrics.size(), 0);
+ assertThat(delMetrics).noneMatch(metric -> namespace.equals(metric.tags.get("namespace")));
Collection<Metric> getMetrics = metrics.get("pulsar_schema_get_ops_failed_total");
- Assert.assertEquals(getMetrics.size(), 0);
+ assertThat(getMetrics).noneMatch(metric -> namespace.equals(metric.tags.get("namespace")));
Collection<Metric> putMetrics = metrics.get("pulsar_schema_put_ops_failed_total");
- Assert.assertEquals(putMetrics.size(), 0);
+ assertThat(putMetrics).noneMatch(metric -> namespace.equals(metric.tags.get("namespace")));
Collection<Metric> deleteLatency = metrics.get("pulsar_schema_del_ops_latency_count");
assertThat(deleteLatency).anySatisfy(metric -> {