summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2015-07-27 14:04:03 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-07-27 23:29:14 +0100
commit90a52ffd4458d01d9b465341b9781f6cbc21fb2e (patch)
treec2fabf60821b4863f6adba53cf436e9fe9a79528
parent76d8c4e97c9dbf9e50d8e73805f77b8404a53caf (diff)
downloadpoky-90a52ffd4458d01d9b465341b9781f6cbc21fb2e.tar.gz
oeqa/selftest/imagefeatures: fix SSH without password tests
* We need to set EXTRA_IMAGE_FEATURES outright or existing values will affect the test * For test case 1107 we need "empty-root-password" to match the behaviour described in the test case * For test case 1115 we shouldn't be able to connect as root with the features we are setting Test cases 1107 and 1115 have been updated in Testopia to match. (From OE-Core rev: f1e66398eaba495ea6d8d39e2b489e594ac88a0e) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oeqa/selftest/imagefeatures.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/meta/lib/oeqa/selftest/imagefeatures.py b/meta/lib/oeqa/selftest/imagefeatures.py
index d48435fedf..20cc58dc93 100644
--- a/meta/lib/oeqa/selftest/imagefeatures.py
+++ b/meta/lib/oeqa/selftest/imagefeatures.py
@@ -25,7 +25,7 @@ class ImageFeatures(oeSelfTest):
25 AutomatedBy: Daniel Istrate <daniel.alexandrux.istrate@intel.com> 25 AutomatedBy: Daniel Istrate <daniel.alexandrux.istrate@intel.com>
26 """ 26 """
27 27
28 features = 'EXTRA_IMAGE_FEATURES += "ssh-server-openssh empty-root-password"\n' 28 features = 'EXTRA_IMAGE_FEATURES = "ssh-server-openssh empty-root-password allow-empty-password"\n'
29 features += 'INHERIT += "extrausers"\n' 29 features += 'INHERIT += "extrausers"\n'
30 features += 'EXTRA_USERS_PARAMS = "useradd -p \'\' {}; usermod -s /bin/sh {};"'.format(self.test_user, self.test_user) 30 features += 'EXTRA_USERS_PARAMS = "useradd -p \'\' {}; usermod -s /bin/sh {};"'.format(self.test_user, self.test_user)
31 31
@@ -46,12 +46,14 @@ class ImageFeatures(oeSelfTest):
46 def test_all_users_can_connect_via_ssh_without_password(self): 46 def test_all_users_can_connect_via_ssh_without_password(self):
47 """ 47 """
48 Summary: Check if all users can connect via ssh without password 48 Summary: Check if all users can connect via ssh without password
49 Expected: 1. Connection to the image via ssh using root or tester user without providing a password should be allowed. 49 Expected: 1. Connection to the image via ssh using root user without providing a password should NOT be allowed.
50 2. Connection to the image via ssh using tester user without providing a password should be allowed.
50 Product: oe-core 51 Product: oe-core
51 Author: Ionut Chisanovici <ionutx.chisanovici@intel.com> 52 Author: Ionut Chisanovici <ionutx.chisanovici@intel.com>
52 AutomatedBy: Daniel Istrate <daniel.alexandrux.istrate@intel.com> 53 AutomatedBy: Daniel Istrate <daniel.alexandrux.istrate@intel.com>
53 """ 54 """
54 features = 'EXTRA_IMAGE_FEATURES += "ssh-server-openssh allow-empty-password"\n' 55
56 features = 'EXTRA_IMAGE_FEATURES = "ssh-server-openssh allow-empty-password"\n'
55 features += 'INHERIT += "extrausers"\n' 57 features += 'INHERIT += "extrausers"\n'
56 features += 'EXTRA_USERS_PARAMS = "useradd -p \'\' {}; usermod -s /bin/sh {};"'.format(self.test_user, self.test_user) 58 features += 'EXTRA_USERS_PARAMS = "useradd -p \'\' {}; usermod -s /bin/sh {};"'.format(self.test_user, self.test_user)
57 59
@@ -66,7 +68,10 @@ class ImageFeatures(oeSelfTest):
66 for user in [self.root_user, self.test_user]: 68 for user in [self.root_user, self.test_user]:
67 ssh = SSHControl(ip=qemu.ip, logfile=qemu.sshlog, user=user) 69 ssh = SSHControl(ip=qemu.ip, logfile=qemu.sshlog, user=user)
68 status, output = ssh.run("true") 70 status, output = ssh.run("true")
69 self.assertEqual(status, 0, 'ssh to user tester failed with %s' % output) 71 if user == 'root':
72 self.assertNotEqual(status, 0, 'ssh to user root was allowed when it should not have been')
73 else:
74 self.assertEqual(status, 0, 'ssh to user tester failed with %s' % output)
70 75
71 76
72 @testcase(1114) 77 @testcase(1114)