-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Updates for latest version of locust * fix this to stop warning * fix test * update version * update Pipfile.lock * run black * run tests in github action * add this * updates for pypi, copy pipenv ci config from another project * pip install pipenv * fix tests * fix region error * add basic test to run load test * run black
- Loading branch information
1 parent
4e2d97f
commit e992ede
Showing
17 changed files
with
612 additions
and
422 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
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,39 @@ | ||
on: [pull_request] | ||
name: Test | ||
jobs: | ||
build: | ||
name: ${{matrix.os}} / ${{ matrix.python-version }} | ||
runs-on: ${{ matrix.os }}-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: [3.7] | ||
os: [MacOS, Ubuntu] | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install latest pip, setuptools, wheel | ||
run: | | ||
python -m pip install --upgrade pip setuptools wheel --upgrade-strategy=eager | ||
pip install pipenv | ||
- name: Install dependencies | ||
env: | ||
PIPENV_DEFAULT_PYTHON_VERSION: ${{ matrix.python-version }} | ||
PYTHONWARNINGS: ignore:DEPRECATION | ||
PYTHONIOENCODING: 'utf-8' | ||
GIT_ASK_YESNO: 'false' | ||
run: | | ||
pipenv install --deploy --dev | ||
- name: Run tests | ||
env: | ||
PIPENV_DEFAULT_PYTHON_VERSION: ${{ matrix.python-version }} | ||
PYTHONWARNINGS: ignore:DEPRECATION | ||
GIT_ASK_YESNO: 'false' | ||
AWS_DEFAULT_REGION: eu-west-1 | ||
run: | | ||
pipenv run pytest |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
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,3 @@ | ||
[build-system] | ||
requires = ["setuptools", "wheel"] | ||
build-backend = "setuptools.build_meta:__legacy__" |
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 |
---|---|---|
|
@@ -5,18 +5,21 @@ | |
|
||
setup( | ||
name="invokust", | ||
version="1.0a", | ||
version="0.74", | ||
author="Max Williams", | ||
author_email="[email protected]", | ||
description="A small wrapper for locust to allow running load tests from within Python or on AWS Lambda", | ||
long_description=long_description, | ||
long_description_content_type="text/markdown", | ||
url="https://github.com/FutureSharks/invokust", | ||
download_url="https://github.com/FutureSharks/invokust/archive/1.0a.tar.gz", | ||
download_url="https://github.com/FutureSharks/invokust/archive/0.74.tar.gz", | ||
license="MIT", | ||
scripts=["invokr.py"], | ||
packages=["invokust", "invokust.aws_lambda",], | ||
install_requires=["locust>=1.0.3", "boto3", "pyzmq", "numpy"], | ||
packages=[ | ||
"invokust", | ||
"invokust.aws_lambda", | ||
], | ||
install_requires=["locust>=1.4.1", "boto3", "pyzmq", "numpy"], | ||
keywords=["testing", "loadtest", "lambda", "locust"], | ||
classifiers=[ | ||
"Topic :: Software Development :: Quality Assurance", | ||
|
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,35 @@ | ||
import os | ||
from unittest import TestCase | ||
from invokust.settings import create_settings | ||
from invokust import LocustLoadTest | ||
from locust import HttpUser, between, task | ||
|
||
|
||
class WebsiteUser(HttpUser): | ||
wait_time = between(1, 3) | ||
|
||
@task() | ||
def get_home_page(self): | ||
""" | ||
Gets / | ||
""" | ||
self.client.get("/") | ||
|
||
|
||
class TestLocustLoadTest(TestCase): | ||
def test_basic_load_test(self): | ||
settings = create_settings( | ||
classes=[WebsiteUser], | ||
host="https://github.com", | ||
num_users=1, | ||
spawn_rate=1, | ||
run_time="1m", | ||
) | ||
|
||
loadtest = LocustLoadTest(settings) | ||
loadtest.run() | ||
stats = loadtest.stats() | ||
|
||
assert stats["num_requests"] > 10 | ||
assert stats["end_time"] > stats["start_time"] | ||
assert stats["requests"]["GET_/"]["total_rpm"] > 0 |
Oops, something went wrong.