Skip to content

Commit

Permalink
Merge pull request #790 from launchableinc/do-not-stop-pipeline
Browse files Browse the repository at this point in the history
Do not stop pipeline in record test command
  • Loading branch information
ono-max authored Mar 1, 2024
2 parents 040ec82 + 4164cd2 commit ac3768e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
3 changes: 3 additions & 0 deletions launchable/test_runners/launchable.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import types

import click
from launchable.app import Application

from launchable.commands.record.tests import tests as record_tests_cmd
from launchable.commands.split_subset import split_subset as split_subset_cmd
Expand Down Expand Up @@ -104,6 +105,8 @@ def report_files(self, file_mask="*.xml"):

@click.argument('source_roots', required=True, nargs=-1)
def record_tests(client, source_roots):
if isinstance(client, Application):
return
# client type: RecordTests in def launchable.commands.record.tests.tests
# Accept both file names and GLOB patterns
# Simple globs like '*.xml' can be dealt with by shell, but
Expand Down
22 changes: 20 additions & 2 deletions tests/commands/test_api_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,24 @@ def test_subset(self):
@responses.activate
@mock.patch.dict(os.environ, {"LAUNCHABLE_TOKEN": CliTestCase.launchable_token})
def test_record_tests(self):
responses.replace(
responses.GET,
"{base}/intake/organizations/{org}/workspaces/{ws}/builds/{build}".format(
base=get_base_url(),
org=self.organization,
ws=self.workspace,
build=self.build_name),
body=ReadTimeout("error"))
tracking = responses.add(
responses.POST,
CLI_TRACKING_URL.format(
base=get_base_url()),
body=ReadTimeout("error"))

result = self.cli("record", "tests", "--session", self.session, "minitest", str(self.test_files_dir) + "/")
self.assert_success(result)
# Since Timeout error is caught inside of LaunchableClient, the tracking event is sent twice.
self.assert_tracking_count(tracking=tracking, count=2)
responses.replace(
responses.POST,
"{base}/intake/organizations/{org}/workspaces/{ws}/builds/{build}/test_sessions/{session_id}/events".format(
Expand All @@ -318,7 +336,7 @@ def test_record_tests(self):
result = self.cli("record", "tests", "--session", self.session, "minitest", str(self.test_files_dir) + "/")
self.assert_success(result)
# Since HTTPError is occurred outside of LaunchableClient, the count is 1.
self.assert_tracking_count(tracking=tracking, count=1)
self.assert_tracking_count(tracking=tracking, count=2)

responses.replace(
responses.POST,
Expand All @@ -338,7 +356,7 @@ def test_record_tests(self):
result = self.cli("record", "tests", "--session", self.session, "minitest", str(self.test_files_dir) + "/")
self.assert_success(result)

self.assert_tracking_count(tracking=tracking, count=1)
self.assert_tracking_count(tracking=tracking, count=2)

@responses.activate
@mock.patch.dict(os.environ, {"LAUNCHABLE_TOKEN": CliTestCase.launchable_token})
Expand Down

0 comments on commit ac3768e

Please sign in to comment.