summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2016-08-31 16:59:46 -0700
committerMicah <micah@leap.se>2016-09-01 10:08:59 -0400
commitd5aef66460f42e5534b0f44496ca1297936ed8a1 (patch)
tree7d916d47e8213f07df3acf265c29697e899a1f1d
parent73c668cb3d90edde7bdf71c210ba9fe2147e611b (diff)
mx test: skip email delivery test if clamd is not running because signature files are still downloading.0.8.2
-rw-r--r--tests/white-box/mx.rb32
1 files changed, 18 insertions, 14 deletions
diff --git a/tests/white-box/mx.rb b/tests/white-box/mx.rb
index 6c0982ce..9ad13d52 100644
--- a/tests/white-box/mx.rb
+++ b/tests/white-box/mx.rb
@@ -85,10 +85,10 @@ class Mx < LeapTest
if Dir.glob("/var/lib/clamav/main.{c[vl]d,inc}").size > 0 and Dir.glob("/var/lib/clamav/daily.{c[vl]d,inc}").size > 0
assert_running '^/usr/sbin/clamd'
assert_running '^/usr/sbin/clamav-milter'
+ pass
else
- skip "Downloading the clamav signature files (/var/lib/clamav/{daily,main}.{c[vl]d,inc}) is still in progress, so clamd is not running.\nDon't worry, mail delivery will work without clamav. The download should finish soon."
+ skip "Downloading the clamav signature files (/var/lib/clamav/{daily,main}.{c[vl]d,inc}) is still in progress, so clamd is not running."
end
- pass
end
#
@@ -98,20 +98,24 @@ class Mx < LeapTest
# quickly that something is wrong.
#
def test_05_Can_deliver_email?
- addr = [TEST_EMAIL_USER, property('domain.full_suffix')].join('@')
- bad_addr = [TEST_BAD_USER, property('domain.full_suffix')].join('@')
+ if pgrep('^/usr/sbin/clamd').empty? || pgrep('^/usr/sbin/clamav-milter').empty?
+ skip "Mail delivery is being deferred because clamav daemon is not running"
+ else
+ addr = [TEST_EMAIL_USER, property('domain.full_suffix')].join('@')
+ bad_addr = [TEST_BAD_USER, property('domain.full_suffix')].join('@')
- assert !identity_exists?(bad_addr), "the address #{bad_addr} must not exist."
- if !identity_exists?(addr)
- user = assert_create_user(TEST_EMAIL_USER, :monitor)
- upload_public_key(user.id, TEST_EMAIL_PUBLIC_KEY)
- end
- assert identity_exists?(addr), "The identity #{addr} should have been created, but it doesn't exist yet."
- assert_send_email(addr)
- assert_raises(Net::SMTPError) do
- send_email(bad_addr)
+ assert !identity_exists?(bad_addr), "the address #{bad_addr} must not exist."
+ if !identity_exists?(addr)
+ user = assert_create_user(TEST_EMAIL_USER, :monitor)
+ upload_public_key(user.id, TEST_EMAIL_PUBLIC_KEY)
+ end
+ assert identity_exists?(addr), "The identity #{addr} should have been created, but it doesn't exist yet."
+ assert_send_email(addr)
+ assert_raises(Net::SMTPError) do
+ send_email(bad_addr)
+ end
+ pass
end
- pass
end
private