Skip to content

Commit 3b53929

Browse files
committed
use default branch for auto tests; return correct exit code
1 parent 321a6d4 commit 3b53929

3 files changed

Lines changed: 17 additions & 12 deletions

File tree

scripts/cli.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import socket
21
import sys
32
from pathlib import Path
43

@@ -92,12 +91,9 @@ def trigger_auto_tests(
9291
@click.option("--tc-password", required=True, help="TeamCity Password")
9392
def new_trigger_builds(tc_user: str, tc_password: str):
9493
tc = TeamCity("http://tc", auth=(tc_user, tc_password)) # noqa
95-
import rpdb
96-
97-
ip = socket.gethostbyname(socket.gethostname())
98-
click.echo(f"IP: {ip}")
99-
rpdb.set_trace("0.0.0.0")
100-
new_main(tc_user, tc_password)
94+
is_success = new_main(tc_user, tc_password)
95+
if not is_success:
96+
sys.exit(1)
10197

10298

10399
@cli.command(

scripts/trigger_auto_tests/main.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,19 @@ def main(tc_user: str, tc_password: str):
3737
while triggered_builds:
3838
time.sleep(BUILDS_CHECK_DELAY)
3939
for shell_name, build_id in triggered_builds.copy().items():
40-
build = tc.builds.get(f"id:{build_id}")
41-
if is_build_finished(build):
42-
builds_statuses[shell_name] = is_build_success(build)
43-
triggered_builds.pop(shell_name)
40+
try:
41+
build = tc.builds.get(f"id:{build_id}")
42+
if is_build_finished(build):
43+
click.echo(
44+
f"{shell_name} Automation tests is finished "
45+
f"with status {build.status}"
46+
)
47+
builds_statuses[shell_name] = is_build_success(build)
48+
triggered_builds.pop(shell_name)
49+
except Exception as e:
50+
errors.append(e)
51+
click.echo(e, err=True)
4452

4553
if errors:
4654
raise Exception("There were errors running automation tests.")
55+
return all(builds_statuses.values())

scripts/trigger_auto_tests/utils/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def trigger_auto_tests_build2(
8888
ModelProperty("conf.triggered_by_project.commit_id", tests_info.commit_id),
8989
]
9090
)
91-
new_build = Build(build_type_id=bt.id, branch_name="master", properties=properties)
91+
new_build = Build(build_type_id=bt.id, properties=properties)
9292
update_tc_csrf(tc)
9393
build = tc.build_queues.queue_new_build(body=new_build, move_to_top=True)
9494
return build.id

0 commit comments

Comments
 (0)