@@ -52,38 +52,37 @@ void testTelemetryDataFlow() {
5252 // Need to wait because some but not all the telemetry may be available in the first post body
5353 Awaitility .await ()
5454 .atMost (Duration .ofSeconds (30 ))
55- .until (() -> {
56- List <String > postBodies = testing .mockedIngestion .getPostBodies ();
57- if (postBodies .isEmpty ()) {
58- return false ;
59- }
60-
61- PostBodyVerifier tempVerifier = new PostBodyVerifier ();
62- for (String postBody : postBodies ) {
63- tempVerifier .searchPostBody (postBody );
64- }
65-
66- assertTrue (tempVerifier .hasExceptionDoc ());
67- assertTrue (tempVerifier .hasTraceDoc ());
68- assertTrue (tempVerifier .hasDependency ());
69- assertTrue (tempVerifier .hasRequest ());
70- return true ;
71- });
55+ .until (
56+ () -> {
57+ List <String > postBodies = testing .mockedIngestion .getPostBodies ();
58+ if (postBodies .isEmpty ()) {
59+ return false ;
60+ }
61+
62+ PostBodyVerifier verifier = new PostBodyVerifier ();
63+ for (String postBody : postBodies ) {
64+ verifier .searchPostBody (postBody );
65+ }
66+
67+ assertTrue (verifier .hasExceptionDoc ());
68+ assertTrue (verifier .hasTraceDoc ());
69+ assertTrue (verifier .hasDependency ());
70+ assertTrue (verifier .hasRequest ());
71+ return true ;
72+ });
7273 }
7374
7475 static class PostBodyVerifier {
75- boolean foundExceptionDoc = false ;
76- boolean foundTraceDoc = false ;
77- boolean foundDependency = false ;
78- boolean foundRequest = false ;
76+ boolean foundExceptionDoc ;
77+ boolean foundTraceDoc ;
78+ boolean foundDependency ;
79+ boolean foundRequest ;
7980
80- public void searchPostBody (String postBody ) {
81+ public void searchPostBody (String postBody ) throws IOException {
8182 // Each post body is a list with a singular MonitoringDataPoint
8283 List <MonitoringDataPoint > dataPoints ;
8384 try (JsonReader reader = JsonProviders .createReader (postBody )) {
8485 dataPoints = reader .readArray (MonitoringDataPoint ::fromJson );
85- } catch (IOException e ) {
86- throw new IllegalStateException ("Failed to parse post request body" , e );
8786 }
8887
8988 // Because the mock ping/posts should succeed, we should only have one MonitoringDataPoint per
0 commit comments