A small project to explore GRPC. Using DynamoDB on Localstack as a database, the server supports 5 different operations and a health check:
GetUser(GetUserInput) returns (User)
AddUser(AddUserInput) returns (User)
ModifyUser(ModifyUserInput) returns (User)
RemoveUser(RemoveUserInput) returns (User)
ListUsers(ListUsersInput) returns (ListUsersResponse)
The e2e directory contains end-to-end test acting as a GRPC client in order to test the features from a user perspective.
- Start the application and DynamoDB database (via localstack) through docker compose:
docker compose up --build-
Wait until the server is running (it will log "Starting server on port 50051")
-
Run the end-to-end tests on your own machine:
go clean -testcache && LOCAL=true go test -v ./e2e- Spin up DynamoDB through localstack:
docker compose up localstack- Run the server on your own machine:
LOCAL=true go run ./server- Run the end-to-end tests on your own machine:
go clean -testcache && LOCAL=true go test -v ./e2e- Spin up DynamoDB through localstack:
docker compose up localstack- Run the server on your own machine:
LOCAL=true go run ./server- Seed the necessary 'users' table in DynamoDB with a bunch of test users:
LOCAL=true sh seed_db_with_test_data.sh- The
.protodefinition lives inusers/users.proto. Whenever you update it, run the following command to re-create the Golang interfaces:
protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative users/users.proto