Skip to content

Add test-env setup script and skill for Claude Code cloud sessions#8065

Open
phacops wants to merge 2 commits into
masterfrom
claude/devservices-devenv-install-2m7nbg
Open

Add test-env setup script and skill for Claude Code cloud sessions#8065
phacops wants to merge 2 commits into
masterfrom
claude/devservices-devenv-install-2m7nbg

Conversation

@phacops

@phacops phacops commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds an on-demand script + skill that prepares an ephemeral Linux container (e.g. a Claude Code cloud session) for running the Snuba test suite, where nothing is installed and the Docker daemon is not running.

This is intentionally a standalone script rather than a session-start hookuv sync plus pulling the clickhouse/redis/kafka images takes several minutes, so we only pay that cost on demand when tests are actually needed.

Changes

  • scripts/setup-test-env.sh — idempotent setup script that:
    1. Installs sentry-devenv via the official bash installer
    2. Runs uv sync --frozen --active, which creates .venv and compiles the native rust_snuba extension into it (no separate maturin develop needed); devservices comes along as a dev dependency
    3. Starts the Docker daemon (sudo dockerd) if it isn't already running
    4. Brings up devservices (clickhouse, redis, kafka)
  • .claude/skills/setup-test-env/SKILL.md — companion skill so the environment can be set up on demand, documenting the correct test invocation.
  • devservices/config.yml — lower the clickhouse nofile ulimit from 262144 to soft 1024 / hard 4096 so the container can start in environments without CAP_SYS_RESOURCE (the previous value cannot be applied there and made clickhouse fail to start).

Notes / gotchas

  • pytest must be run from inside tests/. Invoking it from the repo root loads test_distributed_migrations/conftest.py, whose pytest_configure connects to a multi-node clickhouse host (clickhouse-query) that single-node devservices doesn't provide, causing an INTERNALERROR before any test runs. Documented in the skill:
    (cd tests && SNUBA_SETTINGS=test ../.venv/bin/pytest <path/to/test_file.py> -m "not ci_only")
  • devenv refuses to run as root and devenv sync is Homebrew-based, so in the cloud container the functional path is uv sync + devservices, not devenv sync. The global devenv install is included only for parity with local laptop setups.

Validation

  • ✅ Setup script runs end-to-end and is idempotent; clickhouse/redis/kafka all report healthy
  • ruff check passes
  • ✅ Tests pass (2 passed) using the documented invocation

🤖 Generated with Claude Code

https://claude.ai/code/session_01CutWwsFwLDtczduJzjvF8Y


Generated by Claude Code

Add an on-demand setup script (scripts/setup-test-env.sh) plus a
companion skill that prepare an ephemeral Linux container (e.g. a Claude
Code cloud session) for running the test suite:

- install sentry-devenv via the official bash installer
- run `uv sync` (builds the venv and compiles the rust_snuba extension)
- start the Docker daemon if needed
- bring up devservices (clickhouse, redis, kafka)

This is a standalone script rather than a session-start hook so the
multi-minute cost is only paid when tests are actually needed.

Lower the clickhouse `nofile` ulimit in devservices/config.yml to
soft 1024 / hard 4096 so the container can start in environments without
CAP_SYS_RESOURCE (the previous 262144 cannot be applied there).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01CutWwsFwLDtczduJzjvF8Y
@phacops phacops requested a review from a team as a code owner June 18, 2026 17:19
Comment thread devservices/config.yml
@linear-code

linear-code Bot commented Jun 28, 2026

Copy link
Copy Markdown

EAP-573

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.

2 participants