π§ͺ Luna Vision RAGβ’ Testing Guide β
Complete guide for testing your Luna Vision RAGβ’ API at https://rag.lunaos.ai
π Quick Start β
1. Automated Test Suite (Recommended) β
Run the complete test suite:
bash
cd mcp-servers/luna-rag-glm-integration
./test-domain.shThis tests:
- β DNS resolution
- β Health endpoint
- β API info endpoint
- β Response time
- β SSL certificate
- β CORS headers
- β RAG query endpoint
π Manual Testing Methods β
Method 1: Browser Testing β
Simply open these URLs in your browser:
Health Check:
https://rag.lunaos.ai/healthAPI Info:
https://rag.lunaos.ai/api
You should see JSON responses!
Method 2: Command Line (curl) β
A. Health Check β
bash
curl https://rag.lunaos.ai/health | jq .Expected Response:
json
{
"status": "healthy",
"service": "Luna Vision RAG",
"version": "1.0.0",
"environment": "production",
"timestamp": "2025-11-06T14:00:00.000Z",
"features": {
"rag": true,
"glmVision": true,
"contextAware": true,
"autoGenerate": true
}
}B. API Endpoints List β
bash
curl https://rag.lunaos.ai/api | jq .Expected Response:
json
{
"health": "/health",
"rag": {
"setup": "/api/rag/setup",
"query": "/api/rag/query",
"index": "/api/rag/index"
},
"glm": {
"capture": "/api/glm/capture",
"analyze": "/api/glm/analyze",
"test": "/api/glm/test"
},
"integration": {
"validate": "/api/integration/validate",
"generate": "/api/integration/generate",
"report": "/api/integration/report"
}
}C. RAG Setup β
bash
curl -X POST https://rag.lunaos.ai/api/rag/setup \
-H "Content-Type: application/json" \
-d '{
"projectPath": "/path/to/your/project",
"collectionName": "my-project",
"vectorDB": "pinecone"
}' | jq .Expected Response:
json
{
"success": true,
"message": "RAG system configured successfully",
"projectPath": "/path/to/your/project",
"collectionName": "my-project"
}D. RAG Query β
bash
curl -X POST https://rag.lunaos.ai/api/rag/query \
-H "Content-Type: application/json" \
-d '{
"query": "How do I authenticate users?",
"collectionName": "my-project",
"topK": 5
}' | jq .Expected Response:
json
{
"success": true,
"query": "How do I authenticate users?",
"results": [
{
"id": "ctx_1",
"content": "Sample context from codebase",
"score": 0.95,
"metadata": {
"file": "src/components/Auth.tsx",
"type": "component"
}
}
],
"cached": false
}E. GLM Vision Analyze β
bash
curl -X POST https://rag.lunaos.ai/api/glm/analyze \
-H "Content-Type: application/json" \
-d '{
"screenshotUrl": "https://example.com/screenshot.png",
"analysisType": "ui-elements"
}' | jq .F. Integration Validate β
bash
curl -X POST https://rag.lunaos.ai/api/integration/validate \
-H "Content-Type: application/json" \
-d '{
"component": "LoginForm",
"expectedBehavior": "Should validate email format",
"context": "User authentication flow"
}' | jq .Method 3: JavaScript/Node.js β
Create a test file test-api.js:
javascript
// test-api.js
const API_BASE = 'https://rag.lunaos.ai';
async function testAPI() {
console.log('π§ͺ Testing Luna Vision RAGβ’ API...\n');
// 1. Health Check
console.log('1οΈβ£ Health Check:');
const health = await fetch(`${API_BASE}/health`);
const healthData = await health.json();
console.log(healthData);
console.log('');
// 2. API Info
console.log('2οΈβ£ API Info:');
const api = await fetch(`${API_BASE}/api`);
const apiData = await api.json();
console.log(apiData);
console.log('');
// 3. RAG Setup
console.log('3οΈβ£ RAG Setup:');
const setup = await fetch(`${API_BASE}/api/rag/setup`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
projectPath: '/my/project',
collectionName: 'test-collection',
vectorDB: 'pinecone'
})
});
const setupData = await setup.json();
console.log(setupData);
console.log('');
// 4. RAG Query
console.log('4οΈβ£ RAG Query:');
const query = await fetch(`${API_BASE}/api/rag/query`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
query: 'How do I test my app?',
collectionName: 'test-collection',
topK: 3
})
});
const queryData = await query.json();
console.log(queryData);
console.log('');
console.log('β
All tests complete!');
}
testAPI().catch(console.error);Run it:
bash
node test-api.jsMethod 4: Python β
Create a test file test_api.py:
python
# test_api.py
import requests
import json
API_BASE = 'https://rag.lunaos.ai'
def test_api():
print('π§ͺ Testing Luna Vision RAGβ’ API...\n')
# 1. Health Check
print('1οΈβ£ Health Check:')
response = requests.get(f'{API_BASE}/health')
print(json.dumps(response.json(), indent=2))
print()
# 2. API Info
print('2οΈβ£ API Info:')
response = requests.get(f'{API_BASE}/api')
print(json.dumps(response.json(), indent=2))
print()
# 3. RAG Setup
print('3οΈβ£ RAG Setup:')
response = requests.post(
f'{API_BASE}/api/rag/setup',
json={
'projectPath': '/my/project',
'collectionName': 'test-collection',
'vectorDB': 'pinecone'
}
)
print(json.dumps(response.json(), indent=2))
print()
# 4. RAG Query
print('4οΈβ£ RAG Query:')
response = requests.post(
f'{API_BASE}/api/rag/query',
json={
'query': 'How do I test my app?',
'collectionName': 'test-collection',
'topK': 3
}
)
print(json.dumps(response.json(), indent=2))
print()
print('β
All tests complete!')
if __name__ == '__main__':
test_api()Run it:
bash
python test_api.pyMethod 5: Postman/Insomnia β
Import this collection:
json
{
"name": "Luna Vision RAG",
"requests": [
{
"name": "Health Check",
"method": "GET",
"url": "https://rag.lunaos.ai/health"
},
{
"name": "API Info",
"method": "GET",
"url": "https://rag.lunaos.ai/api"
},
{
"name": "RAG Setup",
"method": "POST",
"url": "https://rag.lunaos.ai/api/rag/setup",
"headers": {
"Content-Type": "application/json"
},
"body": {
"projectPath": "/my/project",
"collectionName": "test-collection",
"vectorDB": "pinecone"
}
},
{
"name": "RAG Query",
"method": "POST",
"url": "https://rag.lunaos.ai/api/rag/query",
"headers": {
"Content-Type": "application/json"
},
"body": {
"query": "How do I test my app?",
"collectionName": "test-collection",
"topK": 5
}
}
]
}β‘ Performance Testing β
Test Response Time β
bash
# Single request
curl -w "\nTime: %{time_total}s\n" -s -o /dev/null https://rag.lunaos.ai/health
# Multiple requests
for i in {1..10}; do
echo "Request $i:"
curl -w "Time: %{time_total}s\n" -s -o /dev/null https://rag.lunaos.ai/health
doneLoad Testing with Apache Bench β
bash
# 100 requests, 10 concurrent
ab -n 100 -c 10 https://rag.lunaos.ai/health
# 1000 requests, 50 concurrent
ab -n 1000 -c 50 https://rag.lunaos.ai/healthLoad Testing with wrk β
bash
# 30 seconds, 10 threads, 100 connections
wrk -t10 -c100 -d30s https://rag.lunaos.ai/healthπ Advanced Testing β
Test CORS β
bash
curl -X OPTIONS https://rag.lunaos.ai/api/rag/query \
-H "Origin: https://example.com" \
-H "Access-Control-Request-Method: POST" \
-H "Access-Control-Request-Headers: Content-Type" \
-IExpected Headers:
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
Access-Control-Allow-Headers: Content-Type, AuthorizationTest SSL Certificate β
bash
# Check SSL details
openssl s_client -connect rag.lunaos.ai:443 -servername rag.lunaos.ai
# Check SSL grade
curl -I https://rag.lunaos.ai/health | grep -i "server\|http"Test DNS Resolution β
bash
# Check DNS
dig rag.lunaos.ai
# Check with specific DNS server
dig @8.8.8.8 rag.lunaos.ai
# Check DNS propagation globally
curl https://www.whatsmydns.net/api/details?server=all&type=A&query=rag.lunaos.aiπ Monitoring & Debugging β
Check Cloudflare Analytics β
- Go to: https://dash.cloudflare.com
- Select: lunaos.ai
- Click: Analytics & Logs
- View: Request metrics, bandwidth, errors
Check Worker Logs β
bash
# Tail logs in real-time
wrangler tail luna-vision-rag
# Filter by status
wrangler tail luna-vision-rag --status error
# Filter by method
wrangler tail luna-vision-rag --method POSTCheck Deployment Status β
bash
cd mcp-servers/luna-rag-glm-integration
# List deployments
wrangler deployments list
# View specific deployment
wrangler deployments view <deployment-id>π Troubleshooting β
Issue: DNS not resolving β
bash
# Clear DNS cache (Mac)
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder
# Clear DNS cache (Linux)
sudo systemd-resolve --flush-caches
# Clear DNS cache (Windows)
ipconfig /flushdnsIssue: Slow response time β
bash
# Test from different locations
curl -w "\nTime: %{time_total}s\n" https://rag.lunaos.ai/health
# Check Cloudflare status
curl https://www.cloudflarestatus.com/api/v2/status.jsonIssue: CORS errors β
Check that preflight requests work:
bash
curl -X OPTIONS https://rag.lunaos.ai/api/rag/query \
-H "Origin: https://your-app.com" \
-Iβ Test Checklist β
Use this checklist to verify everything works:
- [ ] Health endpoint responds (GET /health)
- [ ] API info endpoint responds (GET /api)
- [ ] RAG setup endpoint responds (POST /api/rag/setup)
- [ ] RAG query endpoint responds (POST /api/rag/query)
- [ ] RAG index endpoint responds (POST /api/rag/index)
- [ ] GLM capture endpoint responds (POST /api/glm/capture)
- [ ] GLM analyze endpoint responds (POST /api/glm/analyze)
- [ ] GLM test endpoint responds (POST /api/glm/test)
- [ ] Integration validate responds (POST /api/integration/validate)
- [ ] Integration generate responds (POST /api/integration/generate)
- [ ] Integration report responds (POST /api/integration/report)
- [ ] Response time < 100ms
- [ ] SSL certificate valid
- [ ] CORS headers present
- [ ] DNS resolves correctly
- [ ] Works from different locations
- [ ] Works in browser
- [ ] Works via curl
- [ ] Works via JavaScript fetch
- [ ] Works via Python requests
π― Quick Test Commands β
Copy and paste these for quick testing:
bash
# Health check
curl https://rag.lunaos.ai/health | jq .
# API info
curl https://rag.lunaos.ai/api | jq .
# RAG query
curl -X POST https://rag.lunaos.ai/api/rag/query \
-H "Content-Type: application/json" \
-d '{"query":"test","collectionName":"demo","topK":5}' | jq .
# Response time
curl -w "\nTime: %{time_total}s\n" -s -o /dev/null https://rag.lunaos.ai/health
# Full test suite
cd mcp-servers/luna-rag-glm-integration && ./test-domain.shπ Support β
If you encounter issues:
- Check the Troubleshooting section
- Review CUSTOM_DOMAIN_SUCCESS.md
- Check Cloudflare Dashboard for errors
- Review Worker logs:
wrangler tail luna-vision-rag
Your Luna Vision RAGβ’ is live at: https://rag.lunaos.ai π
Happy testing! π§ͺ