Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
funkwhale
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mélanie Chauvel
funkwhale
Commits
d1fcea56
Verified
Commit
d1fcea56
authored
5 years ago
by
Eliot Berriot
Browse files
Options
Downloads
Patches
Plain Diff
Added load testing test case
parent
6b5cb975
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
api/tests/loadtesting/library.py
+38
-0
38 additions, 0 deletions
api/tests/loadtesting/library.py
with
38 additions
and
0 deletions
api/tests/loadtesting/library.py
0 → 100644
+
38
−
0
View file @
d1fcea56
import
os
import
urllib.parse
from
locust
import
HttpLocust
,
TaskSet
,
task
JWT_TOKEN
=
os
.
environ
.
get
(
"
JWT_TOKEN
"
)
DATA
=
{
"
playable
"
:
True
}
HEADERS
=
{}
if
JWT_TOKEN
:
print
(
"
Starting authenticated session
"
)
HEADERS
[
"
authorization
"
]
=
"
JWT {}
"
.
format
(
JWT_TOKEN
)
class
WebsiteTasks
(
TaskSet
):
@task
def
albums
(
self
):
self
.
client
.
get
(
"
/api/v1/albums?
"
+
urllib
.
parse
.
urlencode
(
DATA
),
headers
=
HEADERS
)
@task
def
artists
(
self
):
self
.
client
.
get
(
"
/api/v1/artists?
"
+
urllib
.
parse
.
urlencode
(
DATA
),
headers
=
HEADERS
)
@task
def
tracks
(
self
):
self
.
client
.
get
(
"
/api/v1/tracks?
"
+
urllib
.
parse
.
urlencode
(
DATA
),
headers
=
HEADERS
)
class
WebsiteUser
(
HttpLocust
):
task_set
=
WebsiteTasks
min_wait
=
1000
max_wait
=
3000
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment