SPB Git

Repository Public

e2e.sh 4.6 KB 128 lines shellscript

1#!/bin/bash2# =============================================================================3#                  SP BOUCHER | INFRASTRUCTURE & AUTOMATION4#             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5# =============================================================================6#7# Project          : SPSearch8# File             : tests/integration/e2e.sh9# Module           : tests10# Repository       : https://git.spboucher.ai/spweb11# Project Website  : https://search.spboucher.ai12# Created          : 2026-11-2713# Last Modified    : 2026-11-2714#15# Author           : Simon-Pierre Boucher16# Position         : Professor of Finance17# Institution      : Université du Québec en Outaouais (UQO)18# Organization     : SP Boucher19# Website          : https://spboucher.ai20# Git              : https://git.spboucher.ai21#22# Preferred Contact: contact@spboucher.ai23# Technical Contact: dev@spboucher.ai24# Security/Admin   : admin@spboucher.ai25#26# Copyright (c) 202627# Simon-Pierre Boucher28# All rights reserved where applicable. This file is governed by the29# applicable project license, copyright notices and relevant law.30# Existing third-party rights and notices remain unaffected.31#32# License          : None specified (no license file in this repository)33#34# Do not embed credentials, private keys, access tokens,35# certificates or confidential personal information.36#37# =============================================================================38# END OF SP BOUCHER SOURCE HEADER39# =============================================================================4041# Essai de bout en bout : fixtures -> crawl -> index -> recherche -> retraits -> inspection du disque.42# Usage : tests/integration/e2e.sh [debug|release]   (les binaires doivent être construits)43set -u44ROOT="$(cd "$(dirname "$0")/../.." && pwd)"45PROFILE="${1:-debug}"46BIN="$ROOT/target/$PROFILE"47W="$(mktemp -d /tmp/spweb-e2e.XXXXXX)"48FX=18970; CO=18911; IX=18912; SE=18901; CP=1890049export SPWEB_TEST_MODE=150sha() { printf '%s' "$1" | shasum -a 256 | cut -d' ' -f1; }51ADMIN=admin-token-for-e2e-tests-0123456789; OPER=operator-token-for-e2e-tests-012345; VIEW=viewer-token-for-e2e-tests-01234567; AGENT=agent-key-for-e2e-tests-0123456789ab52cat > "$W/secrets.toml" <<S53internal_token = "internal-token-e2e-0123456789abcdef0123456789"54signing_key = "signing-key-e2e-0123456789abcdef0123456789abcd"55admin_token_sha256 = "$(sha $ADMIN)"56operator_token_sha256 = "$(sha $OPER)"57viewer_token_sha256 = "$(sha $VIEW)"58agent_key_sha256 = ["$(sha $AGENT)"]59S60chmod 600 "$W/secrets.toml"61cat > "$W/config.toml" <<C62[general]63data_dir = "$W/data"64node_name = "e2e"65secrets_file = "$W/secrets.toml"66test_mode = true67[coordinator]68listen = "127.0.0.1:$CO"69url = "http://127.0.0.1:$CO"70min_delay_ms = 20071cluster_rps = 100.072lease_urls = 473[worker]74coordinator_url = "http://127.0.0.1:$CO"75index_url = "http://127.0.0.1:$IX"76concurrency = 477battery_pause = false78[index]79listen = "127.0.0.1:$IX"80shard_count = 281commit_interval_s = 182[storage]83quota_bytes = 200000000084index_budget = 100000000085frontier_budget = 20000000086logs_budget = 10000000087other_budget = 10000000088merge_reserve = 40000000089min_free_ratio = 0.090min_free_bytes = 091[search]92listen = "127.0.0.1:$SE"93index_nodes = ["http://127.0.0.1:$IX"]94web_dir = "$ROOT/web/search/dist"95per_ip_per_min = 200096global_per_s = 50097submit_per_ip_per_hour = 10098fetch_per_key_per_min = 10099[control]100listen = "127.0.0.1:$CP"101search_upstream = "http://127.0.0.1:$SE"102bot_web_dir = "$ROOT/web/bot/dist"103index_web_dir = "$ROOT/web/index/dist"104C105PIDS=()106start() { name=$1; shift; "$@" >"$W/$name.out" 2>&1 & PIDS+=($!); echo $! > "$W/$name.pid"; }107cleanup() { for f in "$W"/*.pid; do kill "$(cat "$f")" 2>/dev/null; done; for p in "${PIDS[@]}"; do kill "$p" 2>/dev/null; done; sleep 1; for p in "${PIDS[@]}"; do kill -9 "$p" 2>/dev/null; done; [ "${KEEP:-0}" = 1 ] || rm -rf "$W"; }108trap cleanup EXIT109start fixtures "$BIN/spweb-fixtures" $FX110start index "$BIN/spweb-index-node" --config "$W/config.toml"111sleep 1112cat > "$W/seeds.txt" <<S113http://site.localhost:$FX/114http://down.localhost:$FX/115http://slow.localhost:$FX/116http://open.localhost:$FX/117S118start coord "$BIN/spweb-bot-coordinator" --config "$W/config.toml" --seeds "$W/seeds.txt"119start search "$BIN/spweb-search-api" --config "$W/config.toml"120start control "$BIN/spweb-control-plane" --config "$W/config.toml"121sleep 1122start worker "$BIN/spweb-bot-worker" --config "$W/config.toml"123export W FX CO IX SE CP ADMIN OPER VIEW AGENT BIN ROOT124python3 "$ROOT/tests/integration/e2e_check.py"125RC=$?126if [ $RC -ne 0 ]; then echo "--- journaux ---"; tail -5 "$W"/*.out; tail -20 "$W"/data/logs/*.log 2>/dev/null | cut -c1-300; fi127exit $RC128
Files main
Menu

Theme