From 5bb8280907b752e2b8fb59159893443a59d94d53 Mon Sep 17 00:00:00 2001 From: VisionXu Date: Wed, 6 Nov 2024 19:41:32 +0800 Subject: [PATCH] [fix][test]Flaky-test: SchemaServiceTest.testSchemaRegistryMetrics (#23566) (cherry picked from commit 13133c11834ec782aa90187abcc8793e87925008) --- .../broker/service/schema/SchemaServiceTest.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 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 658ea268c644c..7e8aa72338024 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 @@ -180,22 +180,22 @@ public void testSchemaRegistryMetrics() throws Exception { Assert.assertEquals(putMetrics.size(), 0); Collection deleteLatency = metrics.get("pulsar_schema_del_ops_latency_count"); - for (Metric metric : deleteLatency) { + assertThat(deleteLatency).anySatisfy(metric -> { Assert.assertEquals(metric.tags.get("namespace"), namespace); Assert.assertTrue(metric.value > 0); - } + }); Collection getLatency = metrics.get("pulsar_schema_get_ops_latency_count"); - for (Metric metric : getLatency) { + assertThat(getLatency).anySatisfy(metric -> { Assert.assertEquals(metric.tags.get("namespace"), namespace); Assert.assertTrue(metric.value > 0); - } + }); Collection putLatency = metrics.get("pulsar_schema_put_ops_latency_count"); - for (Metric metric : putLatency) { + assertThat(putLatency).anySatisfy(metric -> { Assert.assertEquals(metric.tags.get("namespace"), namespace); Assert.assertTrue(metric.value > 0); - } + }); } @Test