From 35202232c2bca1acbec3691cafe75faba853b477 Mon Sep 17 00:00:00 2001 From: Arya Bhimani Date: Mon, 28 Oct 2024 11:35:39 -0400 Subject: [PATCH] docs: add readme for how to run k6 tests locally (#36) --- k6/README.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 k6/README.md diff --git a/k6/README.md b/k6/README.md new file mode 100644 index 0000000..96f962c --- /dev/null +++ b/k6/README.md @@ -0,0 +1,38 @@ +# k6 (Integration Tests) + +This directory contains integration tests for the k6 project. In +summary, this folder does the following: +1. Start a ruby server, with hive enabled +2. Start a ruby server, with hive disabled +3. Start a mock GraphQL Hive `/usage` api +4. Run GraphQL Requests against the 2 servers +5. Compare the results + +## Prerequisites +1. Ruby > 3.0.0 +2. Node > 14.0.0 +3. [k6 installed](https://grafana.com/docs/k6/latest/set-up/install-k6/) + +## Running the tests (locally) + +Start the ruby server with HIVE_ENABLED=true +```bash +cd graphql-api +HIVE_ENABLED=true bundle exec puma -t 0:1 -p 9291 +``` + +Start the ruby server with HIVE_ENABLED=false +```bash +cd graphql-api +bundle exec puma -t 0:1 -p 9291 +``` + +Start the usage mock server +```bash +node usage-mock.js +``` + +Run k6 tests: +```bash +k6 run k6.js +``` \ No newline at end of file