Skip to content

Use with-connect for Posit Connect integration tests#242

Closed
edavidaja wants to merge 11 commits into
rstudio:mainfrom
edavidaja:connect-test-simplification
Closed

Use with-connect for Posit Connect integration tests#242
edavidaja wants to merge 11 commits into
rstudio:mainfrom
edavidaja:connect-test-simplification

Conversation

@edavidaja

Copy link
Copy Markdown
Collaborator

What & why

Replaces vetiver's bespoke Connect-in-Docker test harness (docker-compose.yml + script/setup-rsconnect/ user bootstrap) with posit-dev/with-connect, the shared tool for running Posit Connect in CI. The Connect integration test now reads CONNECT_SERVER/CONNECT_API_KEY from the environment and derives the pin namespace from the authenticated user, so vetiver no longer maintains its own Connect provisioning scripts.

Design and implementation plan are included under docs/superpowers/.

Changes

  • vetiver/tests/test_rsconnect.py — read creds from env (lazy, so the default make test collection doesn't require them), single admin user, runtime-derived username (<user>/model). Updated for current rsconnect-python (content_list), fresh-container deploys (new=True), and a trailing-slash fix on content_url.
  • vetiver/server.pypredict() now sets Content-Type: application/json on the DataFrame branch. Without it, vetiver.predict(endpoint, df) returns 422 against current FastAPI/pydantic-v2 Connect (the json= branches were unaffected). This is a real user-facing fix the migration surfaced; the test exercises the real path rather than working around it.
  • Makefilemake test-rsc boots Connect via with-connect; removed dev/dev-start/dev-stop and RSC_API_KEYS.
  • .github/workflows/tests.ymltest-connect job uses the with-connect Action.
  • .github/workflows/weekly.yml — rsconnect canary jobs use the Action (with a failure-notification issue); pins-only jobs no longer start Connect.
  • Deleted docker-compose.yml, script/setup-rsconnect/, vetiver/tests/rsconnect_api_keys.json.

Notes

  • with-connect is pinned to commit 0783dabd (no release tags exist yet).
  • The deployed requirements.txt is filtered (drop editable/local vetiver, append plain vetiver) in the Makefile and weekly jobs, where vetiver isn't installable from a remote. The per-PR test-connect job intentionally keeps a plain freeze so it deploys this PR's vetiver via its git+...@<sha> install — see the inline comment.
  • The local integration test was verified passing repeatedly via with-connect.
  • Pre-existing, unrelated failures in this repo (not touched here): test_monitor.py/test_prepare_docker.py collection errors and test_server.py::test_endpoint_adds (a direct client.post with the same Content-Type root cause).
  • Pairs with forthcoming rsconnect-python changes that drop its vetiver-specific test baggage.

edavidaja added 11 commits June 30, 2026 14:36
Adopt posit-dev/with-connect in both repos, move vetiver's Connect tests
fully into vetiver, strip vetiver-specific test baggage from rsconnect-python
(re-homing its own system-caches integration test), and relabel the
deploy_python_fastapi compatibility shim rather than removing it.
Replaces the bespoke docker-compose credential setup (hardcoded
localhost:3939 + JSON key file with named users) with env-var
credentials provided by with-connect. Credentials are read lazily
at module scope via os.environ.get() to avoid KeyError during
normal test collection when CONNECT_SERVER / CONNECT_API_KEY are
not set.

Additional fixes needed for compatibility with rsconnect-python 1.29.x
and FastAPI 0.138.x / pydantic v2:
- content_search() renamed to content_list()
- new=True required to avoid stale AppStore GUID across fresh containers
- content_url may include a trailing slash; strip before appending /predict
- Content-Type: application/json required; modern FastAPI/pydantic v2 no
  longer accepts JSON body without explicit content-type header
- remove RSC_API_KEYS variable and dev/dev-start/dev-stop/$(RSC_API_KEYS) targets
- test-rsc now boots Connect via pinned with-connect (0783dab)
- generate requirements.txt via uv run pip freeze, filtering editable/local
  vetiver entries and appending plain 'vetiver' so Connect can pip-install it
- invoke pytest via uv run --with pytest on the specific test file to avoid
  collection errors in unrelated test files
@edavidaja

Copy link
Copy Markdown
Collaborator Author

Superseded by #243, opened from a branch in this repo (rather than my fork) so the Test Posit Connect job and the Docs/Netlify deployment can run with repo secrets.

@edavidaja edavidaja closed this Jun 30, 2026
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.

1 participant