Skip to content

Commit e968fc4

Browse files
authored
integrate_ui_automation_to_rta (#124)
Add UI tests
1 parent 31c3b53 commit e968fc4

File tree

83 files changed

+315754
-1391
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+315754
-1391
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
## Linux
2121

2222
- **debian** / **ubuntu**:
23-
`apt-get install python3-yaml python3-requests python3-click python3-distro python3-psutil python3-pexpect python3-pyftpdlib python3-statsd python3-selenium python3-markdown python3-pip gdb`
23+
`apt-get install python3-yaml python3-requests python3-click python3-distro python3-psutil python3-pexpect python3-pyftpdlib python3-statsd python3-selenium python3-pip gdb`
2424

2525
the `python3-semver` on debian is to old - need to use the pip version instead:
26-
`pip3 install semver beautifultable allure_python_commons certifi`
26+
`pip3 install semver beautifultable allure_python_commons certifi tabulate`
2727

2828
Ubuntu 16.40 pip3 system package is broken. Fix like this:
2929
`dpkg -r python3-pip python3-pexpect`
@@ -41,7 +41,7 @@
4141
## Mac OS
4242
:
4343
`brew install gnu-tar`
44-
`pip3 install click psutil requests pyyaml semver pexpect selenium beautifultable markdown allure_python_commons certifi`
44+
`pip3 install click psutil requests pyyaml semver pexpect selenium beautifultable tabulate allure_python_commons certifi`
4545
`brew install gdb`
4646
if `python --version` is below 3.9 you also have to download ftplib:
4747
`pip3 install click ftplib`

attic_snippets/download_selenium_browser_drivers.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"""
2424

2525

26-
class BaseSelenium:
26+
class BasePage:
2727
browser_name = None
2828
driver: WebDriver
2929

@@ -78,9 +78,9 @@ def tear_down(cls):
7878
cls.driver.quit()
7979

8080
# if __name__ == "__main__":
81-
# selenium = BaseSelenium()
81+
# selenium = BasePage()
8282
# selenium.set_up_class()
8383
# selenium.tear_down()
8484

85-
BaseSelenium.set_up_class()
86-
BaseSelenium.tear_down()
85+
BasePage.set_up_class()
86+
BasePage.tear_down()

containers/docker_deb/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ RUN if [ -z "$CHROME_DRIVER_VERSION" ]; \
5353
&& sudo ln -fs /opt/selenium/chromedriver-$CHROME_DRIVER_VERSION /usr/bin/chromedriver
5454

5555

56-
RUN pip3 install semver selenium beautifultable allure_python_commons mss
56+
RUN pip3 install semver selenium beautifultable allure_python_commons mss tabulate
5757

5858
run mkdir -p /home/release-test-automation \
5959
/home/package_cache \

containers/docker_rpm/Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ run mkdir -p /home/release-test-automation \
1717
/home/entrypoint
1818
RUN mkdir -p /home/entrypoint
1919

20-
RUN yum -y update; yum install -y python3 python3-pyyaml python36-PyYAML python3-requests python3-click gcc platform-python-devel python3-distro python3-devel python36-distro python36-click python36-pexpect python3-pexpect python3-pyftpdlib python3-markdown initscripts file gdb chromedriver chromium;
21-
RUN pip3 install selenium psutil semver click requests pyyaml distro pexpect beautifultable allure_python_commons markdown certifi mss
20+
RUN yum -y update; yum install -y python3 python3-pyyaml python36-PyYAML python3-requests python3-click gcc platform-python-devel python3-distro python3-devel python36-distro python36-click python36-pexpect python3-pexpect python3-pyftpdlib initscripts file gdb chromedriver chromium python3-markdown;
21+
RUN pip3 install selenium psutil semver click requests pyyaml distro pexpect beautifultable allure_python_commons tabulate certifi mss
2222

2323
RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in ; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \
2424
rm -rf /lib/systemd/system/multi-user.target.wants/;\

containers/docker_tar/Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ENV TZ=Europe/Berlin
55
ARG CHROME_VERSION="google-chrome-stable"
66
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
77
RUN apt-get update ; \
8-
apt-get install -y wget unzip python3-yaml python3-requests python3-click python3-distro python3-psutil python3-pexpect python3-pyftpdlib python3-statsd python3-pip python3-markdown python-certifi gdb git python3-selenium fuse snapd snap-confine squashfuse sudo; \
8+
apt-get install -y wget unzip python3-yaml python3-requests python3-click python3-distro python3-psutil python3-pexpect python3-pyftpdlib python3-statsd python3-pip python-certifi gdb git python3-selenium fuse snapd snap-confine squashfuse sudo python3-markdown; \
99
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
1010
&& echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list \
1111
&& apt-get update -qqy \
@@ -48,7 +48,7 @@ RUN if [ -z "$CHROME_DRIVER_VERSION" ]; \
4848
#VOLUME ["/sys/fs/cgroup"]
4949
# STOPSIGNAL SIGRTMIN+3
5050

51-
RUN pip3 install semver beautifultable allure_python_commons mss
51+
RUN pip3 install semver beautifultable allure_python_commons mss tabulate
5252
RUN mkdir -p /home/entrypoint /home/release-test-automation /home/package_cache /home/versions /home/test_dir
5353
# ADD tarball_nightly_test.py /home/entrypoint/tarball_nightly_test.py
5454
# ENTRYPOINT ["/home/entrypoint/tarball_nightly_test.py"]

containers/this_version.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.1
1+
1.2

deployment/requirements.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ semver
33
distro
44
pexpect
55
allure_python_commons
6-
markdown
7-
certifi
6+
tabulate
7+
certifi
8+
markdown

release_tester/arangodb/async_client.py

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ def convert_result(result_array):
5050

5151
class CliExecutionException(Exception):
5252
"""transport CLI error texts"""
53+
5354
def __init__(self, message, execution_result):
5455
self.execution_result = execution_result
5556
self.message = message

release_tester/arangodb/imp.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77

88
def get_type_args(filename):
99
"""guess the format by the filename"""
10-
if filename.endswith("jsonl"):
10+
if str(filename).endswith("jsonl"):
1111
return ["--type=jsonl"]
12-
if filename.endswith("json"):
12+
if str(filename).endswith("json"):
1313
return ["--type=json"]
14-
if filename.endswith("csv"):
14+
if str(filename).endswith("csv"):
1515
return ["--type=csv"]
1616
raise NotImplementedError("no filename type encoding implemented for " + filename)
1717

@@ -57,7 +57,7 @@ def import_collection(self, collection_name, filename, more_args=[]):
5757
def import_smart_edge_collection(self, collection_name, filename, edge_relations, more_args=[]):
5858
"""import into smart edge collection"""
5959
if len(edge_relations) == 1:
60-
edge_relations[1] = edge_relations[0]
60+
edge_relations.append(edge_relations[0])
6161
# fmt: off
6262
args = [
6363
'--from-collection-prefix', edge_relations[0],

release_tester/arangodb/installers/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ def calc_config_file_name(self):
264264
if "WORKSPACE_TMP" in os.environ:
265265
wdtmp = Path(os.environ["WORKSPACE_TMP"])
266266
wdtmp.mkdir(parents=True, exist_ok=True)
267-
cfg_file = wdtmp / "config.yml"
267+
cfg_file = wdtmp / "config.yml"
268268
else:
269269
cfg_file = Path("c:/") / "tmp/" / "config.yml"
270270
else:

release_tester/arangodb/instance.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ def get_local_url(self, login):
395395
port=self.port,
396396
)
397397

398-
def get_public_url(self, login):
398+
def get_public_url(self, login=""):
399399
"""our public url"""
400400
return "{protocol}://{login}{host}:{port}".format(
401401
protocol=self.get_http_protocol(),

release_tester/arangodb/starter/deployments/__init__.py

+5
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ def make_runner(
6363
for one_installer_set in installer_set:
6464
assert len(one_installer_set) == 2, "no complete object config?"
6565

66+
# Configure Chrome to accept self-signed SSL certs and certs signed by unknown CA.
67+
# FIXME: Add custom CA to Chrome to properly validate server cert.
68+
if ssl:
69+
selenium_driver_args += ("ignore-certificate-errors",)
70+
6671
logging.debug("Factory for Runner of type: {0}".format(str(runner_type)))
6772
args = (
6873
runner_type,

release_tester/arangodb/starter/deployments/activefailover.py

+24-19
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ def starter_run_impl(self):
157157
def finish_setup_impl(self):
158158
logging.info("instances are ready, detecting leader")
159159
self._detect_leader()
160+
if self.selenium:
161+
self.set_selenium_instances()
160162

161163
# add data to leader
162164
self.makedata_instances.append(self.leader)
@@ -206,6 +208,9 @@ def test_setup_impl(self):
206208
)
207209
if not ret[0]:
208210
raise Exception("check data failed " + ret[1])
211+
if self.selenium:
212+
self.set_selenium_instances()
213+
self.selenium.test_setup()
209214

210215
def wait_for_restore_impl(self, backup_starter):
211216
backup_starter.wait_for_restore()
@@ -244,8 +249,7 @@ def upgrade_arangod_version_impl(self):
244249
node.detect_instance_pids()
245250
self.print_all_instances_table()
246251
if self.selenium:
247-
self.selenium.web.refresh() # version doesn't upgrade if we don't do this...
248-
self.selenium.check_old(self.new_cfg, expect_follower_count=2, retry_count=10)
252+
self.selenium.test_wait_for_upgrade()
249253

250254
def upgrade_arangod_version_manual_impl(self):
251255
"""manual upgrade this installation"""
@@ -264,12 +268,7 @@ def upgrade_arangod_version_manual_impl(self):
264268
[
265269
InstanceType.RESILIENT_SINGLE,
266270
],
267-
[
268-
"--database.auto-upgrade",
269-
"true",
270-
"--javascript.copy-installation",
271-
"true",
272-
],
271+
["--database.auto-upgrade", "true", "--javascript.copy-installation", "true"],
273272
)
274273
self.progress(True, "step 3 - launch instances again")
275274
for node in self.starter_instances:
@@ -282,8 +281,7 @@ def upgrade_arangod_version_manual_impl(self):
282281
self.leader.maintainance(False, InstanceType.RESILIENT_SINGLE)
283282
self.print_all_instances_table()
284283
if self.selenium:
285-
self.selenium.web.refresh() # version doesn't upgrade if we don't do this...
286-
self.selenium.check_old(self.new_cfg, expect_follower_count=2, retry_count=10)
284+
self.selenium.test_wait_for_upgrade()
287285

288286
def jam_attempt_impl(self):
289287
# pylint: disable=R0915
@@ -332,13 +330,9 @@ def jam_attempt_impl(self):
332330
self.set_frontend_instances()
333331

334332
if self.selenium:
335-
self.selenium.connect_server(
336-
self.leader.get_frontends(),
337-
"_system",
338-
self.new_cfg if self.new_cfg else self.cfg,
339-
)
340-
cfg = self.new_cfg if self.new_cfg else self.cfg
341-
self.selenium.check_old(cfg=cfg, expect_follower_count=1, retry_count=10)
333+
# cfg = self.new_cfg if self.new_cfg else self.cfg
334+
self.set_selenium_instances()
335+
self.selenium.test_jam_attempt()
342336

343337
prompt_user(
344338
self.basecfg,
@@ -370,8 +364,9 @@ def jam_attempt_impl(self):
370364

371365
logging.info("state of this test is: %s", "Success" if self.success else "Failed")
372366
if self.selenium:
373-
cfg = self.new_cfg if self.new_cfg else self.cfg
374-
self.selenium.check_old(cfg=cfg, expect_follower_count=2, retry_count=10)
367+
# cfg = self.new_cfg if self.new_cfg else self.cfg
368+
self.set_selenium_instances()
369+
self.selenium.test_wait_for_upgrade()
375370

376371
def shutdown_impl(self):
377372
for node in self.starter_instances:
@@ -387,3 +382,13 @@ def before_backup_impl(self):
387382

388383
def after_backup_impl(self):
389384
pass
385+
386+
def set_selenium_instances(self):
387+
"""set instances in selenium runner"""
388+
self.selenium.set_instances(
389+
self.cfg,
390+
self.leader.arango_importer,
391+
self.leader.arango_restore,
392+
[x for x in self.leader.all_instances if x.instance_type == InstanceType.RESILIENT_SINGLE][0],
393+
self.new_cfg,
394+
)

release_tester/arangodb/starter/deployments/cluster.py

+18-5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
arangoversions = {
1818
"370": semver.VersionInfo.parse("3.7.0"),
1919
}
20+
21+
2022
class Cluster(Runner):
2123
"""this launches a cluster setup"""
2224

@@ -158,7 +160,8 @@ def finish_setup_impl(self):
158160
self.set_frontend_instances()
159161

160162
def test_setup_impl(self):
161-
pass
163+
if self.selenium:
164+
self.selenium.test_setup()
162165

163166
def wait_for_restore_impl(self, backup_starter):
164167
for starter in self.starter_instances:
@@ -180,7 +183,7 @@ def upgrade_arangod_version_impl(self):
180183

181184
self.starter_instances[1].command_upgrade()
182185
if self.selenium:
183-
self.selenium.upgrade_deployment(self.cfg, self.new_cfg, timeout=30) # * 5s
186+
self.selenium.test_wait_for_upgrade() # * 5s
184187
self.starter_instances[1].wait_for_upgrade(300)
185188
if self.cfg.stress_upgrade:
186189
bench_instances[0].wait()
@@ -245,7 +248,7 @@ def upgrade_arangod_version_manual_impl(self):
245248
self.starter_instances[0].maintainance(False, InstanceType.COORDINATOR)
246249

247250
if self.selenium:
248-
self.selenium.upgrade_deployment(self.cfg, self.new_cfg, timeout=30) # * 5s
251+
self.selenium.test_wait_for_upgrade() # * 5s
249252

250253
@step
251254
def jam_attempt_impl(self):
@@ -266,7 +269,7 @@ def jam_attempt_impl(self):
266269

267270
prompt_user(self.basecfg, "instance stopped")
268271
if self.selenium:
269-
self.selenium.jam_step_1(self.new_cfg if self.new_cfg else self.cfg)
272+
self.selenium.jam_step_1()
270273

271274
ret = self.starter_instances[0].arangosh.check_test_data(
272275
"Cluster one node missing", True, ["--disabledDbserverUUID", uuid]
@@ -323,7 +326,7 @@ def jam_attempt_impl(self):
323326

324327
prompt_user(self.basecfg, "cluster should be up")
325328
if self.selenium:
326-
self.selenium.jam_step_2(self.new_cfg if self.new_cfg else self.cfg)
329+
self.selenium.jam_step_2()
327330

328331
def shutdown_impl(self):
329332
for node in self.starter_instances:
@@ -335,3 +338,13 @@ def before_backup_impl(self):
335338

336339
def after_backup_impl(self):
337340
pass
341+
342+
def set_selenium_instances(self):
343+
"""set instances in selenium runner"""
344+
self.selenium.set_instances(
345+
self.cfg,
346+
self.starter_instances[0].arango_importer,
347+
self.starter_instances[0].arango_restore,
348+
[x for x in self.starter_instances[0].all_instances if x.instance_type == InstanceType.COORDINATOR][0],
349+
self.new_cfg,
350+
)

release_tester/arangodb/starter/deployments/dc2dc.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -391,10 +391,7 @@ def test_setup_impl(self):
391391
raise Exception("check data on source cluster failed " + ret[1])
392392
self._get_in_sync(20)
393393

394-
self.cluster2["instance"].send_request(InstanceType.COORDINATOR,
395-
requests.post,
396-
"/_admin/routing/reload",
397-
"")
394+
self.cluster2["instance"].send_request(InstanceType.COORDINATOR, requests.post, "/_admin/routing/reload", "")
398395
ret = self.cluster2["instance"].arangosh.check_test_data(
399396
"dc2dc (post setup - dc2)", True, ["--readOnly", "true"]
400397
)

0 commit comments

Comments
 (0)