From a63530e0226c2c44361921a33f84848fa666341e Mon Sep 17 00:00:00 2001 From: phact Date: Tue, 7 Oct 2025 14:20:13 -0400 Subject: [PATCH] fix token gen --- Makefile | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index e7a29d2f..4eb6293b 100644 --- a/Makefile +++ b/Makefile @@ -209,19 +209,18 @@ test-ci: echo "Docling-serve started at $$DOCLING_ENDPOINT"; \ echo "Waiting for backend OIDC endpoint..."; \ for i in $$(seq 1 60); do \ - curl -s http://localhost:8000/.well-known/openid-configuration >/dev/null 2>&1 && break || sleep 2; \ + docker exec openrag-backend curl -s http://localhost:8000/.well-known/openid-configuration >/dev/null 2>&1 && break || sleep 2; \ done; \ + echo "Generating test JWT token..."; \ + TEST_TOKEN=$$(uv run python -c "from src.session_manager import SessionManager, AnonymousUser; sm = SessionManager('test'); print(sm.create_jwt_token(AnonymousUser()))"); \ echo "Waiting for OpenSearch with JWT auth to work..."; \ JWT_AUTH_READY=false; \ for i in $$(seq 1 60); do \ if curl -k -s https://localhost:9200 -u admin:$${OPENSEARCH_PASSWORD} >/dev/null 2>&1; then \ - TOKEN=$$(curl -s http://localhost:8000/auth/me | grep -o '"token":"[^"]*"' | cut -d'"' -f4 || echo ""); \ - if [ -n "$$TOKEN" ]; then \ - if curl -k -s -H "Authorization: Bearer $$TOKEN" https://localhost:9200/documents/_search -d '{"query":{"match_all":{}}}' 2>&1 | grep -v "Unauthorized" >/dev/null; then \ - echo "✓ OpenSearch JWT auth working after $$((i*2)) seconds"; \ - JWT_AUTH_READY=true; \ - break; \ - fi; \ + if curl -k -s -H "Authorization: Bearer $$TEST_TOKEN" https://localhost:9200/documents/_search -d '{"query":{"match_all":{}}}' 2>&1 | grep -v "Unauthorized" >/dev/null; then \ + echo "✓ OpenSearch JWT auth working after $$((i*2)) seconds"; \ + JWT_AUTH_READY=true; \ + break; \ fi; \ fi; \ sleep 2; \