A container registry that uses the AT Protocol for manifest storage and S3 for blob storage. atcr.io
docker container atproto go
at loom 112 lines 4.4 kB view raw
1#!/bin/bash 2 3# Test script for ATProto sync endpoints on hold service 4# Usage: ./test-hold-endpoints.sh [HOLD_URL] [DID] 5 6HOLD_URL="${1:-http://172.28.0.3:8080}" 7# You'll need to replace this with your hold's actual DID 8DID="${2:-did:web:172.28.0.3%3A8080}" 9 10echo "Testing ATProto sync endpoints on: $HOLD_URL" 11echo "Using DID: $DID" 12echo "==========================================" 13echo "" 14 15# Test 1: List repositories 16echo "1. Testing com.atproto.sync.listRepos" 17echo " GET $HOLD_URL/xrpc/com.atproto.sync.listRepos" 18echo " Response:" 19curl -s -w "\n HTTP Status: %{http_code}\n" \ 20 "$HOLD_URL/xrpc/com.atproto.sync.listRepos" | jq . 2>/dev/null || cat 21echo "" 22echo "==========================================" 23echo "" 24 25# Test 2: Describe repo 26echo "2. Testing com.atproto.repo.describeRepo" 27echo " GET $HOLD_URL/xrpc/com.atproto.repo.describeRepo?repo=$DID" 28echo " Response:" 29curl -s -w "\n HTTP Status: %{http_code}\n" \ 30 "$HOLD_URL/xrpc/com.atproto.repo.describeRepo?repo=$DID" | jq . 2>/dev/null || cat 31echo "" 32echo "==========================================" 33echo "" 34 35# Test 3: Get repository (CAR file) 36echo "3. Testing com.atproto.sync.getRepo" 37echo " GET $HOLD_URL/xrpc/com.atproto.sync.getRepo?did=$DID" 38echo " Response (showing first 200 bytes of CAR file):" 39curl -s -w "\n HTTP Status: %{http_code}\n Content-Type: %{content_type}\n" \ 40 "$HOLD_URL/xrpc/com.atproto.sync.getRepo?did=$DID" | head -c 200 41echo "" 42echo " [truncated...]" 43echo "" 44echo "==========================================" 45echo "" 46 47# Test 4: List records (captain record) 48echo "4. Testing com.atproto.repo.listRecords (captain)" 49echo " GET $HOLD_URL/xrpc/com.atproto.repo.listRecords?repo=$DID&collection=io.atcr.hold.captain" 50echo " Response:" 51curl -s -w "\n HTTP Status: %{http_code}\n" \ 52 "$HOLD_URL/xrpc/com.atproto.repo.listRecords?repo=$DID&collection=io.atcr.hold.captain" | jq . 2>/dev/null || cat 53echo "" 54echo "==========================================" 55echo "" 56 57# Test 5: List records (crew records) 58echo "5. Testing com.atproto.repo.listRecords (crew)" 59echo " GET $HOLD_URL/xrpc/com.atproto.repo.listRecords?repo=$DID&collection=io.atcr.hold.crew" 60echo " Response:" 61curl -s -w "\n HTTP Status: %{http_code}\n" \ 62 "$HOLD_URL/xrpc/com.atproto.repo.listRecords?repo=$DID&collection=io.atcr.hold.crew" | jq . 2>/dev/null || cat 63echo "" 64echo "==========================================" 65echo "" 66 67# Test 6: Get blob (this will likely return an error without a valid CID) 68echo "6. Testing com.atproto.sync.getBlob (requires valid CID)" 69echo " Skipping - needs a real blob CID from your hold" 70echo " Example command:" 71echo " curl \"$HOLD_URL/xrpc/com.atproto.sync.getBlob?did=$DID&cid=bafyrei...\"" 72echo "" 73echo "==========================================" 74echo "" 75 76# Test 7: WebSocket - subscribeRepos 77echo "7. Testing com.atproto.sync.subscribeRepos (WebSocket)" 78echo " This requires a WebSocket client like websocat or wscat" 79echo "" 80 81# Check if websocat is available 82if command -v websocat &> /dev/null; then 83 echo " Found websocat! Connecting for 5 seconds..." 84 WS_URL="${HOLD_URL/http:/ws:}" 85 WS_URL="${WS_URL/https:/wss:}" 86 echo " WS URL: $WS_URL/xrpc/com.atproto.sync.subscribeRepos" 87 timeout 5 websocat "$WS_URL/xrpc/com.atproto.sync.subscribeRepos" 2>&1 || echo " Connection closed or timeout" 88elif command -v wscat &> /dev/null; then 89 echo " Found wscat! Connecting for 5 seconds..." 90 WS_URL="${HOLD_URL/http:/ws:}" 91 WS_URL="${WS_URL/https:/wss:}" 92 echo " WS URL: $WS_URL/xrpc/com.atproto.sync.subscribeRepos" 93 timeout 5 wscat -c "$WS_URL/xrpc/com.atproto.sync.subscribeRepos" 2>&1 || echo " Connection closed or timeout" 94else 95 echo " WebSocket client not found. Install websocat or wscat:" 96 echo " - websocat: cargo install websocat" 97 echo " - wscat: npm install -g wscat" 98 echo "" 99 echo " Manual test command:" 100 WS_URL="${HOLD_URL/http:/ws:}" 101 WS_URL="${WS_URL/https:/wss:}" 102 echo " websocat '$WS_URL/xrpc/com.atproto.sync.subscribeRepos'" 103 echo " OR" 104 echo " wscat -c '$WS_URL/xrpc/com.atproto.sync.subscribeRepos'" 105fi 106 107echo "" 108echo "==========================================" 109echo "Tests complete!" 110echo "" 111echo "Note: If you need to test with a specific blob, first push an image" 112echo "to get real blob CIDs, then use them with getBlob endpoint."