mem0: remove probes (no health endpoint), add functional test script

This commit is contained in:
hermes-bot
2026-05-31 04:12:56 +00:00
parent df5c412c7b
commit 9159cdf83c

View File

@@ -184,18 +184,6 @@ spec:
volumeMounts: volumeMounts:
- name: mem0-history - name: mem0-history
mountPath: /app/data mountPath: /app/data
livenessProbe:
httpGet:
path: /health
port: 8000
initialDelaySeconds: 30
periodSeconds: 10
readinessProbe:
httpGet:
path: /health
port: 8000
initialDelaySeconds: 10
periodSeconds: 5
resources: resources:
limits: limits:
cpu: "2" cpu: "2"
@@ -249,3 +237,41 @@ volumes:
- name: mem0-history - name: mem0-history
emptyDir: {} emptyDir: {}
``` ```
## 功能测试
mem0 未为 K8s 做适配,无健康检查端点。手动测试核心 API
```bash
cat > /tmp/test_mem0.py << 'TESTEOF'
import urllib.request, json, uuid
BASE = "http://mem0:8000"
def req(method, path, data=None):
url = BASE + path
body = json.dumps(data).encode() if data else None
headers = {"Content-Type": "application/json"}
try:
r = urllib.request.urlopen(urllib.request.Request(url, data=body, headers=headers, method=method), timeout=10)
return json.loads(r.read()), r.status
except urllib.error.HTTPError as e:
return json.loads(e.read()), e.code
except Exception as e:
return str(e), 0
uid = str(uuid.uuid4())
print("=== 1. 创建用户 ===")
print(req("POST", "/api/v1/users", {"user_id": uid, "email": f"{uid}@test.com"}))
print("=== 2. 添加记忆 ===")
print(req("POST", "/api/v1/memories", {"text": "我叫张三我喜欢Python", "user_id": uid}))
print("=== 3. 搜索记忆 ===")
print(req("GET", f"/api/v1/memories?query=python&user_id={uid}"))
print("=== 4. 获取历史 ===")
print(req("GET", f"/api/v1/history?user_id={uid}"))
TESTEOF
kubectl exec -n tei deploy/mem0 -- python3 /tmp/test_mem0.py
```