Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
09f51d1
NO-SNOW: mitm proxy on gh
sfc-gh-fpawlowski Jun 28, 2025
90b0484
NO-SNOW: mitm proxy on gh
sfc-gh-fpawlowski Jun 28, 2025
1467f54
Merge branch 'main' into fpawlowski/run-mitm-proxy
sfc-gh-fpawlowski Jun 28, 2025
bdce207
NO-SNOW: race cond fix
sfc-gh-fpawlowski Jun 28, 2025
6bd7bd1
NO-SNOW: java cert fix
sfc-gh-fpawlowski Jun 28, 2025
853e184
NO-SNOW: certs fix - mitm just before the real tests run
sfc-gh-fpawlowski Jun 28, 2025
d56a4d4
NO-SNOW: stop mitm afterwards
sfc-gh-fpawlowski Jun 28, 2025
5ec6574
NO-SNOW: stop mitm afterwards
sfc-gh-fpawlowski Jun 28, 2025
625a18c
NO-SNOW: stop mitm afterwards
sfc-gh-fpawlowski Jun 28, 2025
b0bce1e
NO-SNOW: dump requests not the whole logs
sfc-gh-fpawlowski Jun 28, 2025
04728a1
NO-SNOW: Save using script
sfc-gh-fpawlowski Jun 28, 2025
864ed03
NO-SNOW: ignore some reqs and masks secrets
sfc-gh-fpawlowski Jun 28, 2025
b216d2e
NO-SNOW: seecret detector fix
sfc-gh-fpawlowski Jun 28, 2025
65a2825
NO-SNOW: seecret detector direct import
sfc-gh-fpawlowski Jun 28, 2025
c3cf074
NO-SNOW: deal with error unicode etc
sfc-gh-fpawlowski Jun 28, 2025
3195bd3
NO-SNOW: PREVIOUS COMMIT WORKS!
sfc-gh-fpawlowski Jun 28, 2025
46798c2
NO-SNOW: made it run all test
sfc-gh-fpawlowski Jun 28, 2025
4d31561
NO-SNOW: try fix azure having unicode issues and windows not showing
sfc-gh-fpawlowski Jun 28, 2025
04ca232
NO-SNOW: logging and no more logs in file
sfc-gh-fpawlowski Jun 28, 2025
8e1eefa
NO-SNOW: go back to single test
sfc-gh-fpawlowski Jun 28, 2025
ef5a649
NO-Snow: some solutio
sfc-gh-fpawlowski Jun 28, 2025
bdb2e64
NO-SNOW: refactor - PREVIOUS FIXES AZURE
sfc-gh-fpawlowski Jun 28, 2025
8f3f4a2
NO-SNOW: made tests fail if example.com request not captured
sfc-gh-fpawlowski Jun 28, 2025
755795f
NO-SNOW: keep only header
sfc-gh-fpawlowski Jun 29, 2025
42bb1f8
NO-SNOW: change proxy port to avoid conflict. preserve proxy envs fix…
sfc-gh-fpawlowski Jun 29, 2025
ce96843
NO-SNOW: stop removing the csv file
sfc-gh-fpawlowski Jun 29, 2025
16cd99d
NO-SNOW: debigging extended. logging to info. also added envs explici…
sfc-gh-fpawlowski Jun 29, 2025
f64e215
NO-SNOW: revert gh conflict of envs declarations
sfc-gh-fpawlowski Jun 29, 2025
0897218
NO-SNOW: test env.GITHUB_ENV and bash
sfc-gh-fpawlowski Jun 29, 2025
e7b1b30
Revert "NO-SNOW: test env.GITHUB_ENV and bash"
sfc-gh-fpawlowski Jun 29, 2025
95f9b40
NO-SNOW: test env.GITHUB_ENV and bash
sfc-gh-fpawlowski Jun 29, 2025
2e81d0a
NO-SNOW: env.GITHUB_ENV reverted
sfc-gh-fpawlowski Jun 29, 2025
993165f
NO-SNOW: refactored - remove noise
sfc-gh-fpawlowski Jun 29, 2025
a9cfc63
NO-SNOW: ALL TESTS RUN
sfc-gh-fpawlowski Jun 29, 2025
f296adb
NO-SNOW: arrow chunks
sfc-gh-fpawlowski Jun 30, 2025
dcfed06
Merge branch 'main' into fpawlowski/run-mitm-proxy
sfc-gh-fpawlowski Jul 22, 2025
58e51d3
Test put get
sfc-gh-fpawlowski Jul 22, 2025
a1e0e9d
Test put get
sfc-gh-fpawlowski Jul 22, 2025
3cae75e
add body to data
sfc-gh-fpawlowski Jul 22, 2025
ffc8248
add body to data
sfc-gh-fpawlowski Jul 22, 2025
0aacb98
add body to data
sfc-gh-fpawlowski Jul 22, 2025
0ee0b08
Merge branch 'main' into fpawlowski/run-mitm-proxy
sfc-gh-fpawlowski Jul 23, 2025
bff8f08
SNOW-2211783: detect in tests s3 redirects throwing 403 (#2428)
sfc-gh-fpawlowski Jul 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
159 changes: 155 additions & 4 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,19 +170,160 @@ jobs:
run: python -m pip install -U setuptools pip wheel
- name: Install tox
run: python -m pip install tox>=4

- name: Install mitmproxy
run: python -m pip install mitmproxy
- name: Start mitmdump proxy
run: |
echo "Starting proxy..."
nohup mitmdump --mode regular --listen-port 18453 \
-s ci/github/save_mitm_requests.py \
--set termlog_verbosity=warn &
echo "PROXY_PID=$!" >> $GITHUB_ENV

# Wait for proxy to be ready
for i in {1..10}; do
if curl -s --connect-timeout 3 http://127.0.0.1:18453 > /dev/null 2>&1; then
echo "Proxy is ready"
break
fi
sleep 1
done

# Force mitmproxy to generate CA cert and test script capture
curl -x http://127.0.0.1:18453 "https://example.com/?this_request_will_not_occur_in_real_driver_operation=true&github_actions_proxy_test=true&purpose=mitmproxy_verification_and_cert_creation" -k || true

# Give script a moment to process the request
sleep 3

# Check if the proxy script is working
script_working=false

# Check log file exists
if [ ! -f "mitm_script.log" ]; then
echo "❌ FATAL: mitm_script.log not created - proxy script failed to start"
exit 1
fi

echo "✅ Log file created, checking contents..."
cat mitm_script.log

# Check if the example.com request was captured in CSV
if [ -f "test_requests.csv" ]; then
echo "✅ CSV file created"
if grep -q "example.com" test_requests.csv; then
echo "✅ example.com request captured - script is working!"
script_working=true
else
echo "❌ example.com request NOT found in CSV"
echo "CSV contents:"
cat test_requests.csv
fi
else
echo "❌ CSV file not created"
fi

# Fail pipeline if proxy script isn't capturing requests
if [ "$script_working" = false ]; then
echo "❌ FATAL: Proxy script is not capturing requests properly"
echo "Log file contents:"
cat mitm_script.log
exit 1
fi

# Wait for CA cert to be created
timeout=30
while [ ! -f ~/.mitmproxy/mitmproxy-ca-cert.pem ] && [ $timeout -gt 0 ]; do
echo "Waiting for CA cert... ($timeout seconds left)"
sleep 1
timeout=$((timeout - 1))
done

if [ ! -f ~/.mitmproxy/mitmproxy-ca-cert.pem ]; then
echo "CA certificate was not created!"
echo "Contents of ~/.mitmproxy/:"
ls -la ~/.mitmproxy/ || echo "Directory doesn't exist"
exit 1
fi
echo "CA certificate found, proxy running and ready"
shell: bash

- name: Export mitmproxy CA cert
run: |
mkdir -p ~/ca-cert
cp ~/.mitmproxy/mitmproxy-ca-cert.pem ~/ca-cert/
echo "CA cert copied to ~/ca-cert/"
shell: bash

- name: Set proxy variables
run: |
# Set proxy variables for subsequent steps
echo "HTTP_PROXY=http://127.0.0.1:18453" >> $GITHUB_ENV
echo "HTTPS_PROXY=http://127.0.0.1:18453" >> $GITHUB_ENV
echo "http_proxy=http://127.0.0.1:18453" >> $GITHUB_ENV
echo "https_proxy=http://127.0.0.1:18453" >> $GITHUB_ENV
echo "REQUESTS_CA_BUNDLE=$HOME/ca-cert/mitmproxy-ca-cert.pem" >> $GITHUB_ENV
shell: bash

- name: Run tests
# To run a single test on GHA use the below command:
# run: python -m tox run -e `echo py${PYTHON_VERSION/\./}-single-ci | sed 's/ /,/g'`
run: python -m tox run -e `echo py${PYTHON_VERSION/\./}-{extras,unit-parallel,integ-parallel,pandas-parallel,sso}-ci | sed 's/ /,/g'`
run: python -m tox run -e `echo py${PYTHON_VERSION/\./}-single-ci | sed 's/ /,/g'`
# run: python -m tox run -e `echo py${PYTHON_VERSION/\./}-{extras,unit-parallel,integ-parallel,pandas-parallel,sso}-ci | sed 's/ /,/g'`

env:
PYTHON_VERSION: ${{ matrix.python-version }}
cloud_provider: ${{ matrix.cloud-provider }}
PYTEST_ADDOPTS: --color=yes --tb=short
TOX_PARALLEL_NO_SPINNER: 1
# To specify the test name (in single test mode) pass this env variable:
# SINGLE_TEST_NAME: test/path/filename.py::test_name

# To specify the test name (in single test mode) pass this env variable:
SINGLE_TEST_NAME: test/integ/test_large_put.py::test_put_copy_large_files


# Proxy environment variables
HTTP_PROXY: ${{ env.HTTP_PROXY }}
HTTPS_PROXY: ${{ env.HTTPS_PROXY }}
REQUESTS_CA_BUNDLE: ${{ env.REQUESTS_CA_BUNDLE }}
shell: bash
- name: Stop mitmdump proxy
if: always() && env.PROXY_PID
run: |
echo "Stopping proxy after test execution..."
if [ -n "$PROXY_PID" ]; then
if kill -0 $PROXY_PID 2>/dev/null; then
echo "Stopping proxy with PID $PROXY_PID"
kill $PROXY_PID || true
# Wait for process to stop gracefully
for i in {1..10}; do
if ! kill -0 $PROXY_PID 2>/dev/null; then
echo "Proxy stopped gracefully"
break
fi
sleep 1
done
# Force kill if still running
if kill -0 $PROXY_PID 2>/dev/null; then
echo "Force killing proxy"
kill -9 $PROXY_PID || true
fi
else
echo "Proxy process not running"
fi
else
echo "No proxy PID found in environment"
fi

echo "Proxy stopped"

# Clear proxy environment variables for subsequent steps
echo "HTTP_PROXY=" >> $GITHUB_ENV
echo "HTTPS_PROXY=" >> $GITHUB_ENV
echo "http_proxy=" >> $GITHUB_ENV
echo "https_proxy=" >> $GITHUB_ENV
echo "REQUESTS_CA_BUNDLE=" >> $GITHUB_ENV
echo "Proxy environment variables cleared"
shell: bash

- name: Combine coverages
run: python -m tox run -e coverage --skip-missing-interpreters false
shell: bash
Expand All @@ -200,6 +341,16 @@ jobs:
path: |
.tox/junit.*.xml

- name: Upload mitmproxy artifacts
if: always() && env.PROXY_PID
uses: actions/upload-artifact@v4
with:
name: mitmproxy-artifacts-${{ matrix.os.download_name }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }}
path: |
test_requests.csv
mitm_script.log


test-olddriver:
name: Old Driver Test ${{ matrix.os.download_name }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }}
needs: lint
Expand Down
Loading
Loading