Entain BE Technical Test with golang

Entain BE Technical Test

This test has been designed to demonstrate your ability and understanding of technologies commonly used at Entain.

Please treat the services provided as if they would live in a real-world environment.

Directory Structure

  • api: A basic REST gateway, forwarding requests onto service(s).
  • racing: A very bare-bones racing service.
entain/
├─ api/
│  ├─ proto/
│  ├─ main.go
├─ racing/
│  ├─ db/
│  ├─ proto/
│  ├─ service/
│  ├─ main.go
├─ README.md

Getting Started

  1. Install Go (latest).
brew install go

... or see here.

  1. Install protoc
brew install protobuf

... or see here.

  1. In a terminal window, start our racing service...
cd ./racing

go build && ./racing
➜ INFO[0000] gRPC server listening on: localhost:9000
  1. In another terminal window, start our api service...
cd ./api

go build && ./api
➜ INFO[0000] API server listening on: localhost:8000
  1. Make a request for races...
curl -X "POST" "http://localhost:8000/v1/list-races" \
     -H 'Content-Type: application/json' \
     -d $'{
  "filter": {}
}'

Changes/Updates Required

  • We'd like to see you push this repository up to GitHub/Gitlab/Bitbucket and lodge a Pull/Merge Request for each of the below tasks.
  • This means, we'd end up with 5x PR's in total. Each PR should target the previous, so they build on one-another.
  • Alternatively you can merge each PR/MR after each other into master.
  • This will allow us to review your changes as well as we possibly can.
  • As your code will be reviewed by multiple people, it's preferred if the repository is publicly accessible.
  • If making the repository public is not possible; you may choose to create a separate account or ask us for multiple email addresses which you can then add as viewers.

... and now to the test! Please complete the following tasks.

  1. Add another filter to the existing RPC, so we can call ListRaces asking for races that are visible only.

    We'd like to continue to be able to fetch all races regardless of their visibility, so try naming your filter as logically as possible. https://cloud.google.com/apis/design/standard_methods#list

  2. We'd like to see the races returned, ordered by their advertised_start_time

    Bonus points if you allow the consumer to specify an ORDER/SORT-BY they might be after.

  3. Our races require a new status field that is derived based on their advertised_start_time's. The status is simply, OPEN or CLOSED. All races that have an advertised_start_time in the past should reflect CLOSED.

    There's a number of ways this could be implemented. Just have a go!

  4. Introduce a new RPC, that allows us to fetch a single race by its ID.

    This link here might help you on your way: https://cloud.google.com/apis/design/standard_methods#get

  5. Create a sports service that for sake of simplicity, implements a similar API to racing. This sports API can be called ListEvents. We'll leave it up to you to determine what you might think a sports event is made up off, but it should at minimum have an id, a name and an advertised_start_time.

Note: this should be a separate service, not bolted onto the existing racing service. At an extremely high-level, the diagram below attempts to provide a visual representation showing the separation of services needed and flow of requests.

Don't forget:

Document and comment! Please make sure your work is appropriately documented/commented, so fellow developers know whats going on.

Note:

To aid in proto generation following any changes, you can run go generate ./... from api and racing directories.

Before you do so, please ensure you have the following installed. You can simply run the following command below in each of api and racing directories.

go get github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2 google.golang.org/genproto/googleapis/api google.golang.org/grpc/cmd/protoc-gen-go-grpc google.golang.org/protobuf/cmd/protoc-gen-go

Good Reading

Similar Resources

Byteslice - Byteslice test with golang

ZKP Gnark Objective ot this POC Evaluate the mechanics of ZKP using the gnark ki

Jan 18, 2022

Belajar golang unit test

perintah eksekusi di root folder : go test -v ./... assertion ambil dari framewo

Feb 3, 2022

Test your command line interfaces on windows, linux and osx and nodes viá ssh and docker

Commander Define language independent tests for your command line scripts and programs in simple yaml files. It runs on windows, osx and linux It can

