Example distage
project presented at Functional Scala 2019
Features distage, Bifunctor Tagless Final, ZIO Environment for composing test fixtures, and distage-docker for setting up test containers.
To launch tests that require postgres ensure you have a docker
daemon running in the background.
Use sbt test
to launch the tests.
You can launch the application with the following command.
./launcher -u scene:managed :leaderboard
Afterwards you can call the HTTP methods:
curl -X POST http://localhost:8080/ladder/50753a00-5e2e-4a2f-94b0-e6721b0a3cc4/100
curl -X POST http://localhost:8080/profile/50753a00-5e2e-4a2f-94b0-e6721b0a3cc4 -d '{"name": "Kai", "description": "S C A L A"}'
# check leaderboard
curl -X GET http://localhost:8080/ladder
# user profile now shows the rank in the ladder along with profile data
curl -X GET http://localhost:8080/profile/50753a00-5e2e-4a2f-94b0-e6721b0a3cc4
If ./launcher
command fails for you with some cryptic stack trace, there's most likely an issue with your Docker. First of all, check that you have docker
and contrainerd
daemons running. If you're using something else than Ubuntu, please stick to the relevant installation page:
sudo systemctl status docker
sudo systemctl status contrainerd
Both of them should have Active: active (running)
status. If your problem isn't gone yet, most likely you don't have your user in docker
group. Here you can find a tutorial on how to do so. Don't forget to logout of your session or restart your virtual machine before proceeding. If you still have problems, don't hesitate to open an issue.
- Functional Scala 2019 – Hyperpragmatic Pure FP testing with distage-testkit
- ScalaWAW Warsaw Meetup – Livecoding this project