Use with-connect for Posit Connect integration tests#242
Closed
edavidaja wants to merge 11 commits into
Closed
Conversation
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
…ements.txt generation
Collaborator
Author
|
Superseded by #243, opened from a branch in this repo (rather than my fork) so the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Replaces vetiver's bespoke Connect-in-Docker test harness (
docker-compose.yml+script/setup-rsconnect/user bootstrap) withposit-dev/with-connect, the shared tool for running Posit Connect in CI. The Connect integration test now readsCONNECT_SERVER/CONNECT_API_KEYfrom 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 defaultmake testcollection 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 oncontent_url.vetiver/server.py—predict()now setsContent-Type: application/jsonon the DataFrame branch. Without it,vetiver.predict(endpoint, df)returns 422 against current FastAPI/pydantic-v2 Connect (thejson=branches were unaffected). This is a real user-facing fix the migration surfaced; the test exercises the real path rather than working around it.Makefile—make test-rscboots Connect viawith-connect; removeddev/dev-start/dev-stopandRSC_API_KEYS..github/workflows/tests.yml—test-connectjob uses thewith-connectAction..github/workflows/weekly.yml— rsconnect canary jobs use the Action (with a failure-notification issue); pins-only jobs no longer start Connect.docker-compose.yml,script/setup-rsconnect/,vetiver/tests/rsconnect_api_keys.json.Notes
with-connectis pinned to commit0783dabd(no release tags exist yet).requirements.txtis filtered (drop editable/local vetiver, append plainvetiver) in the Makefile and weekly jobs, where vetiver isn't installable from a remote. The per-PRtest-connectjob intentionally keeps a plain freeze so it deploys this PR's vetiver via itsgit+...@<sha>install — see the inline comment.with-connect.test_monitor.py/test_prepare_docker.pycollection errors andtest_server.py::test_endpoint_adds(a directclient.postwith the same Content-Type root cause).rsconnect-pythonchanges that drop its vetiver-specific test baggage.