File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed
run/jobs/src/test/java/com/example Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -104,15 +104,23 @@ public void generatesLogs() throws Exception {
104
104
+ "\" -protoPayload.serviceName=\" run.googleapis.com\" " ;
105
105
106
106
System .out .println (logFilter );
107
- Page <LogEntry > entries = logging .listLogEntries (EntryListOption .filter (logFilter ));
108
107
Boolean found = false ;
109
- for (LogEntry logEntry : entries .iterateAll ()) {
110
- if (!logEntry .getLogName ().contains ("cloudaudit" )) {
111
- Payload <String > payload = logEntry .getPayload ();
112
- if (payload .getData ().contains ("Task" )) {
113
- found = true ;
108
+ // Retry up to 5 times
109
+ for (int i = 1 ; i <= 5 ; i ++) {
110
+ Page <LogEntry > entries = logging .listLogEntries (EntryListOption .filter (logFilter ));
111
+ for (LogEntry logEntry : entries .iterateAll ()) {
112
+ if (!logEntry .getLogName ().contains ("cloudaudit" )) {
113
+ Payload <String > payload = logEntry .getPayload ();
114
+ if (payload .getData ().contains ("Task" )) {
115
+ found = true ;
116
+ break ;
117
+ }
114
118
}
115
119
}
120
+ if (found ) {
121
+ break ;
122
+ }
123
+ TimeUnit .SECONDS .sleep (i * 30 );
116
124
}
117
125
assertTrue ("Log was not found." , found );
118
126
}
You can’t perform that action at this time.
0 commit comments