Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
benchmark
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Odysseus
benchmark
Commits
4266bd4b
Commit
4266bd4b
authored
Apr 26, 2024
by
Ubuntu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add task test
parent
217b1ab4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
0 deletions
+47
-0
task.js
http/task.js
+47
-0
No files found.
http/task.js
0 → 100644
View file @
4266bd4b
import
http
from
'
k6/http
'
;
import
{
check
,
fail
}
from
'
k6
'
;
export
const
options
=
{
vus
:
2
,
duration
:
'
3600s
'
,
};
export
default
function
()
{
const
url
=
'
http://43.198.252.255:8000/api/v1//txt2img/base/llm
'
;
const
payload
=
JSON
.
stringify
({
"
test
"
:
1
})
const
param
=
{
headers
:{
'
apikey
'
:
'
L6eXzteHYa2Uq0ar4kdMaBOiOIjmRI08
'
,
'
Content-Type
'
:
'
application/json
'
},
};
var
res
=
http
.
post
(
url
,
payload
,
param
);
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
)
{
// check res.boy is empty
if
(
res
.
body
==
null
)
{
fail
(
'
task
'
+
res
.
headers
[
'
Task-Id
'
]
+
'
failed with empty response
'
);
}
else
{
if
(
res
.
json
(
'
task.api_error.message
'
)
!==
undefined
)
{
fail
(
'
task
'
+
res
.
headers
[
'
Task-Id
'
]
+
'
failed with api error:
'
+
res
.
json
(
'
task.api_error.message
'
));
}
if
(
res
.
json
(
'
task.error
'
)
!==
undefined
)
{
fail
(
'
task
'
+
res
.
headers
[
'
Task-Id
'
]
+
'
failed with execute error:
'
+
res
.
json
(
'
task.error
'
));
}
}
}
// console.log("res is ", res);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment