test: add smoke tests

add-more-languages
Meng Zhang 2023-04-02 21:15:22 +08:00
parent 6e0ab3af49
commit 796ce8154e
2 changed files with 16 additions and 0 deletions

View File

@ -18,3 +18,6 @@ $(PRE_COMMIT_HOOK):
poetry run pre-commit install --install-hooks
setup-development-environment: install-poetry $(PRE_COMMIT_HOOK)
test-smoke:
k6 run tests/*.smoke.js

13
tests/default.smoke.js Normal file
View File

@ -0,0 +1,13 @@
import http from "k6/http";
import { check } from "k6";
export default function () {
const payload = JSON.stringify({
prompt: "def binarySearch(arr, left, right, x):\n mid = (left +",
});
const headers = { "Content-Type": "application/json" };
const res = http.post("http://localhost:5000/v1/completions", payload, {
headers,
});
check(res, { success: (r) => r.status === 200 });
}