How to use the locustio.common_utils.init_logger function in locustio

To help you get started, we’ve selected a few locustio examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github atlassian / dc-app-performance-toolkit / app / extension / jira / extension_locust.py View on Github external
import re
from locustio.common_utils import init_logger, jira_measure

logger = init_logger(app_type='jira')


@jira_measure
def app_specific_action(locust):
    r = locust.client.get('/plugin/report')  # navigate to page

    content = r.content.decode('utf-8')  # parse page content
    token_pattern_example = '"token":"(.+?)"'
    id_pattern_example = '"id":"(.+?)"'
    token = re.findall(token_pattern_example, content)  # parse variables from response using regexp
    id = re.findall(id_pattern_example, content)
    logger.locust_info(f'token: {token}, id: {id}')  # logger for debug when verbose is true in jira.yml file
    if 'assertion string' not in content:
        logger.error(f"'assertion string' was not found in {content}")
    assert 'assertion string' in content  # assertion after GET request
github atlassian / dc-app-performance-toolkit / app / locustio / confluence / http_actions.py View on Github external
import random
import re
import uuid

from locustio.common_utils import confluence_measure, fetch_by_re, timestamp_int,\
    TEXT_HEADERS, NO_TOKEN_HEADERS, JSON_HEADERS, generate_random_string, init_logger
from locustio.confluence.requests_params import confluence_datasets, Login, ViewPage, ViewDashboard, ViewBlog, \
    CreateBlog, CreateEditPage, UploadAttachments, LikePage
from util.conf import CONFLUENCE_SETTINGS

logger = init_logger(app_type='confluence')
confluence_dataset = confluence_datasets()


@confluence_measure
def login_and_view_dashboard(locust):
    params = Login()

    user = random.choice(confluence_dataset["users"])
    username = user[0]
    password = user[1]

    login_body = params.login_body
    login_body['os_username'] = username
    login_body['os_password'] = password
    locust.client.post('/dologin.action', login_body, TEXT_HEADERS, catch_response=True)
    r = locust.client.get('/', catch_response=True)
github atlassian / dc-app-performance-toolkit / app / locustio / jira / http_actions.py View on Github external
import random
import re
from locust.exception import ResponseError
from locustio.jira.requests_params import Login, BrowseIssue, CreateIssue, SearchJql, ViewBoard, BrowseBoards, \
    BrowseProjects, AddComment, ViewDashboard, EditIssue, ViewProjectSummary, jira_datasets
from locustio.common_utils import jira_measure, fetch_by_re, timestamp_int, generate_random_string, TEXT_HEADERS, \
    ADMIN_HEADERS, NO_TOKEN_HEADERS, init_logger

from util.conf import JIRA_SETTINGS

logger = init_logger(app_type='jira')
jira_dataset = jira_datasets()


@jira_measure
def login_and_view_dashboard(locust):
    params = Login()

    user = random.choice(jira_dataset["users"])
    body = params.login_body
    body['os_username'] = user[0]
    body['os_password'] = user[1]

    locust.client.post('/login.jsp', body, TEXT_HEADERS, catch_response=True)
    r = locust.client.get('/', catch_response=True)
    if not r.content:
        raise Exception('Please check server hostname in jira.yml file')
github atlassian / dc-app-performance-toolkit / app / extension / confluence / extension_locust.py View on Github external
import re
from locustio.common_utils import init_logger, confluence_measure

logger = init_logger(app_type='confluence')


@confluence_measure
def app_specific_action(locust):

    r = locust.client.get('/plugin/report')  # navigate to page

    content = r.content.decode('utf-8')  # parse page content
    token_pattern_example = '"token":"(.+?)"'
    id_pattern_example = '"id":"(.+?)"'
    token = re.findall(token_pattern_example, content)  # parse variables from response using regexp
    id = re.findall(id_pattern_example, content)
    logger.locust_info(f'token: {token}, id: {id}')  # logger for debug when verbose is true in confluence.yml file
    if 'assertion string' not in content:
        logger.error(f"'assertion string' was not found in {content}")
    assert 'assertion string' in content  # assertion after GET request