sprint1: agent queue worker, proxy support, auto-mark-on-navigate-away, test fixes
This commit is contained in:
+30
-14
@@ -4,15 +4,20 @@ set -e
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
VIDEO_ID="jNQXAC9IVRw"
|
||||
|
||||
# 1. Auto-detect and configure SOCKS5 proxy if active on 7890
|
||||
# 1. Auto-detect and configure proxy
|
||||
PROXY_DETECTED=false
|
||||
if nc -z 127.0.0.1 7890 >/dev/null 2>&1; then
|
||||
echo "=== Auto-detected local proxy on port 7890. Enabling proxy... ==="
|
||||
echo "=== Auto-detected local proxy on port 7890. Enabling SOCKS5 proxy... ==="
|
||||
export http_proxy=socks5://127.0.0.1:7890
|
||||
export https_proxy=socks5://127.0.0.1:7890
|
||||
export all_proxy=socks5://127.0.0.1:7890
|
||||
export HTTP_PROXY=socks5://127.0.0.1:7890
|
||||
export HTTPS_PROXY=socks5://127.0.0.1:7890
|
||||
export ALL_PROXY=socks5://127.0.0.1:7890
|
||||
PROXY_DETECTED=true
|
||||
elif [ -n "$HTTP_PROXY" ] || [ -n "$http_proxy" ]; then
|
||||
echo "=== Using existing HTTP_PROXY env var: ${HTTP_PROXY:-$http_proxy} ==="
|
||||
PROXY_DETECTED=true
|
||||
fi
|
||||
|
||||
# 2. Set up virtual environment and install requirements if not set up
|
||||
@@ -25,9 +30,11 @@ fi
|
||||
echo "=== Step 1: Running Mock Unit Tests ==="
|
||||
"$DIR/backend/.venv/bin/python3" -m pytest "$DIR/backend/tests/"
|
||||
|
||||
echo ""
|
||||
echo "=== Step 2: Seeding DB for Live Integration Test ==="
|
||||
"$DIR/backend/.venv/bin/python3" -c "import asyncio, aiosqlite, sys; sys.path.insert(0, '$DIR/backend'); import db;
|
||||
# Only run live integration tests if a proxy is available (needed from China)
|
||||
if [ "$PROXY_DETECTED" = true ]; then
|
||||
echo ""
|
||||
echo "=== Step 2: Seeding DB for Live Integration Test ==="
|
||||
"$DIR/backend/.venv/bin/python3" -c "import asyncio, aiosqlite, sys; sys.path.insert(0, '$DIR/backend'); import db;
|
||||
async def run():
|
||||
await db.init_db()
|
||||
async with aiosqlite.connect(db.DB_PATH) as conn:
|
||||
@@ -35,14 +42,15 @@ async def run():
|
||||
await conn.commit()
|
||||
asyncio.run(run())"
|
||||
|
||||
echo "=== Step 3: Running Live Ingestion & AI Summarization ==="
|
||||
set +e
|
||||
"$DIR/backend/.venv/bin/python3" "$DIR/backend/summarizer.py" "$VIDEO_ID"
|
||||
set -e
|
||||
echo "=== Step 3: Running Live Ingestion & AI Summarization ==="
|
||||
set +e
|
||||
"$DIR/backend/.venv/bin/python3" "$DIR/backend/summarizer.py" "$VIDEO_ID"
|
||||
SUMMARIZER_EXIT=$?
|
||||
set -e
|
||||
|
||||
echo ""
|
||||
echo "=== Step 4: Verifying SQLite Database Storage ==="
|
||||
"$DIR/backend/.venv/bin/python3" -c "import asyncio, aiosqlite, sys; sys.path.insert(0, '$DIR/backend'); import db;
|
||||
echo ""
|
||||
echo "=== Step 4: Verifying SQLite Database Storage ==="
|
||||
"$DIR/backend/.venv/bin/python3" -c "import asyncio, aiosqlite, sys; sys.path.insert(0, '$DIR/backend'); import db;
|
||||
async def run():
|
||||
async with aiosqlite.connect(db.DB_PATH) as conn:
|
||||
conn.row_factory = aiosqlite.Row
|
||||
@@ -57,9 +65,17 @@ async def run():
|
||||
print()
|
||||
print('=============================================')
|
||||
print('WARNING: LIVE INTEGRATION TEST COULD NOT COMPLETE')
|
||||
print('YouTube blocked this request or cookies.txt was missing.')
|
||||
print('YouTube blocked this request or DeepSeek is unreachable.')
|
||||
print('Please ensure your proxy is active on port 7890 or export')
|
||||
print('your youtube cookies to config/cookies.txt.')
|
||||
print('HTTP_PROXY before running.')
|
||||
print('This warning is expected and did not break the build.')
|
||||
print('=============================================')
|
||||
asyncio.run(run())"
|
||||
else
|
||||
echo ""
|
||||
echo "=== Skipping Live Integration Test (no proxy detected) ==="
|
||||
echo "From China, YouTube API and DeepSeek require a proxy."
|
||||
echo "Export HTTP_PROXY or SOCKS5 on port 7890 to enable."
|
||||
echo ""
|
||||
echo "=== Mock tests passed — live test skipped (OK) ==="
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user