summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
Diffstat (limited to 'meta')
-rw-r--r--meta/lib/oeqa/runtime/cases/ssh.py28
1 files changed, 19 insertions, 9 deletions
diff --git a/meta/lib/oeqa/runtime/cases/ssh.py b/meta/lib/oeqa/runtime/cases/ssh.py
index cdbef59500..ae92bb34cd 100644
--- a/meta/lib/oeqa/runtime/cases/ssh.py
+++ b/meta/lib/oeqa/runtime/cases/ssh.py
@@ -4,6 +4,8 @@
4# SPDX-License-Identifier: MIT 4# SPDX-License-Identifier: MIT
5# 5#
6 6
7import time
8
7from oeqa.runtime.case import OERuntimeTestCase 9from oeqa.runtime.case import OERuntimeTestCase
8from oeqa.core.decorator.depends import OETestDepends 10from oeqa.core.decorator.depends import OETestDepends
9from oeqa.runtime.decorator.package import OEHasPackage 11from oeqa.runtime.decorator.package import OEHasPackage
@@ -13,12 +15,20 @@ class SSHTest(OERuntimeTestCase):
13 @OETestDepends(['ping.PingTest.test_ping']) 15 @OETestDepends(['ping.PingTest.test_ping'])
14 @OEHasPackage(['dropbear', 'openssh-sshd']) 16 @OEHasPackage(['dropbear', 'openssh-sshd'])
15 def test_ssh(self): 17 def test_ssh(self):
16 (status, output) = self.target.run('sleep 20', timeout=2) 18 for i in range(5):
17 msg='run() timed out but return code was zero.' 19 status, output = self.target.run("uname -a", timeout=5)
18 self.assertNotEqual(status, 0, msg=msg) 20 if status == 0:
19 (status, output) = self.target.run('uname -a') 21 break
20 self.assertEqual(status, 0, msg='SSH Test failed: %s' % output) 22 elif status == 255:
21 (status, output) = self.target.run('cat /etc/controllerimage') 23 # ssh returns 255 only if a ssh error occurs. This could
22 msg = "This isn't the right image - /etc/controllerimage " \ 24 # be an issue with "Connection refused" because the port
23 "shouldn't be here %s" % output 25 # isn't open yet, and this could check explicitly for that
24 self.assertEqual(status, 1, msg=msg) 26 # here. However, let's keep it simple and just retry for
27 # all errors a limited amount of times with a sleep to
28 # give it time for the port to open.
29 time.sleep(5)
30 continue
31 else:
32 self.fail("uname failed with \"%s\"" %output)
33 if status == 255:
34 self.fail("ssh error %s" %output)