Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE3
/
balancer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
4cf44483
authored
Mar 10, 2023
by
Karsa Zoltán István
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
load testing auth
parent
eb6f5e2a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
stresstest/main.py
+11
-5
No files found.
stresstest/main.py
View file @
4cf44483
import
json
import
json
from
locust
import
HttpUser
,
task
,
between
from
locust
import
TaskSet
,
task
,
between
,
HttpUser
class
PerformanceTests
(
HttpUser
):
wait_time
=
between
(
1
,
3
)
class
PerformanceTests
(
TaskSet
):
def
on_start
(
self
):
def
on_start
(
self
):
self
.
client
.
post
(
"/user/login"
,
{
resp
=
self
.
client
.
post
(
"/user/login"
,
json
=
{
"username"
:
"karsa"
,
"username"
:
"karsa"
,
"password"
:
"12345678"
"password"
:
"12345678"
})
})
self
.
client
.
headers
=
{
'Authorization'
:
'Bearer '
+
json
.
loads
(
resp
.
_content
)[
'access_token'
]}
@task
(
1
)
@task
(
1
)
def
testFastApi
(
self
):
def
testFastApi
(
self
):
self
.
client
.
get
(
"/lb/dashboard/acpi/vm/1/"
)
self
.
client
.
get
(
"/lb/dashboard/acpi/vm/1/"
)
class
WebsiteUser
(
HttpUser
):
tasks
=
[
PerformanceTests
]
min_wait
=
5000
max_wait
=
9000
\ No newline at end of file
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