Provides a gRPC and optional HTTP backend for TrackMyFish.
- Install grpcurl
- Go >= 1.16. Because we use embed, any versions older than 1.16 won't work.
grpcurl -plaintext localhost:8080 list
Note: This assumes the api repository is cloned at the same location as this repository (../api
), that the required dependencies have been install into the .cache
directory, of the api repository, and that you're using an Apple device (Darwin).
grpcurl -protoset <(cd ../proto; ../proto/.cache/Darwin/x86_64/bin/buf image build -o -) -plaintext localhost:8080 list trackmyfish.v1alpha1.TrackMyFishService
curl -H "Content-Type: application/json" -X POST localhost:8443/api/v1alpha1/fish -d '{"genus": "Pterophyllum", "species": "scalare", "commonName": "Angel Fish", "gender": "MALE"}'
curl -H "Content-Type: application/json" -X GET localhost:8443/api/v1alpha1/fish
curl -H "Content-Type: application/json" -X DELETE localhost:8443/api/v1alpha1/fish/1
curl -H "Content-Type: application/json" -X POST localhost:8443/api/v1alpha1/tank/statistics -d '{"testDate": "2021/08/06 10:00", "ammonia": "2.0"}'
curl -H "Content-Type: application/json" -X GET localhost:8443/api/v1alpha1/tank/statistics
curl -H "Content-Type: application/json" -X DELETE localhost:8443/api/v1alpha1/tank/statistics/1
curl -H "Content-Type: application/json" -X POST localhost:8443/api/v1alpha1/tanks -d '{"make": "Juwel", "model": "Rio 180", "name": "Semi-Aggressive", "location": "Office"}'
curl -H "Content-Type: application/json" -X GET localhost:8443/api/v1alpha1/tanks
curl -H "Content-Type: application/json" -X DELETE localhost:8443/api/v1alpha1/tanks/1
docker build -f ./Dockerfile -t trackmyfish .
docker run -p 8443:8443 -v /path/to/config:/config trackmyfish
docker login
docker tag trackmyfish simondrake/trackmyfish:v1alpha1
docker push simondrake/trackmyfish:v1alpha1
Tests are separated into two separate categories
Unit Tests do not require any set-up steps and can simply be run with make test
Integration Tests require actual services to be up (e.g. Postgres), so require a bit of set-up before they can be run.
- Run the test database (
docker-compose -f docker-compose-integration-tests.yaml up -d
) - Run the
docker-compose
command again, because the DB won't be available when the migrations run (see #1) - Run
make integration-test
Note: If you need to login to the db container, you can do so with the following command:
docker exec -it integration_tests_db psql postgresql://user:password@localhost:5432/trackmyfishtests
- Write Tests