diff --git a/scripts/k8s_runtime_smoke_check.sh b/scripts/k8s_runtime_smoke_check.sh index 08495cb..6daea5d 100755 --- a/scripts/k8s_runtime_smoke_check.sh +++ b/scripts/k8s_runtime_smoke_check.sh @@ -136,6 +136,13 @@ def get_collector_pod(exclude_names=None): raise TimeoutError(f'no ready collector pod found; last pods={last}') +def pod_start_epoch(pod): + timestamp = pod.get('status', {}).get('startTime') or pod.get('metadata', {}).get('creationTimestamp') + if not timestamp: + return 0 + return dt.datetime.fromisoformat(timestamp.replace('Z', '+00:00')).timestamp() + + def exec_python(pod, code, args): command = [kubectl, '-n', namespace, 'exec', '-i', pod, '--', 'python3', '-', *args] proc, item = capture(command, input_text=code, timeout=wait_seconds + 60) @@ -414,7 +421,8 @@ try: if rollout['exit_code'] != 0: raise RuntimeError('collector deployment rollout is not healthy') pod_name, pod_obj = get_collector_pod() - before = wait_for_valid_collector(pod_name, 0, 'initial') + initial_after_mtime = max(0, pod_start_epoch(pod_obj) - 5) + before = wait_for_valid_collector(pod_name, initial_after_mtime, 'initial') before_mtime = before['mtime'] old_file = before['output_files'][0]