Dec 17, 2022

Run a real Postgres database locally on Linux, OSX or Windows as part of another Go application or test

Run a real Postgres database locally on Linux, OSX or Windows as part of another Go application or test

embedded-postgres Run a real Postgres database locally on Linux, OSX or Windows as part of another Go application or test. When testing this provides

Dec 27, 2022

End to end functional test and automation framework

End to end functional test and automation framework

Declarative end to end functional testing (endly) This library is compatible with Go 1.12+ Please refer to CHANGELOG.md if you encounter breaking chan

Jan 6, 2023

Test your code without writing mocks with ephemeral Docker containers 📦 Setup popular services with just a couple lines of code ⏱️ No bash, no yaml, only code 💻

Gnomock – tests without mocks 🏗️ Spin up entire dependency stack 🎁 Setup initial dependency state – easily! 🏭 Test against actual, close to product

Dec 29, 2022

go-carpet - show test coverage in terminal for Go source files

go-carpet - show test coverage in terminal for Go source files

go-carpet - show test coverage for Go source files To view the test coverage in the terminal, just run go-carpet. It works outside of the GOPATH direc

Jan 8, 2023

http integration test framework

go-hit hit is an http integration test framework written in golang. It is designed to be flexible as possible, but to keep a simple to use interface f

Dec 29, 2022

Go testing in the browser. Integrates with `go test`. Write behavioral tests in Go.

Go testing in the browser. Integrates with `go test`. Write behavioral tests in Go.

GoConvey is awesome Go testing Welcome to GoConvey, a yummy Go testing tool for gophers. Works with go test. Use it in the terminal or browser accordi

Dec 30, 2022
go-test-trace is like go test but it also generates distributed traces.
go-test-trace is like go test but it also generates distributed traces.

go-test-trace go-test-trace is like go test but it also generates distributed traces. Generated traces are exported in OTLP to a OpenTelemetry collect

Jan 5, 2023
Flugel Test Documentation for steps to run and test the automatio
Flugel Test Documentation for steps to run and test the automatio

Flugel Test Documentation Documentation for steps to run and test the automation #Test-01 1 - Local Test Using Terratest (End To End) 1- By runing " t

Nov 13, 2022
This repository includes consumer driven contract test for provider, unit test and counter api.

This repository includes consumer driven contract test for provider, unit test and counter api.

Feb 1, 2022
Sql mock driver for golang to test database interactions

Sql driver mock for Golang sqlmock is a mock library implementing sql/driver. Which has one and only purpose - to simulate any sql driver behavior in

Dec 31, 2022
A test-friendly replacement for golang's time package

timex timex is a test-friendly replacement for the time package. Usage Just replace your time.Now() by a timex.Now() call, etc. Mocking Use timex.Over

Dec 21, 2022
Simple HTTP integration test framework for Golang

go-itest Hassle-free REST API testing for Go. Installation go get github.com/jefflinse/go-itest Usage Create tests for your API endpoints and run the

Jan 8, 2022
gRPC Test Utilities for Golang
gRPC Test Utilities for Golang

gRPC Test Utilities for Golang Test gRPC service and client like a pro. Prerequisites Go >= 1.16 Install go get github.com/nhatthm/grpcmock Usage Invo

Dec 14, 2022
Http test server written in Golang.

Dummy Server Http test server written in Golang. Can get any request method and log headers, body, path and remote address. Useful if you need to know

Oct 31, 2021
Simple test driven approach in "GOLANG"
Simple test driven approach in

Testing in GOLANG Usage Only test go test -v Coverage go test -cover or go test -coverprofile=coverage.out go tool cover -html=coverage.out Benchmark

Dec 5, 2021
A simple yet intuitive golang unit test framework.

gotest Intuitive and simple golang testing framework which helps in writing unit tests in a way which improves the readability of the test. Here is an

Jan 1, 2022