Skip to content

Commit a310c6d

Browse files
authored
Merge pull request #269 from atlassian/release/3.0.1
Release 3.0.1
2 parents a6789ce + e0c6cd4 commit a310c6d

14 files changed

+75
-721
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ This repository contains Taurus scripts for performance testing of Atlassian Dat
55

66
## Supported versions
77
* Supported Jira versions:
8-
* Jira [Enterprise Releases](https://confluence.atlassian.com/enterprise/atlassian-enterprise-releases-948227420.html): 7.13.6 and 8.5.0
9-
* Jira Platform Release: 8.0.3
8+
* Jira [Long Term Support release](https://confluence.atlassian.com/enterprise/atlassian-enterprise-releases-948227420.html): 7.13.6 and 8.5.0
9+
* Jira Platform release: 8.0.3
1010

1111
* Supported Confluence versions:
12-
* Confluence [Enterprise Release](https://confluence.atlassian.com/enterprise/atlassian-enterprise-releases-948227420.html): 6.13.8
13-
* Confluence Platform Release: 7.0.4
12+
* Confluence [Long Term Support release](https://confluence.atlassian.com/enterprise/atlassian-enterprise-releases-948227420.html): 6.13.8
13+
* Confluence Platform release: 7.0.4
1414

1515
* Supported Bitbucket Server versions:
16-
* Bitbucket Server [Enterprise Release](https://confluence.atlassian.com/enterprise/atlassian-enterprise-releases-948227420.html): 6.10.0
17-
* Bitbucket Server Platform Release: 7.0.0
16+
* Bitbucket Server [Long Term Support release](https://confluence.atlassian.com/enterprise/atlassian-enterprise-releases-948227420.html): 6.10.0
17+
* Bitbucket Server Platform release: 7.0.0
1818

1919
## Support
2020
In case of technical questions, issues or problems with DC Apps Performance Toolkit, contact us for support in the [community Slack](http://bit.ly/dcapt_slack) **#data-center-app-performance-toolkit** channel.

app/jmeter/jira.jmx

Lines changed: 2 additions & 655 deletions
Large diffs are not rendered by default.

app/selenium_ui/jira/pages/selectors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ class SearchLocators:
133133

134134
search_issue_table = (By.ID, "issuetable")
135135
search_issue_content = (By.ID, "issue-content")
136-
search_no_issue_found = (By.ID, "issue-content")
136+
search_no_issue_found = (By.CLASS_NAME, "no-results-message")
137137

138138

139139
class BoardsListLocators:

app/util/analytics/application_info.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,7 @@ def version(self):
3232

3333
@property
3434
def nodes_count(self):
35-
html_pattern = '<td><strong>Nodestate:</strong></td><td>Active</td>'
36-
if self.version >= '8.1.0':
37-
return len(self.client.get_nodes_info_via_rest())
38-
else:
39-
jira_system_page = self.client.get_system_info_page()
40-
node_count = jira_system_page.replace(' ', '').replace('\n', '').count(html_pattern)
41-
return node_count
35+
return self.client.get_cluster_nodes_count(jira_version=self.version)
4236

4337
def __issues_count(self):
4438
return self.client.get_total_issues_count()
@@ -57,7 +51,7 @@ def version(self):
5751

5852
@property
5953
def nodes_count(self):
60-
return len(self.client.get_confluence_nodes_count())
54+
return self.client.get_confluence_nodes_count()
6155

6256
@property
6357
def dataset_information(self):

app/util/api/abstract_clients.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ def session(self):
5757
def base_auth(self):
5858
return self.user, self.password
5959

60-
def get(self, url: str, error_msg: str):
60+
def get(self, url: str, error_msg: str, expected_status_codes: list = None):
6161
response = self.session.get(url, auth=self.base_auth, verify=False, timeout=self.requests_timeout)
62-
self.__verify_response(response, error_msg)
62+
self.__verify_response(response, error_msg, expected_status_codes)
6363
return response
6464

6565
def post(self, url: str, error_msg: str, body: dict = None, params=None):
@@ -76,8 +76,8 @@ def put(self, url: str, error_msg: str, body: dict = None, params=None):
7676
self.__verify_response(response, error_msg)
7777
return response
7878

79-
def __verify_response(self, response: Response, error_msg: str):
80-
if response.ok:
79+
def __verify_response(self, response: Response, error_msg: str, expected_status_codes: list = None):
80+
if response.ok or response.status_code in expected_status_codes:
8181
return
8282

8383
status_code = response.status_code

app/util/api/bitbucket_clients.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from enum import Enum
33

44
from util.api.abstract_clients import RestClient
5-
import lxml.html as LH
5+
from lxml import html
66

77
BATCH_SIZE_PROJECTS = 100
88
BATCH_SIZE_USERS = 100
@@ -151,9 +151,11 @@ def get_bitbucket_system_page(self):
151151
return r.content.decode('utf-8')
152152

153153
def get_locale(self):
154-
page = LH.parse(self.host)
154+
language = None
155+
page = self.get(self.host, "Could not get page content.").content
156+
tree = html.fromstring(page)
155157
try:
156-
language = page.xpath('//html/@lang')[0]
157-
except Exception:
158-
raise Exception('Could not get user locale')
158+
language = tree.xpath('//html/@lang')[0]
159+
except Exception as error:
160+
print(f"Warning: Could not get user locale: {error}")
159161
return language

app/util/api/confluence_clients.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import xmlrpc.client
22

33
from util.api.abstract_clients import RestClient, Client
4-
import xml.etree.ElementTree as ET
5-
import lxml.html as LH
4+
from lxml import html
65

76
BATCH_SIZE_SEARCH = 500
87

@@ -89,7 +88,7 @@ def get_confluence_version(self):
8988
version = ''
9089
api_url = f'{self.host}/rest/applinks/1.0/manifest'
9190
response = self.get(api_url, 'Could not get Confluence manifest')
92-
tree = ET.fromstring(response.content)
91+
tree = html.fromstring(response.content)
9392
for child in tree:
9493
if child.tag == 'version':
9594
version = child.text
@@ -132,8 +131,10 @@ def is_remote_api_enabled(self):
132131

133132
def get_confluence_nodes_count(self):
134133
api_url = f"{self.host}/rest/atlassian-cluster-monitoring/cluster/nodes"
135-
response = self.get(api_url, error_msg='Could not get Confluence nodes count via API')
136-
return response.json()
134+
response = self.get(api_url, error_msg='Could not get Confluence nodes count via API',
135+
expected_status_codes=[200, 500])
136+
return 'Server' if response.status_code == 500 and 'NonClusterMonitoring' in response.text\
137+
else len(response.json())
137138

138139
def get_total_pages_count(self):
139140
api_url = f"{self.host}/rest/api/search?cql=type=page"
@@ -146,11 +147,13 @@ def get_collaborative_editing_status(self):
146147
return response.json()
147148

148149
def get_locale(self):
149-
page = LH.parse(self.host)
150+
language = None
151+
page = self.get(self.host, "Could not get page content.").content
152+
tree = html.fromstring(page)
150153
try:
151-
language = page.xpath('.//meta[@name="ajs-user-locale"]/@content')[0]
152-
except Exception:
153-
raise Exception('Could not get user locale')
154+
language = tree.xpath('.//meta[@name="ajs-user-locale"]/@content')[0]
155+
except Exception as error:
156+
print(f"Warning: Could not get user locale: {error}")
154157
return language
155158

156159

app/util/api/jira_clients.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,13 @@ def get_server_info(self):
158158

159159
return response.json()
160160

161-
def get_nodes_info_via_rest(self):
161+
def get_nodes_count_via_rest(self):
162162
# Works for Jira version >= 8.1.0
163163
api_url = f'{self.host}/rest/api/2/cluster/nodes'
164-
response = self.get(api_url, 'Could not get Jira nodes count')
165-
166-
return response.json()
164+
response = self.get(api_url, 'Could not get Jira nodes count', expected_status_codes=[200, 405])
165+
if response.status_code == 405 and 'This Jira instance is not clustered' in response.text:
166+
return 'Server'
167+
return len(response.json())
167168

168169
def get_system_info_page(self):
169170
session = self._session
@@ -187,10 +188,19 @@ def get_system_info_page(self):
187188
session.post(url=login_url, data=login_body, headers=headers)
188189
auth_request = session.post(url=auth_url, data=auth_body, headers=headers)
189190
system_info_html = auth_request.content.decode("utf-8")
190-
if 'Cluster nodes' not in system_info_html:
191-
print('Could not get Jira nodes count via parse html page')
192191
return system_info_html
193192

193+
def get_cluster_nodes_count(self, jira_version):
194+
html_pattern = '<td><strong>Nodestate:</strong></td><td>Active</td>'
195+
if jira_version >= '8.1.0':
196+
return self.get_nodes_count_via_rest()
197+
else:
198+
jira_system_page = self.get_system_info_page()
199+
nodes_count = jira_system_page.replace(' ', '').replace('\n', '').count(html_pattern)
200+
if nodes_count == 0:
201+
return 'Server'
202+
return nodes_count
203+
194204
def get_locale(self):
195205
api_url = f'{self.host}/rest/api/2/myself'
196206
user_properties = self.get(api_url, "Could not retrieve user")

app/util/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from util.project_paths import JIRA_YML, CONFLUENCE_YML, BITBUCKET_YML
44

5-
TOOLKIT_VERSION = '3.0.0'
5+
TOOLKIT_VERSION = '3.0.1'
66

77

88
def read_yml_file(file):

app/util/data_preparation/bitbucket_prepare_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def write_test_data_to_files(datasets):
123123

124124
def __check_current_language(bitbucket_api):
125125
language = bitbucket_api.get_locale()
126-
if language != ENGLISH:
126+
if language and language != ENGLISH:
127127
raise SystemExit(f'"{language}" language is not supported. '
128128
f'Please change your account language to "English (United States)"')
129129

0 commit comments

Comments
 (0)