fix: inttest runner crash and minio bucket-init proxy issue
- Remove --profiling-output arg from runner.yaml (plugin uses default path)
- Inline profiling hooks in root conftest.py with graceful fallback
- Replace mc-based bucket-init with Python urllib (no proxy interference)
- Add explicit ProxyHandler({}) to guarantee no proxy usage in bucket-init
This commit is contained in:
+45
-13
@@ -129,8 +129,8 @@ spec:
|
||||
type: RuntimeDefault
|
||||
restartPolicy: OnFailure
|
||||
containers:
|
||||
- name: mc
|
||||
image: minio/mc:latest
|
||||
- name: bucket-init
|
||||
image: registry.celestium.life/dockerhub-cache/library/python:3.12-slim
|
||||
imagePullPolicy: IfNotPresent
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
@@ -143,23 +143,55 @@ spec:
|
||||
limits:
|
||||
cpu: 250m
|
||||
memory: 128Mi
|
||||
command: ["/bin/sh", "-c"]
|
||||
env:
|
||||
- name: HTTP_PROXY
|
||||
value: ""
|
||||
- name: HTTPS_PROXY
|
||||
value: ""
|
||||
- name: http_proxy
|
||||
value: ""
|
||||
- name: https_proxy
|
||||
value: ""
|
||||
- name: NO_PROXY
|
||||
value: "minio,.local,10.0.0.0/8,192.168.0.0/16"
|
||||
value: "*"
|
||||
- name: no_proxy
|
||||
value: "minio,.local,10.0.0.0/8,192.168.0.0/16"
|
||||
value: "*"
|
||||
command: ["python", "-c"]
|
||||
args:
|
||||
- |
|
||||
echo "Waiting for MinIO to be ready..."
|
||||
until mc alias set sandbox http://minio:9000 minioadmin minioadmin 2>/dev/null; do
|
||||
echo "MinIO not ready, retrying in 2s..."
|
||||
sleep 2
|
||||
done
|
||||
echo "MinIO is ready. Creating bucket..."
|
||||
mc mb --ignore-existing sandbox/stonks-normalized
|
||||
echo "Bucket stonks-normalized created successfully."
|
||||
import urllib.request, urllib.error, time
|
||||
|
||||
# Disable all proxy usage in urllib
|
||||
no_proxy_handler = urllib.request.ProxyHandler({})
|
||||
opener = urllib.request.build_opener(no_proxy_handler)
|
||||
urllib.request.install_opener(opener)
|
||||
|
||||
endpoint = "http://minio:9000"
|
||||
max_wait = 60
|
||||
|
||||
# Wait for MinIO readiness
|
||||
print("Waiting for MinIO to be ready...")
|
||||
start = time.time()
|
||||
while time.time() - start < max_wait:
|
||||
try:
|
||||
r = urllib.request.urlopen(f"{endpoint}/minio/health/ready", timeout=3)
|
||||
if r.status == 200:
|
||||
print("MinIO is ready.")
|
||||
break
|
||||
except Exception:
|
||||
pass
|
||||
time.sleep(2)
|
||||
else:
|
||||
raise SystemExit("MinIO did not become ready within 60s")
|
||||
|
||||
# Create bucket via S3 PUT request
|
||||
bucket = "stonks-normalized"
|
||||
req = urllib.request.Request(f"{endpoint}/{bucket}", method="PUT")
|
||||
try:
|
||||
urllib.request.urlopen(req, timeout=5)
|
||||
print(f"Bucket '{bucket}' created successfully.")
|
||||
except urllib.error.HTTPError as e:
|
||||
if e.code == 409:
|
||||
print(f"Bucket '{bucket}' already exists.")
|
||||
else:
|
||||
raise
|
||||
|
||||
@@ -49,7 +49,6 @@ spec:
|
||||
- "-v"
|
||||
- "--tb=short"
|
||||
- "--junitxml=/tmp/results.xml"
|
||||
- "--profiling-output=/tmp/profiling-report.json"
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
readOnlyRootFilesystem: true
|
||||
|
||||
Reference in New Issue
Block a user