aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArmin Kuster <akuster808@gmail.com>2019-04-06 12:06:53 +0530
committerArmin Kuster <akuster808@gmail.com>2019-04-13 10:31:11 -0700
commit109b8260bfd3f6a7327d3dede6d9c91b4ab4102d (patch)
tree107a1e06fe3521bed18d6f83ee68a5145a7ad969
parent8a1f54a246f3e8d5236a29ee31e7bcee80093688 (diff)
downloadmeta-security-109b8260bfd3f6a7327d3dede6d9c91b4ab4102d.tar.gz
meta-security-109b8260bfd3f6a7327d3dede6d9c91b4ab4102d.tar.bz2
meta-security-109b8260bfd3f6a7327d3dede6d9c91b4ab4102d.zip
clamav runtime: add resolve.conf support
and ping test too Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r--lib/oeqa/runtime/cases/clamav.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/oeqa/runtime/cases/clamav.py b/lib/oeqa/runtime/cases/clamav.py
index fc77330..647861c 100644
--- a/lib/oeqa/runtime/cases/clamav.py
+++ b/lib/oeqa/runtime/cases/clamav.py
@@ -1,6 +1,7 @@
# Copyright (C) 2019 Armin Kuster <akuster808@gmail.com>
#
import re
+from tempfile import mkstemp
from oeqa.runtime.case import OERuntimeTestCase
from oeqa.core.decorator.depends import OETestDepends
@@ -9,6 +10,20 @@ from oeqa.runtime.decorator.package import OEHasPackage
class ClamavTest(OERuntimeTestCase):
+ @classmethod
+ def setUpClass(cls):
+ cls.tmp_fd, cls.tmp_path = mkstemp()
+ with os.fdopen(cls.tmp_fd, 'w') as f:
+ # use gooled public dns
+ f.write("nameserver 8.8.8.8")
+ f.write(os.linesep)
+ f.write("nameserver 8.8.4.4")
+ f.write(os.linesep)
+
+ @classmethod
+ def tearDownClass(cls):
+ os.remove(cls.tmp_path)
+
@OEHasPackage(['clamav'])
@OETestDepends(['ssh.SSHTest.test_ssh'])
def test_freshclam_help(self):
@@ -18,6 +33,19 @@ class ClamavTest(OERuntimeTestCase):
self.assertEqual(status, 0, msg = msg)
@OETestDepends(['clamav.ClamavTest.test_freshclam_help'])
+ @OEHasPackage(['openssh-scp', 'dropbear'])
+ def test_ping_clamav_net(self):
+ dst = '/etc/resolv.conf'
+ self.tc.target.run('rm -f %s' % dst)
+ (status, output) = self.tc.target.copyTo(self.tmp_path, dst)
+ msg = 'File could not be copied. Output: %s' % output
+ self.assertEqual(status, 0, msg=msg)
+
+ status, output = self.target.run('ping -c 1 database.clamav.net')
+ msg = ('ping database.clamav.net failed: output is:\n%s' % output)
+ self.assertEqual(status, 0, msg = msg)
+
+ @OETestDepends(['clamav.ClamavTest.test_ping_clamav_net'])
def test_freshclam_download(self):
status, output = self.target.run('freshclam --show-progress')
match = re.search('Database updated', output)