visxu commented on issue #23457: URL: https://github.com/apache/pulsar/issues/23457#issuecomment-2456660855
> > Hi, Lari. @lhotari Could you please assign me the issue, I wanna contribute it. :) > > @visxu Thanks for volunteering. This particular issue is tricky since it seems to be caused by lack of sufficient isolation between test runs. Prometheus metrics use static fields and there could be state left over from other executions in the same JVM. One simple solution for this case is to ignore the results from other namespaces on the line where the failure happens. > > https://github.com/apache/pulsar/blob/a6cee2b4f331a57429dfdbbfbec9777955855edb/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/schema/SchemaServiceTest.java#L182-L198 > > changing the asserts to `if`. The test is itself not great since it wouldn't fail if there aren't any metrics available so that issue should be addressed too. I'd recommend using AssertJ fluent assertions to handle the assertions. > > something like this, perhaps > > ```java > assertThat(deleteLatency).anySatisfy(metric -> { > Assert.assertEquals(metric.tags.get("namespace"), namespace); > Assert.assertTrue(metric.value > 0); > }); > ``` Thanks for your comments and suggestions. -- 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]
