Commit 371c785e authored by vicotor's avatar vicotor

update scripts log

parent 73f22492
...@@ -2,12 +2,13 @@ import http from 'k6/http'; ...@@ -2,12 +2,13 @@ import http from 'k6/http';
import { check, fail } from 'k6'; import { check, fail } from 'k6';
export const options = { export const options = {
vus: 5, vus: 1,
duration: '10s', duration: '10s',
}; };
export default function() { export default function() {
const url = 'http://43.198.252.255:8000/api/v1//txt2img/base/llm'; // const url = 'http://43.198.252.255:8000/api/v1//txt2img/base/llm';
const url = 'http://43.198.252.255:8000/api/v1//txt2img/base/llmm';
const payload = JSON.stringify({ const payload = JSON.stringify({
"test": 1 "test": 1
}) })
...@@ -18,16 +19,17 @@ export default function() { ...@@ -18,16 +19,17 @@ export default function() {
}, },
}; };
var res = http.post(url, payload, param); var res = http.post(url, payload, param);
const checkOutput = check( const statusCheck = check(res, {
res, 'status is 200': (r) => r.status === 200,
{ });
'response code was 200': (res) => res.status == 200, const taskCheck = check(res, {
'task is succeed': (res) => res.json("task.is_success") == true, 'task is success': (r) => r.json('task.is_success') === true,
}, });
{ myTag: "task success check" } if (!statusCheck) {
); // console.log('task status failed', res.status);
fail('task ' + res.headers['Task-Id'] + ' failed with status error: ' + res.status);
if (!checkOutput) { } else if (!taskCheck) {
fail('task failed with error: ' + res.json('task.error')); fail('task ' + res.headers['Task-Id'] + ' failed with execute error: ' + res.json('task.error'));
} }
// console.log("res is ", res);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment