Something went wrong. Try again.
A container registry that uses the AT Protocol for manifest storage and S3 for blob storage.
Something went wrong. Try again.
4.4 kB · 112 lines
Shell
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113#!/bin/bash
# Test script for ATProto sync endpoints on hold service# Usage: ./test-hold-endpoints.sh [HOLD_URL] [DID]
HOLD_URL="${1:-http://172.28.0.3:8080}"# You'll need to replace this with your hold's actual DIDDID="${2:-did:web:172.28.0.3%3A8080}"
echo "Testing ATProto sync endpoints on: $HOLD_URL"echo "Using DID: $DID"echo "=========================================="echo ""
# Test 1: List repositoriesecho "1. Testing com.atproto.sync.listRepos"echo " GET $HOLD_URL/xrpc/com.atproto.sync.listRepos"echo " Response:"curl -s -w "\n HTTP Status: %{http_code}\n" \ "$HOLD_URL/xrpc/com.atproto.sync.listRepos" | jq . 2>/dev/null || catecho ""echo "=========================================="echo ""
# Test 2: Describe repoecho "2. Testing com.atproto.repo.describeRepo"echo " GET $HOLD_URL/xrpc/com.atproto.repo.describeRepo?repo=$DID"echo " Response:"curl -s -w "\n HTTP Status: %{http_code}\n" \ "$HOLD_URL/xrpc/com.atproto.repo.describeRepo?repo=$DID" | jq . 2>/dev/null || catecho ""echo "=========================================="echo ""
# Test 3: Get repository (CAR file)echo "3. Testing com.atproto.sync.getRepo"echo " GET $HOLD_URL/xrpc/com.atproto.sync.getRepo?did=$DID"echo " Response (showing first 200 bytes of CAR file):"curl -s -w "\n HTTP Status: %{http_code}\n Content-Type: %{content_type}\n" \ "$HOLD_URL/xrpc/com.atproto.sync.getRepo?did=$DID" | head -c 200echo ""echo " [truncated...]"echo ""echo "=========================================="echo ""
# Test 4: List records (captain record)echo "4. Testing com.atproto.repo.listRecords (captain)"echo " GET $HOLD_URL/xrpc/com.atproto.repo.listRecords?repo=$DID&collection=io.atcr.hold.captain"echo " Response:"curl -s -w "\n HTTP Status: %{http_code}\n" \ "$HOLD_URL/xrpc/com.atproto.repo.listRecords?repo=$DID&collection=io.atcr.hold.captain" | jq . 2>/dev/null || catecho ""echo "=========================================="echo ""
# Test 5: List records (crew records)echo "5. Testing com.atproto.repo.listRecords (crew)"echo " GET $HOLD_URL/xrpc/com.atproto.repo.listRecords?repo=$DID&collection=io.atcr.hold.crew"echo " Response:"curl -s -w "\n HTTP Status: %{http_code}\n" \ "$HOLD_URL/xrpc/com.atproto.repo.listRecords?repo=$DID&collection=io.atcr.hold.crew" | jq . 2>/dev/null || catecho ""echo "=========================================="echo ""
# Test 6: Get blob (this will likely return an error without a valid CID)echo "6. Testing com.atproto.sync.getBlob (requires valid CID)"echo " Skipping - needs a real blob CID from your hold"echo " Example command:"echo " curl \"$HOLD_URL/xrpc/com.atproto.sync.getBlob?did=$DID&cid=bafyrei...\""echo ""echo "=========================================="echo ""
# Test 7: WebSocket - subscribeReposecho "7. Testing com.atproto.sync.subscribeRepos (WebSocket)"echo " This requires a WebSocket client like websocat or wscat"echo ""
# Check if websocat is availableif command -v websocat &> /dev/null; then echo " Found websocat! Connecting for 5 seconds..." WS_URL="${HOLD_URL/http:/ws:}" WS_URL="${WS_URL/https:/wss:}" echo " WS URL: $WS_URL/xrpc/com.atproto.sync.subscribeRepos" timeout 5 websocat "$WS_URL/xrpc/com.atproto.sync.subscribeRepos" 2>&1 || echo " Connection closed or timeout"elif command -v wscat &> /dev/null; then echo " Found wscat! Connecting for 5 seconds..." WS_URL="${HOLD_URL/http:/ws:}" WS_URL="${WS_URL/https:/wss:}" echo " WS URL: $WS_URL/xrpc/com.atproto.sync.subscribeRepos" timeout 5 wscat -c "$WS_URL/xrpc/com.atproto.sync.subscribeRepos" 2>&1 || echo " Connection closed or timeout"else echo " WebSocket client not found. Install websocat or wscat:" echo " - websocat: cargo install websocat" echo " - wscat: npm install -g wscat" echo "" echo " Manual test command:" WS_URL="${HOLD_URL/http:/ws:}" WS_URL="${WS_URL/https:/wss:}" echo " websocat '$WS_URL/xrpc/com.atproto.sync.subscribeRepos'" echo " OR" echo " wscat -c '$WS_URL/xrpc/com.atproto.sync.subscribeRepos'"fi
echo ""echo "=========================================="echo "Tests complete!"echo ""echo "Note: If you need to test with a specific blob, first push an image"echo "to get real blob CIDs, then use them with getBlob endpoint."