Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial k6 setup #813

Merged
merged 7 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions k6/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# K6 ReadMe

## Introduction

This readme is for how to install and us k6 for manual load testing
kclark-scottlogic marked this conversation as resolved.
Show resolved Hide resolved

## Installation

The link for installation of k6 can be found [here](https://grafana.com/docs/k6/latest/get-started/installation/). Follow the instructions on the link for your installer of choice
kclark-scottlogic marked this conversation as resolved.
Show resolved Hide resolved

## Running locally

1. Make sure local backend is running
kclark-scottlogic marked this conversation as resolved.
Show resolved Hide resolved
1. in a sepearate terminal run ```k6 run script.js``` (Where 'script' is the name of the script you want to run)
kclark-scottlogic marked this conversation as resolved.
Show resolved Hide resolved
20 changes: 20 additions & 0 deletions k6/smoke.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import http from 'k6/http';
import { check, sleep } from 'k6';

export const options = {
vus: 3, // Key for Smoke test. Keep it at 2, 3, max 5 VUs
duration: '1m', // This can be shorter or just a few iterations
};

export default () => {
let data = { message: "hi", currentLevel: '3' };
kclark-scottlogic marked this conversation as resolved.
Show resolved Hide resolved
const url = 'http://localhost:3001/openai/chat';

let response = http.post(url, JSON.stringify(data), {
headers: { 'Content-Type': 'application/json' },
});
check(response, {
'response code was 200': (response) => response.status == 200,
kclark-scottlogic marked this conversation as resolved.
Show resolved Hide resolved
});
sleep(1);
};
Loading