Participants must implement a GraphQL API that resolves data from an upstream REST API that is deployed on port 3000
.
The GraphQL schema that you need to implement is specified in the schema.graphql in the root of this repository.
On the CI your GraphQL server will need to fetch data from the upstream REST API at:
Base URL: http://localhost:3000
-
GET
/posts
Returns a list of posts. -
GET
/posts/:id
Returns a post by ID. -
GET
/users
Returns a list of users. -
GET
/users/:id
Returns a user by ID. -
GET
/users?id=1&id=2&id=3
Returns multiple users with IDs specified in query parameters.
The structure of the REST API responses will match the GraphQL schema fields.
Your GraphQL server should start on url http://localhost:8000/graphql
and serve POST
Graphql requests on it.
- Fork this repository
- Clone the repository locally or run the codespace of your choice
- Add new folder to
./projects
folder with your username. Copy the/template
folder content from the repository root to your folder to populate required files. - Add the code of the implementation inside the folder
- you could use any language or tool by your choice that allows you to create the required GraphQL server. Just make sure the solution could be replicated in Github Actions environment.
- use the
schema.graphql
file from the root of the repo. Feel free to copy the file to your folder and change it the way you needed to work properly, but don't change the structure of types
- Add
run.sh
file that installs required tools and runs the server- the script is running on Github Hosted runner. List of available tools and packages could be found here
- first add installation and build steps for required tools and code. E.g.
npm i
orcargo build --release
- add steps to start the server. E.g.
npm start
orcargo run --release
- make sure the script is marked as executable
chmod +x run.sh
- Make sure your code is working and handles GraphQL requests
- Commit and push changes to your fork
- Create a pull request from your fork into original repository
To run the mock server locally you need a Rust toolchain installed.
To run the mock server in the root of the repo run:
cargo run -p mock-api
The server will start on http://localhost:3000
and will serve the endpoints mentioned in data source
To run the whole test suite locally you need a Rust toolchain installed.
For the first time you need to build the mock server code (one-time run):
cargo build -p mock-api
After finishing the command you can use following command to run test suite:
cargo run
If you need to run only specific project, specify this project as option with name of the directory of the project:
cargo run -- --project tailcall
- Build everything that is required to run test environment and custom implementation
- Start the test environment to validate response: mock server and reference server that is used to test implementation correctness
- Run correctness tests
- Run the benchmark
- Run correctness tests again
For testing the correctness repeat next process multiple times:
- Regenerate mocks on mock-api server
- For every request in
/tests
directory execute the request to user implementation - Execute the same request for reference implementation
- Compare the results and in case they are mismatch throw an error
Ran many requests in parallel to the server with tools like wrk
or k6
to collect info about provided RPS and latency