Skip to content

Commit 4acbeac

Browse files
committed
fix: integration tests
1 parent 5be965b commit 4acbeac

4 files changed

Lines changed: 29 additions & 21 deletions

File tree

CLAUDE.md

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
44

55
## About the Project
66

7-
Read the `README.md` file for information about the project, its architecture,
8-
how to run it and how to test it.
7+
Read the `README.md` file for information about the project, its architecture, how to run it and how to test it.
98

10-
## Current State
11-
12-
Branch: main
13-
Commit: 45197bc (Initial commit)
14-
Status: clean
15-
16-
## Next Steps
17-
18-
- CI (34935fb) - add CI to run UnitTests
19-
- Authentication & authorization not yet implemented
20-
- Order state transitions not yet implemented
9+
Don't assume anything about the project, all information should be at `README.md`.
10+
If it's not, ask the user and update `README.md`.

Makefile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
.PHONY: help run run-dev test-unit test-integration clean stop
1+
.PHONY: help run stop test test-unit test-integration clean
22

33
help:
44
@echo "Available commands:"
55
@echo " build - Build the docker container"
66
@echo " run - Run the application (development with auto-reload, debug mode)"
7+
@echo " test - Run all tests"
78
@echo " test-unit - Run unit tests"
89
@echo " test-integration - Run integration tests with fresh database"
910
@echo " stop - Stop the application"
@@ -15,17 +16,17 @@ build:
1516
run:
1617
$(MAKE) build
1718
docker compose up -d
18-
@echo "Waiting for database to be ready..."
19-
until nc -zv localhost 5432; do sleep 1; done
20-
@echo "Running migrations..."
21-
docker compose run --rm app python -m alembic upgrade head
2219
@echo "Application running at http://localhost:8000"
2320
@echo "Swagger UI is available at http://localhost:8000/docs"
2421

2522
stop:
2623
@echo "Stopping the application..."
2724
docker compose stop
2825

26+
test:
27+
$(MAKE) test-unit
28+
$(MAKE) test-integration
29+
2930
test-unit:
3031
$(MAKE) build
3132
@echo "Running unit tests..."

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,5 +97,6 @@ curl http://localhost:8000/orders/
9797
| `make run` | Run the app (development with auto-reload) |
9898
| `make stop` | Stop the app |
9999
| `make clean` | Clean up Docker containers and volumes |
100+
| `make test` | Run all tests |
100101
| `make test-unit` | Run unit tests |
101102
| `make test-integration` | Run integration tests |

docker-compose.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: '3.8'
2-
31
services:
42
postgres:
53
image: postgres:15
@@ -13,6 +11,23 @@ services:
1311
- postgres_data:/var/lib/postgresql/data
1412
networks:
1513
- app_network
14+
healthcheck:
15+
test: ["CMD-SHELL", "pg_isready -U postgres -d app"]
16+
interval: 10s
17+
timeout: 5s
18+
retries: 5
19+
20+
postgres-migrations:
21+
image: python-fastapi-example-oms:dev
22+
environment:
23+
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/app
24+
DEBUG: "true"
25+
depends_on:
26+
postgres:
27+
condition: service_healthy
28+
command: alembic -c alembic.ini upgrade head
29+
networks:
30+
- app_network
1631

1732
app:
1833
image: python-fastapi-example-oms:dev
@@ -22,7 +37,8 @@ services:
2237
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/app
2338
DEBUG: "true"
2439
depends_on:
25-
- postgres
40+
postgres:
41+
condition: service_healthy
2642
volumes:
2743
- .:/app
2844
command: uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload

0 commit comments

Comments
 (0)