diff --git a/backend/src/controller/testController.ts b/backend/src/controller/testController.ts new file mode 100644 index 000000000..3d132a7aa --- /dev/null +++ b/backend/src/controller/testController.ts @@ -0,0 +1,13 @@ +import { Response } from 'express'; + +import { handleAddInfoToChatHistory } from '@src/controller/chatController'; +import { OpenAiAddInfoToChatHistoryRequest } from '@src/models/api/OpenAiAddInfoToChatHistoryRequest'; + +function handleTest(req: OpenAiAddInfoToChatHistoryRequest, res: Response) { + let num = 0; + for (let x = 0; x <= 1000000; x++) { + num = num++; + } + handleAddInfoToChatHistory(req, res); +} +export { handleTest }; diff --git a/backend/src/sessionRoutes.ts b/backend/src/sessionRoutes.ts index e33f01761..d9a19660e 100644 --- a/backend/src/sessionRoutes.ts +++ b/backend/src/sessionRoutes.ts @@ -27,6 +27,7 @@ import { handleSetModel, } from './controller/modelController'; import { handleResetProgress } from './controller/resetController'; +import { handleTest } from './controller/testController'; import { ChatModel, defaultChatModel } from './models/chat'; import { LevelState, getInitialLevelStates } from './models/level'; @@ -130,4 +131,7 @@ if (isProd) { }); } +// Testing dummy endpoint +router.post('/test/load', handleTest); + export default router; diff --git a/k6/smoke.js b/k6/smoke.js index 3a7f63042..f334467b7 100644 --- a/k6/smoke.js +++ b/k6/smoke.js @@ -1,20 +1,22 @@ import http from 'k6/http'; +// import exec from 'k6/execution'; 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 + duration: '10s', // This can be shorter or just a few iterations }; export default () => { const data = { message: "hi", currentLevel: '3' }; - const url = 'http://localhost:3001/openai/chat'; + const url = 'http://localhost:3001/test/load'; + // console.log('VU ID:' + exec.vu.idInTest); let response = http.post(url, JSON.stringify(data), { headers: { 'Content-Type': 'application/json' }, }); check(response, { 'response code was 200': (response) => response.status === 200, }); - sleep(1); + sleep(0.1); };