Test Node with Docker, docker-compose and Postgres #6

preview_player
Показать описание


00:00 How to use npm test with docker-compose
02:13 new configuration for testing with docker
03:50 add npm test script
04:38 writing a bash script to spin up Postgres
06:14 waiting for Postgres container to accept connections
08:27 running all tests once database is up
08:45 tearing down test setup
09:33 updating our npm test script
10:56 running our test against a local database
11:09 running tests against dockerized Postgres database
12:52 checking if we fulfill all acceptance criteria
Рекомендации по теме
Комментарии
Автор

This is the last video in this series. Let me know what you think about it.
Please post your video ideas in the comments below

jgoebel
Автор

Wow...dockers explained in a very simple way, would always recommend your video channels. Thanks a bunch!

adeyemisunday
Автор

I watched this entire series and wanted to say thank you so much. This was exactly what I needed to get started and this series deserves way more views than it does now. There's nothing like it from what I came across.

aznballer
Автор

Extremely useful tutorial, well explained, thank you very much

albertoplebani
Автор

thank you for this series! Keep up the good work!

mlnrfyg
Автор

Thanks for the content. You helped me a lot. I only use dockerize instead of pg_isready.

murilomaia
Автор

I just found this, and I'm to the step just before this video. I'm on Windows, but I'm trying to create a learning resource for people, so I don't want to do a solution that won't work cross-platform. I'm curious about why your solution uses the shell vs. just using the container you created that runs the app?

amyIsFlexable
Автор

This tutorial really helped me a lot, thanks!

My only issue is that whenever I run the test script, it throws the error "getaddrinfo ENOTFOUND postgres" (postgres is the service name of the database in docker compose). From what I gather, the express app can't find the postgres container when running the test. But when I run both the express app and the postgreSQL in a container, I can access the database through postman.

I'm using Docker Desktop with Docker 24.0.6. I'm also using node-postgres to connect my express app to postgreSQL and I'm sure that the hostname I'm using is the same with the service name of the database in docker-compose.yml. Is this a DNS or a networking problem? Do you have any idea on how I can fix this?

nalskipper
Автор

Any alternative for windows? chmod isn't a command on windows. Currently looking for potential solution but otherwise awesome video!

Thebaws
Автор

Hi, this is very good tutorial about nodejs and postgresql with docker-compose. Not so much good material out there. I have a question if i want to use CI/CD with AWS this code is it possible?

webdeveloper