Commit 371c785e authored by vicotor's avatar vicotor

update scripts log

parent 73f22492
......@@ -2,12 +2,13 @@ import http from 'k6/http';
import { check, fail } from 'k6';
export const options = {
vus: 5,
vus: 1,
duration: '10s',
};
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({
"test": 1
})
......@@ -18,16 +19,17 @@ export default function() {
},
};
var res = http.post(url, payload, param);
const checkOutput = check(
res,
{
'response code was 200': (res) => res.status == 200,
'task is succeed': (res) => res.json("task.is_success") == true,
},
{ myTag: "task success check" }
);
if (!checkOutput) {
fail('task failed with error: ' + res.json('task.error'));
const statusCheck = check(res, {
'status is 200': (r) => r.status === 200,
});
const taskCheck = check(res, {
'task is success': (r) => r.json('task.is_success') === true,
});
if (!statusCheck) {
// console.log('task status failed', res.status);
fail('task ' + res.headers['Task-Id'] + ' failed with status error: ' + res.status);
} else if (!taskCheck) {
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