-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Completed two test plans: the normal plan and the classroom plan * Refactored into using abstract base user types. These are implemented in test plan scenario files. * Added new task user types: app viewer, power user, * Completed authentication methods. * Created non-locust module for opening user apps which created k8s pods on cluster. * More settings and configuration to customize the user app behaviour * Better handling of switching between test environments. * Added task to register new user account. * Added the standard code linters and checkers to this repository. * Introduced the standard logging library. Converted most prints to logging. --------- Co-authored-by: Nikita Churikov <[email protected]>
- Loading branch information
Showing
23 changed files
with
1,015 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[flake8] | ||
max-line-length = 120 | ||
extend-ignore = | ||
# Whitespace before ':' | ||
E203, | ||
# imported but unused | ||
F401 | ||
exclude = | ||
.git, | ||
__pycache__, | ||
env, | ||
.env, | ||
venv, | ||
.venv |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Pre-commit linters and code checks | ||
|
||
on: | ||
pull_request: | ||
paths-ignore: | ||
- 'README.md' | ||
push: | ||
branches: | ||
- develop | ||
paths-ignore: | ||
- 'README.md' | ||
|
||
jobs: | ||
pre_commit: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pre-commit==3.3.3 | ||
- name: Run pre-commit | ||
run: pre-commit run --all-files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
default_stages: | ||
- commit | ||
repos: | ||
# general hooks to verify or beautify code | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.5.0 | ||
hooks: | ||
- id: check-added-large-files | ||
args: [--maxkb=5000] | ||
- id: trailing-whitespace | ||
- id: check-json | ||
- id: check-merge-conflict | ||
- id: check-xml | ||
- id: check-yaml | ||
exclude: ^charts/ | ||
- id: detect-private-key | ||
- id: mixed-line-ending | ||
- id: end-of-file-fixer | ||
- id: pretty-format-json | ||
args: [--autofix] | ||
|
||
|
||
# autoformat code with black formatter | ||
- repo: https://github.com/psf/black | ||
rev: 23.11.0 | ||
hooks: | ||
- id: black | ||
|
||
# beautify and sort imports | ||
- repo: https://github.com/pycqa/isort | ||
rev: 5.12.0 | ||
hooks: | ||
- id: isort | ||
additional_dependencies: [toml] | ||
exclude: '^(.*?/)?migrations/.*\.py$' | ||
|
||
|
||
# check code style | ||
- repo: https://github.com/pycqa/flake8 | ||
rev: 6.1.0 | ||
hooks: | ||
- id: flake8 | ||
# exclude added here because the .flake8 settings are not respected by pre-commit --all-files | ||
exclude: __init__.py|.venv|.env|venv|env|__pycache__ | ||
|
||
|
||
# static type checking | ||
- repo: https://github.com/pre-commit/mirrors-mypy | ||
rev: v1.7.0 | ||
hooks: | ||
- id: mypy | ||
additional_dependencies: [types-requests==2.25.9] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# This file contains project information. | ||
# It also contains settings for linters and code checkers isort, black and mypy. | ||
# Note that these settings are not respected with pre-commit run --all-files | ||
# In that case add configurations to the .pre-commit-config.yaml file. | ||
|
||
[project] | ||
name = "serve-load-testing" | ||
version = "1.0.0" | ||
description = "Load testing of the SciLifeLab Serve platform." | ||
requires-python = "=3.8" | ||
keywords = ["load testing", "locust", "python"] | ||
|
||
[tool.isort] | ||
profile = 'black' | ||
|
||
[tool.black] | ||
line-length = 120 | ||
target-version = ['py38'] | ||
include = '\.pyi?$' | ||
extend-exclude = ''' | ||
/( | ||
\.git | ||
| \.mypy_cache | ||
| \.venv | ||
| venv | ||
| migrations | ||
)/ | ||
''' | ||
|
||
[tool.mypy] | ||
strict = false | ||
python_version = "3.8" | ||
ignore_missing_imports = true | ||
warn_return_any = true | ||
exclude = ["venv", ".venv", "examples"] | ||
|
||
[[tool.mypy.overrides]] | ||
module = "*.migrations.*" | ||
ignore_errors = true | ||
|
||
[[tool.mypy.overrides]] | ||
module = [ | ||
"flatten_json.*", | ||
"guardian.*", | ||
"tagulous.*", | ||
"dash.*", | ||
"markdown.*", | ||
"pytz.*", | ||
"requests.*", | ||
"setuptools.*", | ||
"yaml.*", | ||
] | ||
ignore_missing_imports = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
[email protected] | ||
SERVE_PASS=a_pass | ||
PROTECTED_PAGE_RELATIVE_URL=/a/relative/url | ||
SERVE_LOCUST_TEST_USER_PASS=a_pass2 | ||
SERVE_LOCUST_DO_CREATE_OBJECTS=True | ||
PROTECTED_PAGE_RELATIVE_URL=/a/relative/url |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# locust.conf | ||
locustfile = tests | ||
headless = false | ||
#master = true | ||
#expect-workers = 5 | ||
host = https://staging.serve-dev.scilifelab.se | ||
users = 1 | ||
spawn-rate = 1 | ||
run-time = 10s | ||
only-summary = true | ||
csv = stats/locust | ||
loglevel = INFO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
# locust.conf | ||
locustfile = tests | ||
headless = true | ||
#headless = true | ||
#master = true | ||
#expect-workers = 5 | ||
host = https://staging.serve-dev.scilifelab.se | ||
host = https://serve-dev.scilifelab.se | ||
users = 1 | ||
spawn-rate = 1 | ||
run-time = 10s | ||
only-summary = true | ||
csv = stats/locust | ||
#only-summary = true | ||
csv = stats/locust | ||
loglevel = INFO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
locust>=2.20.0 | ||
requests-html>=0.10.0 | ||
requests-html>=0.10.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
set -o errexit | ||
|
||
# Activate the virtual env | ||
source ./.venv/bin/activate | ||
|
||
# Set the env variables from this project | ||
set -o allexport; source .env; set +o allexport | ||
|
||
# Run 2 sets of tests in parallel: the non-locust user apps and the locust test plan | ||
|
||
python3 ./tests-dev/appviewer_requestshtml.py & \ | ||
locust --headless -f ./tests/test_plan_normal.py --users 10 --run-time 60s --html ./reports/locust-report-normal.html |
Oops, something went wrong.