You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
│ └── reservation_service.py # Reservation business rules
40
41
└── routers/
41
42
├── users.py # /users endpoints
42
43
├── rooms.py # /rooms endpoints
43
-
└── reservations.py # /reservations endpoints
44
+
├── reservations.py # /reservations endpoints
45
+
└── seed.py # /seed endpoints (load-test seeding)
44
46
```
45
47
46
48
### Requirements
@@ -130,9 +132,11 @@ Every push and pull request to `master` runs:
130
132
131
133
1.**Lint** — `ruff check .`
132
134
2.**Type check** — `mypy api/`
133
-
3.**Test with coverage** — `pytest tests/ -v --cov=api --cov-report=term-missing` against a PostgreSQL 17 service container
135
+
3.**Test with coverage** — `pytest tests/ -v --cov=api --cov-report=term-missing`(the suite runs against in-memory SQLite; a PostgreSQL 17 service container is provisioned in the job)
134
136
4.**Coverage artifact** uploaded on every run
135
137
138
+
A separate **Performance workflow** (`.github/workflows/performance.yml`) validates the k6 load scripts: it installs a pinned k6 version and runs `k6 inspect` on every script in `tests/performance/load/` on every push and pull request. A manual smoke run against a live API can be triggered via `workflow_dispatch`, with tunable `p95-ms` and `error-rate` thresholds.
│ └── seed.py # Pydantic: modelos Seed* de request/response
170
175
├── services/
171
176
│ ├── user_service.py # Regras de negócio de usuário
172
177
│ ├── room_service.py # Regras de negócio de sala
173
178
│ └── reservation_service.py # Regras de negócio de reserva
174
179
└── routers/
175
180
├── users.py # Endpoints /users
176
181
├── rooms.py # Endpoints /rooms
177
-
└── reservations.py # Endpoints /reservations
182
+
├── reservations.py # Endpoints /reservations
183
+
└── seed.py # Endpoints /seed (seeding de testes de carga)
178
184
```
179
185
180
186
### Requisitos
@@ -264,9 +270,11 @@ Cada push e pull request para `master` executa:
264
270
265
271
1.**Lint** — `ruff check .`
266
272
2.**Type check** — `mypy api/`
267
-
3.**Testes com cobertura** — `pytest tests/ -v --cov=api --cov-report=term-missing` em container PostgreSQL 17
273
+
3.**Testes com cobertura** — `pytest tests/ -v --cov=api --cov-report=term-missing`(a suíte roda sobre SQLite em memória; um container de serviço PostgreSQL 17 é provisionado no job)
268
274
4.**Artefato de cobertura** enviado a cada execução
269
275
276
+
Um **workflow de performance** separado (`.github/workflows/performance.yml`) valida os scripts de carga k6: instala uma versão k6 fixada e executa `k6 inspect` em cada script em `tests/performance/load/` a cada push e pull request. Uma execução smoke manual contra uma API ativa pode ser disparada via `workflow_dispatch`, com limites `p95-ms` e `error-rate` configuráveis.
| — |`test_seed_router_included_when_enabled`|`/seed` router registered when `ENABLE_LOADTEST_ENDPOINTS=true`|
340
+
| — |`test_seed_router_excluded_when_disabled`|`/seed` router absent when the flag is disabled |
341
+
| — |`test_lifespan_creates_tables_on_non_postgres`|`create_all` runs on SQLite (non-postgres branch) |
342
+
| — |`test_lifespan_runs_postgres_ddl`|`CREATE EXTENSION` + gist `EXCLUDE` constraint emitted on a postgres-dialect engine |
343
+
300
344
## Performance & Load Tests (`performance/load/`)
301
345
302
346
Load tests are **k6** scripts (not pytest). They target a running server and are designed to explore the app's concurrency limits — specifically the SQLAlchemy connection pool (`pool_size=5`, `max_overflow=10`, i.e. 15 connections) behind the 40-thread anyio pool used for sync endpoints (see README "Known limitations").
@@ -515,7 +559,8 @@ tests/
515
559
│ ├── conftest.py # Rótulos/fixtures do TestClient + override do get_db
516
560
│ ├── test_users_api.py
517
561
│ ├── test_rooms_api.py
518
-
│ └── test_reservations_api.py
562
+
│ ├── test_reservations_api.py
563
+
│ └── test_main.py # Teste smoke de boot do app real (lifespan + /openapi.json)
519
564
├── performance/ # Testes de carga k6 (não pytest) - veja "Testes de Performance & Carga"
0 commit comments