Skip to content

Commit 16cd99d

Browse files
NO-SNOW: debigging extended. logging to info. also added envs explicite to run tests
1 parent ce96843 commit 16cd99d

File tree

2 files changed

+50
-5
lines changed

2 files changed

+50
-5
lines changed

.github/workflows/build_test.yml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313
workflow_dispatch:
1414
inputs:
1515
logLevel:
16-
default: warning
16+
default: info
1717
description: "Log level"
1818
required: true
1919
tags:
@@ -261,9 +261,27 @@ jobs:
261261
echo "http_proxy=http://127.0.0.1:18453" >> $GITHUB_ENV
262262
echo "https_proxy=http://127.0.0.1:18453" >> $GITHUB_ENV
263263
264+
# Debug: Verify proxy variables are set
265+
echo "=== Proxy Environment Check ==="
266+
echo "HTTP_PROXY=$HTTP_PROXY"
267+
echo "HTTPS_PROXY=$HTTPS_PROXY"
268+
echo "http_proxy=$http_proxy"
269+
echo "https_proxy=$https_proxy"
270+
echo "REQUESTS_CA_BUNDLE=$REQUESTS_CA_BUNDLE"
271+
264272
- name: Run tests
265273
# To run a single test on GHA use the below command:
266-
run: python -m tox run -e `echo py${PYTHON_VERSION/\./}-single-ci | sed 's/ /,/g'`
274+
run: |
275+
echo "=== Test Environment Check ==="
276+
echo "HTTP_PROXY=$HTTP_PROXY"
277+
echo "HTTPS_PROXY=$HTTPS_PROXY"
278+
echo "http_proxy=$http_proxy"
279+
echo "https_proxy=$https_proxy"
280+
echo "REQUESTS_CA_BUNDLE=$REQUESTS_CA_BUNDLE"
281+
echo "=== Testing Proxy Accessibility During Tests ==="
282+
curl -x http://127.0.0.1:18453 http://httpbin.org/get -v || echo "Proxy not accessible during test phase"
283+
echo "=== Starting Tests ==="
284+
python -m tox run -e `echo py${PYTHON_VERSION/\./}-single-ci | sed 's/ /,/g'`
267285
# run: python -m tox run -e `echo py${PYTHON_VERSION/\./}-{extras,unit,integ,pandas,sso}-ci | sed 's/ /,/g'`
268286

269287
env:
@@ -273,6 +291,12 @@ jobs:
273291
TOX_PARALLEL_NO_SPINNER: 1
274292
# To specify the test name (in single test mode) pass this env variable:
275293
SINGLE_TEST_NAME: test/integ/test_put_get.py::test_multipart_put
294+
# Proxy environment variables
295+
HTTP_PROXY: ${{ env.HTTP_PROXY }}
296+
HTTPS_PROXY: ${{ env.HTTPS_PROXY }}
297+
http_proxy: ${{ env.http_proxy }}
298+
https_proxy: ${{ env.https_proxy }}
299+
REQUESTS_CA_BUNDLE: ${{ env.REQUESTS_CA_BUNDLE }}
276300
shell: bash
277301
- name: Stop mitmdump proxy
278302
if: always() && env.PROXY_PID

ci/github/save_mitm_requests.py

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,14 +311,35 @@ def safe_str(value, max_length=5000):
311311
logger.warning("Falling back to stdout output")
312312
logger.info("MITM script loaded and ready to capture requests...")
313313

314+
# Add a global counter to track requests
315+
request_count = 0
316+
last_heartbeat = datetime.now()
317+
318+
319+
def heartbeat_check():
320+
"""Log periodic heartbeat to show script is alive"""
321+
global last_heartbeat, request_count
322+
now = datetime.now()
323+
if (now - last_heartbeat).seconds >= 30: # Every 30 seconds
324+
logger.error(
325+
f"HEARTBEAT: Script alive, processed {request_count} requests so far"
326+
)
327+
last_heartbeat = now
328+
314329

315330
def response(flow):
316331
"""Called when a response is received"""
317-
# Debug logging
332+
global request_count
333+
request_count += 1
334+
heartbeat_check() # Show script is alive
335+
336+
# Debug logging with counter
318337
try:
319338
debug_host = getattr(flow.request, "pretty_host", "unknown")
320339
debug_method = getattr(flow.request, "method", "unknown")
321-
logger.debug(f"Processing {debug_method} request to {debug_host}")
340+
logger.info(
341+
f"[{request_count}] Processing {debug_method} request to {debug_host}"
342+
)
322343
except Exception as debug_error:
323344
logger.error(f"Debug error getting basic request info: {debug_error}")
324345

@@ -412,5 +433,5 @@ def response(flow):
412433

413434
def done():
414435
"""Called when mitmproxy shuts down"""
415-
logger.info("Proxy shutting down...")
436+
logger.info(f"SHUTDOWN: Processed {request_count} total requests")
416437
f.close()

0 commit comments

Comments
 (0)