File tree Expand file tree Collapse file tree 1 file changed +25
-16
lines changed
smoke-tests/apps/Diagnostics/src/main/java/com/microsoft/applicationinsights/smoketestapp Expand file tree Collapse file tree 1 file changed +25
-16
lines changed Original file line number Diff line number Diff line change @@ -24,26 +24,35 @@ public String root() {
2424 public String jfrFileHasDiagnostics () throws Exception {
2525 Optional <Path > jfrFile ;
2626 for (int i = 0 ; i < 60 ; i ++) {
27+ try {
28+ jfrFile =
29+ Files .walk (new File ("/tmp/root/applicationinsights" ).toPath ())
30+ .filter (Files ::isRegularFile )
31+ .filter (it -> it .toFile ().getName ().contains (".jfr" ))
32+ .findFirst ();
2733
28- jfrFile =
29- Files .walk (new File ("/tmp/root/applicationinsights" ).toPath ())
30- .filter (Files ::isRegularFile )
31- .filter (it -> it .toFile ().getName ().contains (".jfr" ))
32- .findFirst ();
33-
34- if (!jfrFile .isPresent ()) {
35- Thread .sleep (1000 , 0 );
36- continue ;
37- }
34+ if (!jfrFile .isPresent ()) {
35+ Thread .sleep (1000 , 0 );
36+ continue ;
37+ }
3838
39- Path decompressedFile = decompressFile (jfrFile .get ());
39+ Path decompressedFile = decompressFile (jfrFile .get ());
4040
41- boolean hasTelemetry =
42- com .microsoft .applicationinsights .jfrfile .JfrFileReader .hasEventOfType (
43- decompressedFile , "com.microsoft.applicationinsights.diagnostics.jfr.Telemetry" );
41+ boolean hasTelemetry =
42+ com .microsoft .applicationinsights .jfrfile .JfrFileReader .hasEventOfType (
43+ decompressedFile , "com.microsoft.applicationinsights.diagnostics.jfr.Telemetry" );
4444
45- if (hasTelemetry ) {
46- return String .valueOf (true );
45+ if (hasTelemetry ) {
46+ return String .valueOf (true );
47+ }
48+ } catch (Exception e ) {
49+ // Ignore early exceptions, as to be expected, throw them if they are still happening
50+ // towards the end
51+ if (i > 55 ) {
52+ throw e ;
53+ } else {
54+ Thread .sleep (1000 , 0 );
55+ }
4756 }
4857 }
4958
You can’t perform that action at this time.
0 commit comments