| name | local-integration-test |
| description | Use when testing CLI changes against the local backend before committing. Covers building with local endpoint, authenticating, and driving every command group with verification. |
Local Integration Test — CLI
End-to-end integration test of the CLI against a locally-running backend. Builds the binary
with localhost API URL, authenticates, and drives every command group to verify the full
stack works before committing.
Prerequisites
docker ps | grep -E "ravi_backend|ravi_db|ravi_cache"
curl -s -o /dev/null -w "%{http_code}" http://localhost:8000/
go version
Step 1: Build with Local Endpoint
cd /path/to/cli
make build API_URL=http://localhost:8000
API URL is baked in at build time via ldflags (internal/version.APIBaseURL). The binary
at ./bin/ravi will always talk to localhost after this.
Step 2: Authenticate
API keys from the production server will not work with the local server. You must re-login.
./bin/ravi auth login
After login, verify:
./bin/ravi auth status
Verify config:
cat ~/.ravi/config.json | python3 -m json.tool
Key concept: Login does two things: (1) device flow → management key, (2) identity bind
→ identity key scoped to the active identity.
Step 3: Test Matrix
Run each group sequentially. Each step depends on prior steps being healthy.
3.1 Identity Commands
./bin/ravi identity list
./bin/ravi identity create --name "Test Agent"
./bin/ravi identity use <full-uuid-from-create>
./bin/ravi auth status
./bin/ravi identity use <original-uuid>
Verify: ~/.ravi/config.json should update identity_key on each identity switch
(new key scoped to the new identity).
3.2 Get Email/Phone
./bin/ravi get email
./bin/ravi get phone
3.3 Inbox Commands
./bin/ravi inbox email
./bin/ravi inbox email --unread
./bin/ravi inbox sms
./bin/ravi message sms
./bin/ravi message email nonexistent-id
3.4 Passwords CRUD
./bin/ravi passwords create testsite.com \
--username "user@example.com" --password "SuperSecret123!" --notes "test"
./bin/ravi passwords get <uuid>
./bin/ravi passwords list
./bin/ravi passwords update <uuid> --password "NewPassword!" --notes "updated"
./bin/ravi passwords get <uuid>
./bin/ravi passwords generate --length 32
./bin/ravi passwords delete <uuid>
3.5 Secrets CRUD
./bin/ravi secrets set MY_API_KEY "sk-test-12345"
./bin/ravi secrets get MY_API_KEY
./bin/ravi secrets set MY_API_KEY "sk-updated-67890"
./bin/ravi secrets get MY_API_KEY
./bin/ravi secrets list
./bin/ravi secrets delete <uuid>
3.6 Error Cases
./bin/ravi passwords get 00000000-0000-0000-0000-000000000000
./bin/ravi secrets get NONEXISTENT_KEY
./bin/ravi secrets delete 00000000-0000-0000-0000-000000000000
3.7 Cross-Identity Isolation
./bin/ravi identity use <other-identity-uuid>
./bin/ravi passwords list
./bin/ravi secrets list
./bin/ravi identity use <original-uuid>
Step 4: Run Unit Tests
make test
Step 5: Cleanup
Delete any test identities/entries created during testing:
./bin/ravi passwords list
./bin/ravi secrets list
Limitations
| Limitation | Reason |
|---|
| Cannot send emails | No SendGrid credentials locally |
| Cannot provision phones | No Twilio credentials locally |
| SSE streams may not work | Requires REDIS_URL set on the dev server |
| Cannot test SMS sending | No phone number provisioned locally |
Common Failures
| Symptom | Cause | Fix |
|---|
| "401 Unauthorized" on every command | API keys from production, not local | Re-login: ./bin/ravi auth login |
| "API URL not configured" | Built without API_URL | Rebuild: make build API_URL=http://localhost:8000 |
| 402 on identity create | No subscription in local DB | Add subscription via backend admin/shell |
"identity not found" on use | Used UUID prefix instead of full UUID | Pass the complete UUID |
| Connection refused | Backend not running on :8000 | Start dev server or check Docker |
secrets set fails on duplicate key | Using old CLI without upsert fix | Rebuild the CLI |