graph_test

Version, currently main branch1 version
  • main branchlatestSep 26, 2023

github.com/jwoertink/graph_testing

No description declared in shard.yml.

0 stars
0 dependents
License: not declared

Installation

# Add this to your shard.yml
dependencies:
  graph_test:
    github: jwoertink/graph_testing
    branch: main

main is a branch, not a release, so this tracks it rather than pinning a version.

Then run:

shards install

shard.yml

Crystal
1.9.2
Author
Jeremy Woertink
Target
  • app from src/graph_test.cr

Dependencies

Runtime Dependencies

  • avram~> 1.0.0github: luckyframework/avram
  • lucky~> 1.0.0github: luckyframework/lucky
  • carbon~> 0.3.0github: luckyframework/carbon
  • graphql*github: graphql-crystal/graphql
  • lucky_env~> 0.1.4github: luckyframework/lucky_env
  • lucky_task~> 0.1.1github: luckyframework/lucky_task
  • carbon_sendgrid_adapter~> 0.3.0github: luckyframework/carbon_sendgrid_adapter

README

Graph testing

This is a simple default Lucky app that has the GraphQL shard added. I'm using this to do memory and load testing.

Setup

  • Clone the repo
  • ./script/setup
  • shards build --release --production

Testing

Boot the app with ./bin/graph_test, and then you can use curl to test.

curl -H "Accept: application/json" "http://localhost:3000"

curl -XPOST -H "Accept: application/json" "http://localhost:3000/api/graphql" -d '{"operationName":"Posts","variables":{},"query":"query Posts { posts { title\n releasedAt} }"}'

To load test with wrk

wrk -c 10 -t 6 -d 5m "http://localhost:3000/"

wrk -c 10 -t 6 -d 5m -s script.lua "http://localhost:3000/api/graphql"

Heaptrack

You can install Heaptrack to test the memory.

Boot the app with heaptrack using heaptrack ./bin/graph_test. When it boots, you'll see a file that's being written to.

Once you're done, you can stop the application, then use heaptrack_gui that_file.zst to view the results