Skip to content

Commit d8dd99b

Browse files
committed
testlib: Don't assume docker port output matches regex
(cherry picked from commit 8cbbfaf)
1 parent 937a003 commit d8dd99b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tests/testlib.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,10 @@ class DockerizedSshDaemon(object):
423423
def _get_container_port(self):
424424
s = subprocess__check_output(['docker', 'port', self.container_name])
425425
for line in s.decode().splitlines():
426-
dport, proto, baddr, bport = self.PORT_RE.match(line).groups()
426+
m = self.PORT_RE.match(line)
427+
if not m:
428+
continue
429+
dport, proto, _, bport = m.groups()
427430
if dport == '22' and proto == 'tcp':
428431
self.port = int(bport)
429432

0 commit comments

Comments
 (0)