Require fresh collector evidence in Kubernetes smoke
All checks were successful
deploy / deploy (push) Successful in 15s

This commit is contained in:
philipp 2026-04-18 11:36:11 +02:00
parent 38c7811252
commit 9fc523c0a7

View file

@ -136,6 +136,13 @@ def get_collector_pod(exclude_names=None):
raise TimeoutError(f'no ready collector pod found; last pods={last}') 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): def exec_python(pod, code, args):
command = [kubectl, '-n', namespace, 'exec', '-i', pod, '--', 'python3', '-', *args] command = [kubectl, '-n', namespace, 'exec', '-i', pod, '--', 'python3', '-', *args]
proc, item = capture(command, input_text=code, timeout=wait_seconds + 60) proc, item = capture(command, input_text=code, timeout=wait_seconds + 60)
@ -414,7 +421,8 @@ try:
if rollout['exit_code'] != 0: if rollout['exit_code'] != 0:
raise RuntimeError('collector deployment rollout is not healthy') raise RuntimeError('collector deployment rollout is not healthy')
pod_name, pod_obj = get_collector_pod() 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'] before_mtime = before['mtime']
old_file = before['output_files'][0] old_file = before['output_files'][0]