@@ -183,7 +183,16 @@ func deleteAllPods(t *testing.T, namespace string) {
183
183
t .Log (errPod )
184
184
}
185
185
186
- func checkPodsLogs (t * testing.T , kubeClient * kubernetes.Clientset , message string , newLogsOnly ... bool ) {
186
+ func logLineTime (t * testing.T , pattern string ) time.Time {
187
+ str := checkPodsLogs (t , clientset , `\d+:\d+:\d+\.\d+.*` + pattern )
188
+ str = strings .Split (str , "." )[0 ]
189
+ time1 , err := time .Parse ("15:04:05" , str )
190
+ e (t , err , "time parsing fail" )
191
+ return time1
192
+
193
+ }
194
+
195
+ func checkPodsLogs (t * testing.T , kubeClient * kubernetes.Clientset , message string , newLogsOnly ... bool ) string {
187
196
r , _ := regexp .Compile (message )
188
197
newPods , err := kubeClient .CoreV1 ().Pods ("openshift-insights" ).List (metav1.ListOptions {})
189
198
if err != nil {
@@ -194,6 +203,7 @@ func checkPodsLogs(t *testing.T, kubeClient *kubernetes.Clientset, message strin
194
203
if len (newLogsOnly )== 1 && newLogsOnly [0 ] {
195
204
logOptions = & corev1.PodLogOptions {SinceTime :& timeNow }
196
205
}
206
+ result := ""
197
207
for _ , newPod := range newPods .Items {
198
208
pod , err := kubeClient .CoreV1 ().Pods ("openshift-insights" ).Get (newPod .Name , metav1.GetOptions {})
199
209
if err != nil {
@@ -214,7 +224,7 @@ func checkPodsLogs(t *testing.T, kubeClient *kubernetes.Clientset, message strin
214
224
}
215
225
log := buf .String ()
216
226
217
- result : = r .FindString (log ) //strings.Contains(log, message)
227
+ result = r .FindString (log ) //strings.Contains(log, message)
218
228
if result == "" {
219
229
t .Logf ("No %s in logs\n " , message )
220
230
t .Logf ("Logs for verification: ****\n %s" , log )
@@ -228,6 +238,7 @@ func checkPodsLogs(t *testing.T, kubeClient *kubernetes.Clientset, message strin
228
238
t .Error (errLog )
229
239
}
230
240
}
241
+ return result
231
242
}
232
243
233
244
func forceUpdateSecret (ns string , secretName string , secret * v1.Secret ) error {
0 commit comments