Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
it-bott-integrasjoner
ubw-client
Commits
171781c7
Commit
171781c7
authored
Feb 02, 2021
by
Petr Kalashnikov
Browse files
Stylistic changes
parent
113fd80b
Pipeline
#52144
passed with stage
in 2 minutes and 13 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
171781c7
...
...
@@ -171,7 +171,7 @@ python -m pytest -m integration
### Stresstesting
Set credentials in
`config.yaml`
or
`config_example.yaml`
and run
Set credentials in
`config.yaml`
and run
```
sh
locust
-f
locust_testing/stresstest.py
...
...
locust_testing/stresstest.py
View file @
171781c7
import
time
from
locust
import
HttpUser
,
TaskSet
,
task
,
between
from
locust
import
HttpUser
,
TaskSet
,
task
,
between
import
bios
import
logging
logger
=
logging
.
getLogger
(
__name__
)
ubw_config
=
bios
.
read
(
'config_example.yaml'
)
endpoints_list
=
ubw_config
[
'rest'
][
'endpoints'
]
headers
=
ubw_config
[
'rest'
][
'headers'
]
ubw_config
=
bios
.
read
(
"config_gravitee.yaml"
)
endpoints_list
=
ubw_config
[
"rest"
][
"endpoints"
]
headers
=
ubw_config
[
"rest"
][
"headers"
]
def
get_endpoint
(
endpoint
):
return
"/"
+
endpoints_list
[
endpoint
][
"url"
]
+
"/"
class
WebsiteTasks
(
TaskSet
):
@
task
(
10
)
#
weights can be adjusted in prod
@
task
(
10
)
#
weights can be adjusted in prod
def
check_get_arbeidsordre
(
self
):
self
.
client
.
get
(
get_endpoint
(
"arbeidsordre"
)
+
"UB/102454100"
,
headers
=
headers
)
...
...
@@ -56,14 +56,16 @@ class WebsiteTasks(TaskSet):
@
task
(
2
)
def
check_get_perioder
(
self
):
self
.
client
.
get
(
get_endpoint
(
"periode"
)
+
"UB?periodType/periodType+eq+GL"
,
headers
=
headers
)
self
.
client
.
get
(
get_endpoint
(
"periode"
)
+
"UB?periodType/periodType+eq+GL"
,
headers
=
headers
)
@
task
(
2
)
def
check_get_arbeidsordrer
(
self
):
self
.
client
.
get
(
get_endpoint
(
"arbeidsordre"
)
+
"UB"
,
headers
=
headers
)
@
task
(
10
)
def
check_get_
arbeidsordre
(
self
):
def
check_get_
specific_anlegg
(
self
):
self
.
client
.
get
(
get_endpoint
(
"anlegg"
)
+
"UB/102454100"
,
headers
=
headers
)
@
task
(
10
)
...
...
@@ -92,15 +94,15 @@ class WebsiteTasks(TaskSet):
@
task
(
5
)
def
check_get_bilagstyper
(
self
):
req
=
self
.
client
.
get
(
get_endpoint
(
"bilagstyper"
)
+
"UB"
,
headers
=
headers
)
self
.
client
.
get
(
get_endpoint
(
"bilagstyper"
)
+
"UB"
,
headers
=
headers
)
@
task
(
10
)
def
check_get_bilagstype
(
self
):
req
=
self
.
client
.
get
(
get_endpoint
(
"bilagstyper"
)
+
"UB/TT"
,
headers
=
headers
)
self
.
client
.
get
(
get_endpoint
(
"bilagstyper"
)
+
"UB/TT"
,
headers
=
headers
)
@
task
(
5
)
def
check_get_ressursere
(
self
):
req
=
self
.
client
.
get
(
get_endpoint
(
"ressurser"
)
+
"UB"
,
headers
=
headers
)
self
.
client
.
get
(
get_endpoint
(
"ressurser"
)
+
"UB"
,
headers
=
headers
)
@
task
(
10
)
def
check_get_ressurs
(
self
):
...
...
@@ -109,4 +111,4 @@ class WebsiteTasks(TaskSet):
class
WebsiteUser
(
HttpUser
):
tasks
=
[
WebsiteTasks
]
wait_time
=
between
(
5.100
,
7.500
)
#
to adjust in prod
wait_time
=
between
(
5.100
,
7.500
)
#
to adjust in prod
requirements-test.txt
View file @
171781c7
...
...
@@ -5,3 +5,4 @@ pyyaml
coverage
pylint
black
locust
requirements.txt
View file @
171781c7
...
...
@@ -2,3 +2,4 @@ requests
pydantic
zeep
lxml
locust
tox.ini
View file @
171781c7
...
...
@@ -18,7 +18,7 @@ commands =
deps
=
black
commands
=
black
--check
--diff
ubw_client
tests
setup.py
black
--check
--diff
ubw_client
tests
setup.py
locust_testing
# Linters
[testenv:flake8]
...
...
@@ -32,7 +32,7 @@ deps =
# flake8-import-order
# flake8-docstrings
commands
=
flake8
--per-file-ignores
=
"__init__.py:F401"
ubw_client
flake8
--per-file-ignores
=
"__init__.py:F401"
ubw_client
locust_testing
[testenv:bandit]
basepython
=
python3
...
...
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