Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confluence use hardcoded cqls #1698

Merged
merged 8 commits into from
Apr 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
198 changes: 158 additions & 40 deletions app/jmeter/confluence.jmx

Large diffs are not rendered by default.

35 changes: 31 additions & 4 deletions app/locustio/confluence/http_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
logger = init_logger(app_type='confluence')
confluence_dataset = confluence_datasets()

TWO_WORDS_CQL = 'confluence agreement'
THREE_WORDS_CQL = 'shoulder trip discussion'


@confluence_measure('locust_login_and_view_dashboard')
def login_and_view_dashboard(locust):
Expand Down Expand Up @@ -402,9 +405,8 @@ def view_blog(locust):
catch_response=True)


def search_cql_and_view_results(locust):
def search_cql_two_words_and_view_results(locust):
raise_if_login_failed(locust)
cql = random.choice(confluence_dataset["cqls"])[0]

@confluence_measure('locust_search_cql:recently_viewed')
def search_recently_viewed():
Expand All @@ -413,11 +415,11 @@ def search_recently_viewed():
'?limit=8',
catch_response=True)

@confluence_measure('locust_search_cql:search_results')
@confluence_measure('locust_search_cql:search_results_2_words')
def search_cql():
# 530 rest/api/search
r = locust.get(f"/rest/api/search"
f"?cql=siteSearch~'{cql}'"
f"?cql=siteSearch~'{TWO_WORDS_CQL}'"
f"&start=0"
f"&limit=20",
catch_response=True)
Expand All @@ -435,6 +437,31 @@ def search_cql():
search_recently_viewed()
search_cql()

def search_cql_three_words(locust):
raise_if_login_failed(locust)

@confluence_measure('locust_search_cql:search_results_3_words')
def search_cql():
# 530 rest/api/search
r = locust.get(f"/rest/api/search"
f"?cql=siteSearch~'{THREE_WORDS_CQL}'"
f"&start=0"
f"&limit=20",
catch_response=True)

if '{"results":[' not in r.content.decode('utf-8'):
logger.locust_info(r.content.decode('utf-8'))
content = r.content.decode('utf-8')
if 'results' not in content:
logger.error(f"Search cql failed: {content}")
assert 'results' in content, "Search cql failed."

# 540 rest/mywork/latest/status/notification/count
locust.get('/rest/mywork/latest/status/notification/count', catch_response=True)

search_cql()



def open_editor_and_create_blog(locust):
params = CreateBlog()
Expand Down
6 changes: 5 additions & 1 deletion app/locustio/confluence/locustfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ def view_blog_action(self):

@task(config.percentage('search_cql'))
def search_cql_action(self):
search_cql_and_view_results(self)
search_cql_two_words_and_view_results(self)

@task(config.percentage('search_cql'))
def search_cql_action(self):
search_cql_three_words(self)

@task(config.percentage('create_blog'))
def create_blog_action(self):
Expand Down
4 changes: 1 addition & 3 deletions app/locustio/confluence/requests_params.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
# flake8: noqa
from locustio.common_utils import read_input_file, BaseResource
from util.project_paths import (CONFLUENCE_PAGES, CONFLUENCE_BLOGS, CONFLUENCE_USERS, CONFLUENCE_STATIC_CONTENT,
CONFLUENCE_CQLS)
from util.project_paths import (CONFLUENCE_PAGES, CONFLUENCE_BLOGS, CONFLUENCE_USERS, CONFLUENCE_STATIC_CONTENT)


def confluence_datasets():
data_sets = dict()
data_sets["pages"] = read_input_file(CONFLUENCE_PAGES)
data_sets["blogs"] = read_input_file(CONFLUENCE_BLOGS)
data_sets["users"] = read_input_file(CONFLUENCE_USERS)
data_sets["cqls"] = read_input_file(CONFLUENCE_CQLS)
data_sets['static-content'] = read_input_file(CONFLUENCE_STATIC_CONTENT)

return data_sets
Expand Down
17 changes: 12 additions & 5 deletions app/selenium_ui/confluence/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
CQLS = "cqls"
CUSTOM_PAGES = "custom_pages"
BLOGS = "blogs"

TWO_WORDS_CQL = 'confluence agreement'
THREE_WORDS_CQL = 'shoulder trip discussion'

