If a microservice depends on kafka or postgres, it should wait until the service is running. Docker's depends_on is not enough since it just waits until container's startup, but not the whole service.
Either using dockerize or testing the dependencies through their APIs should be correct.