shoothzj commented on code in PR #4294:
URL: https://github.com/apache/bookkeeper/pull/4294#discussion_r1572595535


##########
stats/bookkeeper-stats-providers/prometheus-metrics-provider/src/test/java/org/apache/bookkeeper/stats/prometheus/TestPrometheusMetricsProvider.java:
##########
@@ -132,15 +132,16 @@ public void testJvmDirectMemoryMetrics() throws Exception 
{
         
config.setProperty(PrometheusMetricsProvider.PROMETHEUS_STATS_HTTP_ENABLE, 
true);
         
config.setProperty(PrometheusMetricsProvider.PROMETHEUS_STATS_HTTP_PORT, 0);
         
config.setProperty(PrometheusMetricsProvider.PROMETHEUS_STATS_HTTP_ADDRESS, 
"127.0.0.1");
-        ByteBuf byteBuf = ByteBufAllocator.DEFAULT.directBuffer(25);
         PrometheusMetricsProvider provider = new PrometheusMetricsProvider();
         try {
             provider.start(config);
             assertNotNull(provider.server);
+            ByteBuf byteBuf = ByteBufAllocator.DEFAULT.directBuffer(25);
             StringWriter writer = new StringWriter();
             provider.writeAllMetrics(writer);
             String s = writer.toString();
-            String[] split = s.split(System.lineSeparator());
+            // prometheus network string uses '\n' in all platform
+            String[] split = s.split("\n");

Review Comment:
   It's. '\r\n' in windows



##########
stats/bookkeeper-stats-providers/prometheus-metrics-provider/src/test/java/org/apache/bookkeeper/stats/prometheus/TestPrometheusMetricsProvider.java:
##########
@@ -132,15 +132,16 @@ public void testJvmDirectMemoryMetrics() throws Exception 
{
         
config.setProperty(PrometheusMetricsProvider.PROMETHEUS_STATS_HTTP_ENABLE, 
true);
         
config.setProperty(PrometheusMetricsProvider.PROMETHEUS_STATS_HTTP_PORT, 0);
         
config.setProperty(PrometheusMetricsProvider.PROMETHEUS_STATS_HTTP_ADDRESS, 
"127.0.0.1");
-        ByteBuf byteBuf = ByteBufAllocator.DEFAULT.directBuffer(25);
         PrometheusMetricsProvider provider = new PrometheusMetricsProvider();
         try {
             provider.start(config);
             assertNotNull(provider.server);
+            ByteBuf byteBuf = ByteBufAllocator.DEFAULT.directBuffer(25);
             StringWriter writer = new StringWriter();
             provider.writeAllMetrics(writer);
             String s = writer.toString();
-            String[] split = s.split(System.lineSeparator());
+            // prometheus network string uses '\n' in all platform
+            String[] split = s.split("\n");

Review Comment:
   It's '\r\n' in windows



-- 
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]

Reply via email to