cosmicpython / code

Example application code for the python architecture book
Other
2.07k stars 922 forks source link

Postgre/API never came up #62

Closed uguryiilmz closed 1 year ago

uguryiilmz commented 1 year ago

In chapter 4 for the service layer, when i run the end to end tests i keep getting this error. When i try to comment out postgresql and use sqllite intead, the error turn insto api never came up. Are end to end tests supposed to use real database? I thought they would use sqllite like integration tests. These are the errors i'm getting.

Screen Shot 2023-03-21 at 11 40 29 PM Screen Shot 2023-03-21 at 11 41 26 PM

when i try to dive deeper, i noticed the error is coming from web server

Screen Shot 2023-03-21 at 11 42 32 PM

any idea why this might be happening? Thanks for the great book, it helped me a lot!

uguryiilmz commented 1 year ago

I was able to run the end-to-end tests with the following approach:

my first misunderstanding was that end to end tests need a service up to run. it expects you to run the flask server on port 5001. however, docker is not really working -i noticed there were some issues related to that here. so i needed to run my flask server locally on a separate terminal on port 5001, then when i run the tests they all passed successfully.

hjwp commented 1 year ago

if you're copying the code in the repo, there's a dockerfile and a docker-compose config for runing the api + flask?