Skip to content

Commit 05c613c

Browse files
committed
Run E2E upload test in CI and improve diagnostics
1 parent 10158bc commit 05c613c

File tree

3 files changed

+61
-2
lines changed

3 files changed

+61
-2
lines changed

.github/workflows/ci.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,54 @@ jobs:
8989
path: |
9090
coverage.json
9191
htmlcov/
92+
93+
python-e2e:
94+
runs-on: ubuntu-latest
95+
needs: python
96+
env:
97+
PYTHON_SDK_E2E: "1"
98+
TRANSLOADIT_KEY: ${{ secrets.TRANSLOADIT_E2E_KEY }}
99+
TRANSLOADIT_SECRET: ${{ secrets.TRANSLOADIT_E2E_SECRET }}
100+
steps:
101+
- uses: actions/checkout@v4
102+
103+
- uses: actions/setup-node@v4
104+
with:
105+
node-version: '20'
106+
- name: Install Transloadit CLI
107+
run: npm install -g transloadit
108+
109+
- name: Set up Python
110+
uses: actions/setup-python@v4
111+
with:
112+
python-version: '3.12'
113+
architecture: x64
114+
cache: 'pip'
115+
116+
- name: Install Poetry
117+
run: pip install --upgrade poetry
118+
119+
- name: Export optional Transloadit overrides
120+
run: |
121+
if [ -n "${{ secrets.TRANSLOADIT_E2E_HOST }}" ]; then
122+
echo "TRANSLOADIT_HOST=${{ secrets.TRANSLOADIT_E2E_HOST }}" >> "$GITHUB_ENV"
123+
fi
124+
if [ -n "${{ secrets.TRANSLOADIT_E2E_REGION }}" ]; then
125+
echo "TRANSLOADIT_REGION=${{ secrets.TRANSLOADIT_E2E_REGION }}" >> "$GITHUB_ENV"
126+
fi
127+
128+
- name: Install dependencies
129+
run: poetry install
130+
131+
- name: Ensure credentials present
132+
run: |
133+
if [ -z "$TRANSLOADIT_KEY" ] || [ -z "$TRANSLOADIT_SECRET" ]; then
134+
echo "TRANSLOADIT_E2E_KEY/TRANSLOADIT_E2E_SECRET secrets must be configured for the E2E job" >&2
135+
exit 1
136+
fi
137+
138+
- name: Run E2E upload test
139+
env:
140+
TEST_NODE_PARITY: 0
141+
run: |
142+
poetry run pytest tests/test_e2e_upload.py -q --maxfail=1

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ This script will:
6060
- install Poetry, Node.js 20, and the Transloadit CLI
6161
- pass credentials from `.env` (if present) so end-to-end tests can run against real Transloadit accounts
6262

63-
Signature parity tests use `npx transloadit smart_sig` under the hood, matching the reference implementation used by our other SDKs.
63+
Signature parity tests use `npx transloadit smart_sig` under the hood, matching the reference implementation used by our other SDKs. Our GitHub Actions workflow also runs the E2E upload against Python 3.12 on every push/PR using a dedicated Transloadit test account.
6464

6565
Pass `--python 3.12` (or set `PYTHON_VERSIONS`) to restrict the matrix, or append a custom command after `--`, for example `scripts/test-in-docker.sh -- pytest -k smartcdn`.
6666

tests/test_e2e_upload.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def _build_service():
2929
return None
3030

3131

32-
def test_e2e_image_resize(tmp_path):
32+
def test_e2e_image_resize():
3333
key = os.getenv("TRANSLOADIT_KEY")
3434
secret = os.getenv("TRANSLOADIT_SECRET")
3535

@@ -63,6 +63,9 @@ def test_e2e_image_resize(tmp_path):
6363
response = assembly.create(wait=True, resumable=False)
6464

6565
data = response.data
66+
assembly_ssl_url = data.get("assembly_ssl_url") or data.get("assembly_url")
67+
assembly_id = data.get("assembly_id")
68+
print(f"[python-sdk][e2e] Assembly URL: {assembly_ssl_url} (id={assembly_id})")
6669
assert data.get("ok") == "ASSEMBLY_COMPLETED", data
6770

6871
uploads = data.get("uploads") or []
@@ -91,3 +94,8 @@ def test_e2e_image_resize(tmp_path):
9194
height = int(height)
9295
assert width and height, f"Missing dimensions in result metadata: {meta}"
9396
assert 0 < width <= 128 and 0 < height <= 128
97+
print(
98+
"[python-sdk][e2e] Result dimensions: "
99+
f"{width}x{height}, ssl_url={ssl_url}, basename={upload_info.get('basename')}, "
100+
f"filename={upload_info.get('name')}"
101+
)

0 commit comments

Comments
 (0)