diff mbox series

[PULL,15/18] tests/acceptance/virtiofs_submounts: standardize port as integer

Message ID 20210208133711.2596075-16-philmd@redhat.com (mailing list archive)
State New, archived
Headers show
Series [PULL,01/18] tests/acceptance: Extract tesseract_available() helper in new namespace | expand

Commit Message

Philippe Mathieu-Daudé Feb. 8, 2021, 1:37 p.m. UTC
From: Cleber Rosa <crosa@redhat.com>

Instead of having to cast it whenever it's going to be used, let's
standardize it as an integer, which is the data type that will be
used most often.

Given that the regex will only match digits, it's safe that we'll
end up getting a integer, but, it could as well be a zero.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
Reviewed-by: Beraldo Leal <bleal@redhat.com>
Message-Id: <20210203172357.1422425-9-crosa@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
 tests/acceptance/virtiofs_submounts.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
diff mbox series


diff --git a/tests/acceptance/virtiofs_submounts.py b/tests/acceptance/virtiofs_submounts.py
index f1b49f03bb5..82941756086 100644
--- a/tests/acceptance/virtiofs_submounts.py
+++ b/tests/acceptance/virtiofs_submounts.py
@@ -86,17 +86,18 @@  def get_portfwd(self):
             if match is not None:
-                port = match[1]
+                port = int(match[1])
-        self.log.debug('sshd listening on port: ' + port)
+        self.assertGreater(port, 0)
+        self.log.debug('sshd listening on port: %d', port)
         return port
     def ssh_connect(self, username, keyfile):
         self.ssh_logger = logging.getLogger('ssh')
         port = self.get_portfwd()
-        self.ssh_session = ssh.Session('', port=int(port),
+        self.ssh_session = ssh.Session('', port=port,
                                        user=username, key=keyfile)
         for i in range(10):