def setup_run_data(datasets):
datasets['current_session'] = {}
Expand Down Expand Up @@ -301,16 +302,22 @@ def sub_measure():

measure()

def cql_search_three_words(webdriver):
return cql_search(webdriver, cql_string=THREE_WORDS_CQL, print_timing_suffix='3_words')


def cql_search_two_words(webdriver):
return cql_search(webdriver, cql_string=TWO_WORDS_CQL, print_timing_suffix='2_words')


def cql_search(webdriver, datasets):
random_cql = random.choice(datasets[CQLS])
def cql_search(webdriver, cql_string, print_timing_suffix):
page = Page(webdriver)
page.wait_until_visible(PageLocators.search_box)
PopupManager(webdriver).dismiss_default_popup()

@print_timing("selenium_cql_search")
@print_timing(f"selenium_cql_search_{print_timing_suffix}")
def measure():
page.get_element(PageLocators.search_box).send_keys(random_cql)
page.get_element(PageLocators.search_box).send_keys(cql_string)
page.wait_until_any_ec_presented((PageLocators.empty_search_results, PageLocators.search_results),
timeout=30)
page.get_element(PageLocators.close_search_button).click()
Expand Down
10 changes: 7 additions & 3 deletions app/selenium_ui/confluence_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ def test_1_selenium_view_page(confluence_webdriver, confluence_datasets, conflue
def test_1_selenium_view_page_from_cache(confluence_webdriver, confluence_datasets, confluence_screen_shots):
modules.view_page_from_cache(confluence_webdriver, confluence_datasets)


def test_1_selenium_create_page(confluence_webdriver, confluence_datasets, confluence_screen_shots):
modules.create_confluence_page(confluence_webdriver, confluence_datasets)

Expand All @@ -31,6 +30,10 @@ def test_1_selenium_edit_by_url(confluence_webdriver, confluence_datasets, confl
modules.edit_confluence_page_by_url(confluence_webdriver, confluence_datasets)


def test_1_selenium_cql_search_two_words(confluence_webdriver, confluence_datasets, confluence_screen_shots):
modules.cql_search_two_words(confluence_webdriver)


def test_1_selenium_edit_page_quick_edit(confluence_webdriver, confluence_datasets, confluence_screen_shots):
modules.edit_confluence_page_quick_edit(confluence_webdriver, confluence_datasets)

Expand All @@ -39,8 +42,9 @@ def test_1_selenium_create_inline_comment(confluence_webdriver, confluence_datas
modules.create_inline_comment(confluence_webdriver, confluence_datasets)


def test_1_selenium_cql_search(confluence_webdriver, confluence_datasets, confluence_screen_shots):
modules.cql_search(confluence_webdriver, confluence_datasets)
def test_1_selenium_cql_search_three_words(confluence_webdriver, confluence_datasets, confluence_screen_shots):
modules.cql_search_three_words(confluence_webdriver)



"""
Expand Down
3 changes: 1 addition & 2 deletions app/selenium_ui/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
BITBUCKET_PROJECTS, BITBUCKET_REPOS, BITBUCKET_PRS, CONFLUENCE_BLOGS, CONFLUENCE_PAGES, CONFLUENCE_CUSTOM_PAGES, \
CONFLUENCE_USERS, ENV_TAURUS_ARTIFACT_DIR, JSM_DATASET_REQUESTS, JSM_DATASET_CUSTOMERS, JSM_DATASET_AGENTS, \
JSM_DATASET_SERVICE_DESKS_L, JSM_DATASET_SERVICE_DESKS_M, JSM_DATASET_SERVICE_DESKS_S, JSM_DATASET_CUSTOM_ISSUES, \
JSM_DATASET_INSIGHT_SCHEMAS, JSM_DATASET_INSIGHT_ISSUES, BAMBOO_USERS, BAMBOO_BUILD_PLANS, CONFLUENCE_CQLS
JSM_DATASET_INSIGHT_SCHEMAS, JSM_DATASET_INSIGHT_ISSUES, BAMBOO_USERS, BAMBOO_BUILD_PLANS

SCREEN_WIDTH = 1920
SCREEN_HEIGHT = 1080
Expand Down Expand Up @@ -87,7 +87,6 @@ def confluence_dataset(self):
self.dataset["pages"] = self.__read_input_file(CONFLUENCE_PAGES)
self.dataset["blogs"] = self.__read_input_file(CONFLUENCE_BLOGS)
self.dataset["users"] = self.__read_input_file(CONFLUENCE_USERS)
self.dataset["cqls"] = self.__read_input_file(CONFLUENCE_CQLS)
self.dataset["custom_pages"] = self.__read_input_file(
CONFLUENCE_CUSTOM_PAGES)
return self.dataset
Expand Down
6 changes: 1 addition & 5 deletions app/util/data_preparation/confluence_prepare_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from util.api.confluence_clients import ConfluenceRpcClient, ConfluenceRestClient
from util.common_util import print_timing
from util.conf import CONFLUENCE_SETTINGS
from util.project_paths import (CONFLUENCE_USERS, CONFLUENCE_PAGES, CONFLUENCE_BLOGS, CONFLUENCE_CQLS,
from util.project_paths import (CONFLUENCE_USERS, CONFLUENCE_PAGES, CONFLUENCE_BLOGS,
CONFLUENCE_CUSTOM_PAGES, CONFLUENCE_WORDS)

__warnings_filter()
Expand Down Expand Up @@ -76,8 +76,6 @@ def __create_data_set(rest_client, rpc_client):
dataset[PAGES] = async_pages.get()
dataset[BLOGS] = async_blogs.get()

dataset[CQLS] = __generate_cqls(words_count=CQL_WORDS_COUNT)

dataset[CUSTOM_PAGES] = __get_custom_pages(perf_user_api, 5000, CONFLUENCE_SETTINGS.custom_dataset_query)
print(f'Users count: {len(dataset[USERS])}')
print(f'Pages count: {len(dataset[PAGES])}')
Expand Down Expand Up @@ -211,8 +209,6 @@ def write_test_data_to_files(dataset):
users = [f"{user['user']['username']},{DEFAULT_USER_PASSWORD}" for user in dataset[USERS]]
__write_to_file(CONFLUENCE_USERS, users)

__write_to_file(CONFLUENCE_CQLS, dataset[CQLS])

custom_pages = [f"{page['id']},{page['space']['key']}" for page in dataset[CUSTOM_PAGES]]
__write_to_file(CONFLUENCE_CUSTOM_PAGES, custom_pages)

Expand Down
9 changes: 6 additions & 3 deletions app/util/default_test_actions.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,17 @@
"selenium_create_comment",
"selenium_create_comment:write_comment",
"selenium_create_comment:save_comment",
"selenium_cql_search",
"selenium_cql_search_two_words",
"selenium_cql_search_three_words",
"selenium_log_out"
],
"jmeter": [
"jmeter_login_and_view_dashboard",
"jmeter_view_page:open_page",
"jmeter_view_blog",
"jmeter_search_cql:recently_viewed",
"jmeter_search_cql:search_results",
"jmeter_search_cql:search_results_2_words",
"jmeter_search_cql:search_results_3_words",
"jmeter_view_dashboard",
"jmeter_create_and_edit_page:create_page_editor",
"jmeter_create_and_edit_page:create_page",
Expand All @@ -116,7 +118,8 @@
"locust_view_dashboard",
"locust_view_blog",
"locust_search_cql:recently_viewed",
"locust_search_cql:search_results",
"locust_search_cql:search_results_3_words",
"locust_search_cql:search_results_2_words",
"locust_comment_page",
"locust_create_and_edit_page:create_page_editor",
"locust_create_and_edit_page:create_page",
Expand Down
1 change: 0 additions & 1 deletion app/util/project_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ def __get_default_test_actions():
CONFLUENCE_USERS = __get_confluence_dataset('users.csv')
CONFLUENCE_PAGES = __get_confluence_dataset('pages.csv')
CONFLUENCE_BLOGS = __get_confluence_dataset('blogs.csv')
CONFLUENCE_CQLS = __get_confluence_dataset('cqls.csv')
CONFLUENCE_STATIC_CONTENT = __get_confluence_dataset('static-content/files_upload.csv')
CONFLUENCE_CUSTOM_PAGES = __get_confluence_dataset('custom_pages.csv')
CONFLUENCE_WORDS = __get_confluence_dataset('static-content/words.csv')
Expand Down