Skip to content

test: pytransformer pooling contract tests - #6883

Merged
fracasula merged 26 commits into
masterfrom
chore.pyt-contract-tests
Apr 21, 2026
Merged

fracasula merged 26 commits into
masterfrom
chore.pyt-contract-tests

Conversation

@fracasula

@fracasula fracasula commented Apr 14, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Summary

Add contract and backwards-compatibility tests for pytransformer HTTP timeout capping, connection pooling, cookie isolation, and requests module wrapper behaviour. Also simplifies Docker container lifecycle in existing tests (cleanup is now handled by startRudderPytransformer/startOpenFaasFlask internally) and fixes the Slack notification payload format in the scheduled-release workflow.

Test scenarios

HTTP timeout and connection pool (http_timeout_conn_pool_contract_test.go)

  • SANDBOX_HTTP_TIMEOUT_S does not cap internal geolocation traffic (geolocation calls are bound exclusively by GEOLOCATION_TIMEOUT_SECS)
  • User HTTP timeout is capped to SANDBOX_HTTP_TIMEOUT_S when the user-supplied timeout is larger than the sandbox cap
  • User HTTP timeout is honoured when it is smaller than SANDBOX_HTTP_TIMEOUT_S
  • Each bare requests.get() opens a fresh TCP connection when ENABLE_CONN_POOL=false
  • Repeated bare requests.get() calls to the same host reuse the pooled TCP connection when ENABLE_CONN_POOL=true
  • Two requests under distinct transformation_version_ids open separate TCP connections when CONN_POOL_PER_TRANSFORMATION=true (default), even through the same worker subprocess
  • Two requests under distinct transformation_version_ids share a single TCP connection when CONN_POOL_PER_TRANSFORMATION=false
  • A slow-drip response body (headers flushed immediately, body trickled one byte at a time) fires SANDBOX_HTTP_TIMEOUT_S and does not pin the sandbox worker for the full body duration

Cookie isolation (cookie_isolation_contract_test.go)

  • Cookies set by the server on one transformation invocation are never carried over to subsequent invocations on the same shared pooled session (ENABLE_CONN_POOL=true, single worker subprocess)
  • Connection pooling still reuses a single TCP socket across all invocations despite cookie stripping
  • Per-request options (headers, auth, params, cookies, hooks) attached to a bare requests.get() call never persist as session defaults on the shared pooled session, matching old-arch (vanilla requests) behaviour
  • The response-level Set-Cookie is parsed by requests (proof the leak channel exists) but never forwarded to the next call

Bare requests positional params (bare_requests_backwards_compatibility_test.go)

  • requests.get(url, {"q": "hello"}) (second positional = params) produces identical results on old arch, new arch with pool disabled, and new arch with pool enabled
  • requests.post(url, {"q": "hello"}) (second positional = data) produces identical results across all three architectures
  • requests.put(url, {"q": "hello"}) and requests.patch(url, {"q": "hello"}) produce identical results across all three architectures
  • requests.post(url, data, json) with all three arguments passed positionally completes without TypeError on the pooled path and matches old-arch output

requests module wrapper (requests_api_contract_test.go)

  • from requests.api import get (bound at import time) produces identical results to old-arch vanilla requests
  • requests.api.get(url) (attribute chain resolved at call time) produces identical results to old-arch vanilla requests
  • requests.request("GET", url) (verb-parameterized entry point) produces identical results to old-arch vanilla requests
  • All three alternative import paths are tested with both ENABLE_CONN_POOL=false and ENABLE_CONN_POOL=true
  • With ENABLE_CONN_POOL=true, from requests.api import get and requests.request("GET", url) reuse the pooled TCP connection across sequential calls (proving they flow through the pooling wrapper)

Geolocation timeout (geolocation_backwards_compatibility_test.go)

  • Geolocation timeout fires a retryable HTTP 503 (GeolocationServerError inherits BaseException, bypassing user except Exception) rather than a per-event 400

Other changes

  • Simplified Docker container lifecycle in existing backwards-compatibility and geolocation tests (container cleanup now handled internally by helpers)

Linear Ticket

< Fixes PIPE-2902 >

Security

  • The code changed/added as part of this pull request won't create any security issues with how the software is being used.

fracasula and others added 2 commits April 13, 2026 17:54
…connection pool behaviour

Covers 5 scenarios required by tasks/03-contract-tests.md:
- Geo timeout with a shorter sandbox HTTP timeout cap fires first (503 retryable)
- Sandbox cap honoured when user timeout exceeds it (400 non-retryable)
- User timeout honoured when shorter than the sandbox cap (400 non-retryable)
- New TCP connection per request when ENABLE_CONN_POOL=false
- Connection reused across requests when ENABLE_CONN_POOL=true

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@fracasula fracasula changed the title test: geo timeout test: pytransformer pooling contract tests Apr 14, 2026
@fracasula
fracasula marked this pull request as ready for review April 16, 2026 11:57
@codecov

