Skip to content

Commit 8f3f4a2

Browse files
NO-SNOW: made tests fail if example.com request not captured
1 parent bdb2e64 commit 8f3f4a2

File tree

2 files changed

+45
-3
lines changed

2 files changed

+45
-3
lines changed

.github/workflows/build_test.yml

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,50 @@ jobs:
190190
sleep 1
191191
done
192192
193-
# Force mitmproxy to generate CA cert
193+
# Force mitmproxy to generate CA cert and test script capture
194194
curl -x http://127.0.0.1:8080 https://example.com -k || true
195195
196+
# Give script a moment to process the request
197+
sleep 3
198+
199+
# Check if the proxy script is working
200+
script_working=false
201+
202+
# Check log file exists
203+
if [ ! -f "mitm_script.log" ]; then
204+
echo "❌ FATAL: mitm_script.log not created - proxy script failed to start"
205+
exit 1
206+
fi
207+
208+
echo "✅ Log file created, checking contents..."
209+
cat mitm_script.log
210+
211+
# Check if the example.com request was captured in CSV
212+
if [ -f "test_requests.csv" ]; then
213+
echo "✅ CSV file created"
214+
if grep -q "example.com" test_requests.csv; then
215+
echo "✅ example.com request captured - script is working!"
216+
# Remove example.com from CSV since it was just a test
217+
sed -i '/example\.com/d' test_requests.csv
218+
echo "example.com test request removed from CSV"
219+
script_working=true
220+
else
221+
echo "❌ example.com request NOT found in CSV"
222+
echo "CSV contents:"
223+
cat test_requests.csv
224+
fi
225+
else
226+
echo "❌ CSV file not created"
227+
fi
228+
229+
# Fail pipeline if proxy script isn't capturing requests
230+
if [ "$script_working" = false ]; then
231+
echo "❌ FATAL: Proxy script is not capturing requests properly"
232+
echo "Log file contents:"
233+
cat mitm_script.log
234+
exit 1
235+
fi
236+
196237
# Wait for CA cert to be created
197238
timeout=30
198239
while [ ! -f ~/.mitmproxy/mitmproxy-ca-cert.pem ] && [ $timeout -gt 0 ]; do
@@ -288,7 +329,9 @@ jobs:
288329
uses: actions/upload-artifact@v4
289330
with:
290331
name: mitmproxy-artifacts-${{ matrix.os.download_name }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }}
291-
path: test_requests.csv
332+
path: |
333+
test_requests.csv
334+
mitm_script.log
292335
293336
294337
test-olddriver:

ci/github/save_mitm_requests.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ def process_headers_safely(request_headers, response_headers):
174174
IGNORE_DOMAINS = {
175175
"pypi.org",
176176
"files.pythonhosted.org",
177-
"example.com", # Test domain from setup
178177
}
179178

180179

0 commit comments

Comments
 (0)