chore: update project documentation, audit reports, and initialize IDE configuration files
Some checks failed
CI / Lint → Typecheck → Test → Build (22) (push) Failing after 29s
CI / E2E Tests (push) Has been skipped
CodeQL Analysis / CodeQL (javascript-typescript) (push) Failing after 2m42s
Deploy / Build Web Image (push) Failing after 27s
Deploy / Build AI Services Image (push) Failing after 29s
E2E Tests / Playwright E2E (push) Failing after 43s
Deploy / Build API Image (push) Failing after 1m31s
Security Scanning / Dependency Audit (pnpm) (push) Failing after 6s
Security Scanning / Trivy Scan — API Image (push) Failing after 5m35s
Security Scanning / Trivy Scan — AI Services Image (push) Failing after 3m45s
Deploy / Deploy to Staging (push) Has been skipped
Deploy / Smoke Test Staging (push) Has been skipped
Deploy / Deploy to Production (push) Has been skipped
Deploy / Smoke Test Production (push) Has been skipped
Deploy / Rollback Staging (push) Has been skipped
Deploy / Rollback Production (push) Has been skipped
Security Scanning / Trivy Scan — Web Image (push) Failing after 13m51s
Security Scanning / Trivy Filesystem Scan (push) Failing after 14m46s
Security Scanning / Security Gate (push) Has been cancelled

This commit is contained in:
Ho Ngoc Hai
2026-04-19 03:12:54 +07:00
parent 3be106074d
commit 11f2bf26e6
101 changed files with 21312 additions and 20672 deletions

View File

@@ -1,34 +1,34 @@
# K6 Load Testing — Goodgo Platform
## Overview
## Tổng quan
Performance load tests for critical API paths using [K6](https://k6.io/).
Các bài load test hiệu năng cho những API path quan trọng, sử dụng [K6](https://k6.io/).
## Test Suites
## Bộ kiểm thử
| Script | Target | Peak VUs | Duration |
|--------|--------|----------|----------|
| `auth.js` | Login/Register | 100 | 2min |
| `listings.js` | Search + Detail | 500 | 3min |
| `search.js` | Text + Geo search | 200 | 3min |
| `search-advanced.js` | Combined geo + text + filters, pagination | 300 | 3min |
| `admin.js` | Moderation queue, dashboard, audit logs | 50 | 2.5min |
| Script | Mục tiêu | VU đỉnh | Thời lượng |
|--------|----------|---------|-----------|
| `auth.js` | Đăng nhập/Đăng ký | 100 | 2min |
| `listings.js` | Tìm kiếm + Chi tiết | 500 | 3min |
| `search.js` | Tìm kiếm văn bản + Địa lý | 200 | 3min |
| `search-advanced.js` | Kết hợp geo + text + bộ lọc, phân trang | 300 | 3min |
| `admin.js` | Hàng đợi kiểm duyệt, bảng điều khiển, nhật ký audit | 50 | 2.5min |
| `mcp.js` | MCP server discovery, property-search, valuation | 120 | 2.5min |
| `payments.js` | Create + List | 50 | 2min |
| `payments.js` | Tạo + Danh sách | 50 | 2min |
## SLA Thresholds
## Ngưỡng SLA
| Metric | Threshold |
|--------|-----------|
| p50 latency | < 200ms |
| p95 latency | < 500ms |
| p99 latency | < 1000ms |
| Error rate | < 1% |
| Chỉ số | Ngưỡng |
|--------|--------|
| Độ trễ p50 | < 200ms |
| Độ trễ p95 | < 500ms |
| Độ trễ p99 | < 1000ms |
| Tỷ lệ lỗi | < 1% |
### Per-Suite Custom Thresholds
### Ngưỡng tuỳ chỉnh theo bộ kiểm thử
| Suite | Metric | Threshold |
|-------|--------|-----------|
| Bộ kiểm thử | Chỉ số | Ngưỡng |
|-------------|--------|--------|
| search-advanced | advanced_search_duration p95 | < 800ms |
| search-advanced | geo_filter_search_duration p95 | < 800ms |
| admin | moderation_action_duration p95 | < 800ms |
@@ -37,21 +37,21 @@ Performance load tests for critical API paths using [K6](https://k6.io/).
| mcp | mcp_valuation_duration p95 | < 1000ms |
| mcp | mcp_batch_valuation_duration p95 | < 2000ms |
## Prerequisites
## Điều kiện tiên quyết
```bash
# Install K6
# Cài đặt K6
brew install k6 # macOS
# or: https://grafana.com/docs/k6/latest/set-up/install-k6/
# hoặc: https://grafana.com/docs/k6/latest/set-up/install-k6/
# Start the API
# Khởi động API
pnpm --filter @goodgo/api run dev
```
## Running Tests
## Chạy kiểm thử
```bash
# Run individual suite
# Chạy từng bộ kiểm thử riêng lẻ
k6 run load-tests/scripts/auth.js
k6 run load-tests/scripts/listings.js
k6 run load-tests/scripts/search.js
@@ -60,36 +60,36 @@ k6 run load-tests/scripts/admin.js
k6 run load-tests/scripts/mcp.js
k6 run load-tests/scripts/payments.js
# Run against a custom API URL
# Chạy với URL API tuỳ chỉnh
k6 run -e API_BASE_URL=https://staging.goodgo.vn load-tests/scripts/auth.js
# Run all suites sequentially
# Chạy tất cả các bộ kiểm thử tuần tự
for f in load-tests/scripts/*.js; do k6 run "$f"; done
# Export results as JSON
# Xuất kết quả dưới dạng JSON
k6 run --out json=results/auth.json load-tests/scripts/auth.js
```
## CI Integration
## Tích hợp CI
The `load-test.yml` workflow runs as an optional manual stage in GitHub Actions.
Trigger via `workflow_dispatch` with a suite selector.
Workflow `load-test.yml` chạy như một giai đoạn thủ công tuỳ chọn trong GitHub Actions.
Kích hoạt qua `workflow_dispatch` với bộ chọn suite.
## Directory Structure
## Cấu trúc thư mục
```
load-tests/
├── lib/
│ └── config.js # Shared config, helpers, SLA thresholds
│ └── config.js # Cấu hình dùng chung, helper, ngưỡng SLA
├── scripts/
│ ├── auth.js # Auth flow load tests
│ ├── listings.js # Listings search + detail
│ ├── search.js # Full-text + geo search (basic)
│ ├── search-advanced.js # Combined geo + text + filter search
│ ├── admin.js # Admin moderation, dashboard, audit
│ ├── mcp.js # MCP server endpoints (property-search, valuation)
│ └── payments.js # Payment creation + listing
│ ├── auth.js # Load test luồng xác thực
│ ├── listings.js # Tìm kiếm + chi tiết listings
│ ├── search.js # Tìm kiếm full-text + geo (cơ bản)
│ ├── search-advanced.js # Tìm kiếm kết hợp geo + text + bộ lọc
│ ├── admin.js # Kiểm duyệt admin, bảng điều khiển, audit
│ ├── mcp.js # Endpoint MCP server (property-search, valuation)
│ └── payments.js # Tạo và liệt kê thanh toán
├── results/
│ └── BASELINE-REPORT.md # Baseline performance report
│ └── BASELINE-REPORT.md # Báo cáo hiệu năng baseline
└── README.md
```