codecov Bot commented Apr 20, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.99%. Comparing base (b7f2b9f) to head (a2ef455).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6883      +/-   ##
==========================================
+ Coverage   79.68%   79.99%   +0.31%     
==========================================
  Files         565      565              
  Lines       63317    63317              
==========================================
+ Hits        50451    50650     +199     
+ Misses       9876     9667     -209     
- Partials     2990     3000      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@fracasula
fracasula merged commit 0530c8c into master Apr 21, 2026
56 checks passed
@fracasula
fracasula deleted the chore.pyt-contract-tests branch April 21, 2026 08:22
mihir20 pushed a commit that referenced this pull request Apr 27, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.74.0-rc.1](v1.73.0...v1.74.0-rc.1)
(2026-04-27)


### Features

* add configurable batch size for bulk inserting failed rsources records
([#6873](#6873))
([d8f6ea0](d8f6ea0))
* add native deletion support for identity removal in gzip files
([#6896](#6896))
([c1e27d0](c1e27d0))
* deep job pickups when no results cache is cold
([#6850](#6850))
([03e9d88](03e9d88))
* **jobsdb:** improve migration compaction
([#6844](#6844))
([b7f2b9f](b7f2b9f))


### Bug Fixes

* add correct host for salesforceBU destination
([#6906](#6906))
([2430cb4](2430cb4))
* batch router drained events metrics
([#6898](#6898))
([c5b2927](c5b2927))
* build action failing
([#6899](#6899))
([691a812](691a812))
* snowpipe struck scenarios
([#6895](#6895))
([35b07a8](35b07a8))
* use tid instead of vid
([#6908](#6908))
([954dcf7](954dcf7))


### Miscellaneous

* avoid marshalling proc error job payloads
([#6872](#6872))
([145826b](145826b))
* bump build-scan-push-action from v2.1.0 to v2.2.0
([#6903](#6903))
([e917f9b](e917f9b))
* contract tests for dns regressions and overrides
([#6864](#6864))
([b105678](b105678))
* pin and bump action refs (SEC-171)
([#6863](#6863))
([8089953](8089953))
* pytransformer pooling contract tests
([#6883](#6883))
([0530c8c](0530c8c))
* scope workflow permissions to least privilege (SEC-167)
([#6911](#6911))
([5600dbe](5600dbe))
* update Slack notification method in scheduled release workflow
([#6879](#6879))
([3b67dcb](3b67dcb))
* **vuln:** zizmor --fix=all findings (SEC-199)
([#6905](#6905))
([d8cc34f](d8cc34f))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
mihir20 pushed a commit that referenced this pull request Apr 28, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.74.0](v1.73.0...v1.74.0)
(2026-04-27)


### Features

* add configurable batch size for bulk inserting failed rsources records
([#6873](#6873))
([d8f6ea0](d8f6ea0))
* add native deletion support for identity removal in gzip files
([#6896](#6896))
([c1e27d0](c1e27d0))
* deep job pickups when no results cache is cold
([#6850](#6850))
([03e9d88](03e9d88))
* **jobsdb:** improve migration compaction
([#6844](#6844))
([b7f2b9f](b7f2b9f))


### Bug Fixes

* add correct host for salesforceBU destination
([#6906](#6906))
([2430cb4](2430cb4))
* batch router drained events metrics
([#6898](#6898))
([c5b2927](c5b2927))
* build action failing
([#6899](#6899))
([691a812](691a812))
* snowpipe struck scenarios
([#6895](#6895))
([35b07a8](35b07a8))
* use tid instead of vid
([#6908](#6908))
([954dcf7](954dcf7))


### Miscellaneous

* avoid marshalling proc error job payloads
([#6872](#6872))
([145826b](145826b))
* bump build-scan-push-action from v2.1.0 to v2.2.0
([#6903](#6903))
([e917f9b](e917f9b))
* contract tests for dns regressions and overrides
([#6864](#6864))
([b105678](b105678))
* pin and bump action refs (SEC-171)
([#6863](#6863))
([8089953](8089953))
* pytransformer pooling contract tests
([#6883](#6883))
([0530c8c](0530c8c))
* scope workflow permissions to least privilege (SEC-167)
([#6911](#6911))
([5600dbe](5600dbe))
* update Slack notification method in scheduled release workflow
([#6879](#6879))
([3b67dcb](3b67dcb))
* **vuln:** zizmor --fix=all findings (SEC-199)
([#6905](#6905))
([d8cc34f](d8cc34f))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants