Align status output for parallel_execute

Previously docker-compose would output lines that looked like:

    Starting service ... done
    Starting short ...
    Starting service-with-a-long-name ... done

It's difficult to scan down this output and get an idea of what's happening.

Now the statuses are aligned, and output looks like this:

    Starting service                  ... done
    Starting short                    ...
    Starting service-with-a-long-name ... done

To me, this is quite a bit easier to read.

Signed-off-by: Evan Shaw <evan@vendhq.com>
This commit is contained in:
Evan Shaw 2017-02-25 13:48:02 +13:00 committed by Joffrey F
parent 259b96748c
commit 9cdbb953ba
2 changed files with 28 additions and 5 deletions

View file

@ -115,3 +115,18 @@ def test_parallel_execute_with_upstream_errors():
assert (data_volume, None, APIError) in events
assert (db, None, UpstreamError) in events
assert (web, None, UpstreamError) in events
def test_parallel_execute_alignment(capsys):
results, errors = parallel_execute(
objects=["short", "a very long name"],
func=lambda x: x,
get_name=six.text_type,
msg="Aligning",
)
assert errors == {}
_, err = capsys.readouterr()
a, b = err.split('\n')[:2]
assert a.index('...') == b.index('...')