Skip to content

Commit

Permalink
Fix to work with no shell
Browse files Browse the repository at this point in the history
  • Loading branch information
danpalmer committed May 6, 2018
1 parent c59ac5e commit 0b38cf5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions plugins/tests/test_logging_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def test_prometheus_logger_wipes_directory_on_startup(app):
def test_prometheus_logger_metrics(routemaster_serve_subprocess):
with routemaster_serve_subprocess() as (proc, port):
while True:
if 'Booting worker' in proc.stderr.readline().decode('utf-8'):
if 'Booting worker' in proc.stdout.readline().decode('utf-8'):
break

# Populate metrics with a request
Expand All @@ -135,7 +135,7 @@ def test_prometheus_logger_metrics(routemaster_serve_subprocess):
def test_prometheus_logger_ignores_metrics_path(routemaster_serve_subprocess):
with routemaster_serve_subprocess() as (proc, port):
while True:
if 'Booting worker' in proc.stderr.readline().decode('utf-8'):
if 'Booting worker' in proc.stdout.readline().decode('utf-8'):
break

# This should _not_ populate the metrics with any samples
Expand Down
15 changes: 10 additions & 5 deletions routemaster/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Global test setup and fixtures."""

import io
import os
import re
import json
Expand Down Expand Up @@ -536,15 +537,19 @@ def routemaster_serve_subprocess(unused_tcp_port):
def _inner():
try:
proc = subprocess.Popen(
f'routemaster --config-file=example.yaml serve '
f'--bind 127.0.0.1:{unused_tcp_port}',
shell=True,
[
'routemaster',
'--config-file=example.yaml',
'serve',
'--bind',
f'127.0.0.1:{unused_tcp_port}',
],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
stderr=subprocess.STDOUT,
)
yield proc, unused_tcp_port
finally:
proc.kill()
proc.terminate()

return _inner

0 comments on commit 0b38cf5

Please sign in to comment.