-
Notifications
You must be signed in to change notification settings - Fork 464
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #796 from atlassian/release/6.1.0
Release 6.1.0
- Loading branch information
Showing
50 changed files
with
918 additions
and
531 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
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,29 @@ | ||
import re | ||
from locustio.common_utils import init_logger, bamboo_measure, run_as_specific_user # noqa F401 | ||
|
||
logger = init_logger(app_type='bamboo') | ||
|
||
|
||
@bamboo_measure("locust_app_specific_action") | ||
# @run_as_specific_user(username='admin', password='admin') # run as specific user | ||
def app_specific_action(locust): | ||
r = locust.get('/app/get_endpoint', catch_response=True) # call app-specific GET endpoint | ||
content = r.content.decode('utf-8') # decode response content | ||
|
||
token_pattern_example = '"token":"(.+?)"' | ||
id_pattern_example = '"id":"(.+?)"' | ||
token = re.findall(token_pattern_example, content) # get TOKEN from response using regexp | ||
id = re.findall(id_pattern_example, content) # get ID from response using regexp | ||
|
||
logger.locust_info(f'token: {token}, id: {id}') # log info for debug when verbose is true in bamboo.yml file | ||
if 'assertion string' not in content: | ||
logger.error(f"'assertion string' was not found in {content}") | ||
assert 'assertion string' in content # assert specific string in response content | ||
|
||
body = {"id": id, "token": token} # include parsed variables to POST request body | ||
headers = {'content-type': 'application/json'} | ||
r = locust.post('/app/post_endpoint', body, headers, catch_response=True) # call app-specific POST endpoint | ||
content = r.content.decode('utf-8') | ||
if 'assertion string after successful POST request' not in content: | ||
logger.error(f"'assertion string after successful POST request' was not found in {content}") | ||
assert 'assertion string after successful POST request' in content # assertion after POST request |
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,24 @@ | ||
from locust import HttpUser, task, between | ||
from extension.bamboo.extension_locust import app_specific_action | ||
from locustio.bamboo.http_actions import locust_bamboo_login | ||
from locustio.common_utils import LocustConfig, MyBaseTaskSet | ||
from util.conf import BAMBOO_SETTINGS | ||
|
||
config = LocustConfig(config_yml=BAMBOO_SETTINGS) | ||
|
||
|
||
class BambooBehavior(MyBaseTaskSet): | ||
|
||
def on_start(self): | ||
self.client.verify = config.secure | ||
locust_bamboo_login(self) | ||
|
||
@task(config.percentage('standalone_extension_locust')) | ||
def custom_action(self): | ||
app_specific_action(self) | ||
|
||
|
||
class BambooUser(HttpUser): | ||
host = BAMBOO_SETTINGS.server_url | ||
tasks = [BambooBehavior] | ||
wait_time = between(0, 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
Oops, something went wrong.