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

Don't fail git clone is tty is not attached #586

Merged
merged 1 commit into from
Oct 18, 2018
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
2 changes: 1 addition & 1 deletion esrally/utils/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def is_working_copy(src):
def clone(src, remote):
io.ensure_dir(src)
# Don't swallow subprocess output, user might need to enter credentials...
if process.run_subprocess("git clone %s %s" % (remote, src)):
if process.run_subprocess_with_logging("git clone %s %s" % (remote, src)):
raise exceptions.SupplyError("Could not clone from [%s] to [%s]" % (remote, src))


Expand Down
16 changes: 7 additions & 9 deletions tests/utils/git_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,21 @@ def test_git_version_too_old(self, run_subprocess_with_logging, run_subprocess):
run_subprocess_with_logging.assert_called_with("git -C /src --version", level=logging.DEBUG)

@mock.patch("esrally.utils.io.ensure_dir")
@mock.patch("esrally.utils.process.run_subprocess")
def test_clone_successful(self, run_subprocess, ensure_dir):
run_subprocess.return_value = False
@mock.patch("esrally.utils.process.run_subprocess_with_logging")
def test_clone_successful(self, run_subprocess_with_logging, ensure_dir):
run_subprocess_with_logging.return_value = 0
src = "/src"
remote = "http://github.com/some/project"

git.clone(src, remote)

ensure_dir.assert_called_with(src)
run_subprocess.assert_called_with("git clone http://github.com/some/project /src")
run_subprocess_with_logging.assert_called_with("git clone http://github.com/some/project /src")

@mock.patch("esrally.utils.io.ensure_dir")
@mock.patch("esrally.utils.process.run_subprocess")
@mock.patch("esrally.utils.process.run_subprocess_with_logging")
def test_clone_with_error(self, run_subprocess_with_logging, run_subprocess, ensure_dir):
run_subprocess_with_logging.return_value = 0
run_subprocess.return_value = True
def test_clone_with_error(self, run_subprocess_with_logging, ensure_dir):
run_subprocess_with_logging.return_value = 128
src = "/src"
remote = "http://github.com/some/project"

Expand All @@ -52,7 +50,7 @@ def test_clone_with_error(self, run_subprocess_with_logging, run_subprocess, ens
self.assertEqual("Could not clone from [http://github.com/some/project] to [/src]", ctx.exception.args[0])

ensure_dir.assert_called_with(src)
run_subprocess.assert_called_with("git clone http://github.com/some/project /src")
run_subprocess_with_logging.assert_called_with("git clone http://github.com/some/project /src")

@mock.patch("esrally.utils.process.run_subprocess")
@mock.patch("esrally.utils.process.run_subprocess_with_logging")
Expand Down