CD/CD consolidation
This commit is contained in:
47
devops/tools/graph/load-test.sh
Normal file
47
devops/tools/graph/load-test.sh
Normal file
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# DEVOPS-GRAPH-24-001: load test graph index/adjacency APIs
|
||||
|
||||
TARGET=${TARGET:-"http://localhost:5000"}
|
||||
OUT="out/graph-load"
|
||||
mkdir -p "$OUT"
|
||||
|
||||
USERS=${USERS:-8}
|
||||
DURATION=${DURATION:-60}
|
||||
RATE=${RATE:-200}
|
||||
|
||||
cat > "${OUT}/k6-graph.js" <<'EOF'
|
||||
import http from 'k6/http';
|
||||
import { sleep } from 'k6';
|
||||
|
||||
export const options = {
|
||||
vus: __USERS__,
|
||||
duration: '__DURATION__s',
|
||||
thresholds: {
|
||||
http_req_duration: ['p(95)<500'],
|
||||
http_req_failed: ['rate<0.01'],
|
||||
},
|
||||
};
|
||||
|
||||
const targets = [
|
||||
'/graph/api/index',
|
||||
'/graph/api/adjacency?limit=100',
|
||||
'/graph/api/search?q=log4j',
|
||||
];
|
||||
|
||||
export default function () {
|
||||
const host = __TARGET__;
|
||||
targets.forEach(path => http.get(`${host}${path}`));
|
||||
sleep(1);
|
||||
}
|
||||
EOF
|
||||
|
||||
sed -i "s/__USERS__/${USERS}/g" "${OUT}/k6-graph.js"
|
||||
sed -i "s/__DURATION__/${DURATION}/g" "${OUT}/k6-graph.js"
|
||||
sed -i "s@__TARGET__@\"${TARGET}\"@g" "${OUT}/k6-graph.js"
|
||||
|
||||
echo "[graph-load] running k6..."
|
||||
k6 run "${OUT}/k6-graph.js" --summary-export "${OUT}/summary.json" --http-debug="off"
|
||||
|
||||
echo "[graph-load] summary written to ${OUT}/summary.json"
|
||||
21
devops/tools/graph/simulation-smoke.sh
Normal file
21
devops/tools/graph/simulation-smoke.sh
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# DEVOPS-GRAPH-24-003: simulation endpoint smoke
|
||||
|
||||
TARGET=${TARGET:-"http://localhost:5000"}
|
||||
OUT="out/graph-sim"
|
||||
mkdir -p "$OUT"
|
||||
|
||||
echo "[graph-sim] hitting simulation endpoints"
|
||||
|
||||
curl -sSf "${TARGET}/graph/api/simulation/ping" > "${OUT}/ping.json"
|
||||
curl -sSf "${TARGET}/graph/api/simulation/run?limit=5" > "${OUT}/run.json"
|
||||
|
||||
cat > "${OUT}/summary.txt" <<EOF
|
||||
ping: $(jq -r '.status' "${OUT}/ping.json" 2>/dev/null || echo "unknown")
|
||||
run_len: $(jq '. | length' "${OUT}/run.json" 2>/dev/null || echo "0")
|
||||
EOF
|
||||
|
||||
echo "[graph-sim] completed; summary:"
|
||||
cat "${OUT}/summary.txt"
|
||||
30
devops/tools/graph/ui-perf.ts
Normal file
30
devops/tools/graph/ui-perf.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { chromium } from 'playwright';
|
||||
import fs from 'fs';
|
||||
|
||||
const BASE_URL = process.env.GRAPH_UI_BASE ?? 'http://localhost:4200';
|
||||
const OUT = process.env.OUT ?? 'out/graph-ui-perf';
|
||||
const BUDGET_MS = Number(process.env.GRAPH_UI_BUDGET_MS ?? '3000');
|
||||
|
||||
(async () => {
|
||||
fs.mkdirSync(OUT, { recursive: true });
|
||||
const browser = await chromium.launch({ headless: true });
|
||||
const page = await browser.newPage();
|
||||
|
||||
const start = Date.now();
|
||||
await page.goto(`${BASE_URL}/graph`, { waitUntil: 'networkidle' });
|
||||
await page.click('text=Explore'); // assumes nav element
|
||||
await page.waitForSelector('canvas');
|
||||
const duration = Date.now() - start;
|
||||
|
||||
const metrics = await page.evaluate(() => JSON.stringify(window.performance.timing));
|
||||
fs.writeFileSync(`${OUT}/timing.json`, metrics);
|
||||
fs.writeFileSync(`${OUT}/duration.txt`, `${duration}`);
|
||||
|
||||
if (duration > BUDGET_MS) {
|
||||
console.error(`[graph-ui] perf budget exceeded: ${duration}ms > ${BUDGET_MS}ms`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
await browser.close();
|
||||
console.log(`[graph-ui] load duration ${duration}ms (budget ${BUDGET_MS}ms)`);
|
||||
})();
|
||||
Reference in New Issue
Block a user