[milter-manager-commit] milter-manager/milter-manager at b4ae92e [master] binding ruby: Determine rspamd_proxy is invalid properly

Back to archive index

Kenji Okimoto null+****@clear*****
Mon Jul 3 09:37:27 JST 2017


Kenji Okimoto	2017-07-03 09:37:27 +0900 (Mon, 03 Jul 2017)

  New Revision: b4ae92eb85c227c371bdc89ccc0e148fe9806866
  https://github.com/milter-manager/milter-manager/commit/b4ae92eb85c227c371bdc89ccc0e148fe9806866

  Message:
    binding ruby: Determine rspamd_proxy is invalid properly
    
    Because `@rspamadm_path` can be `nil`.
    
    See #128

  Modified files:
    binding/ruby/lib/milter/manager/rspamd-proxy-detector.rb
    binding/ruby/test/manager/test-rspamd-proxy-detector.rb

  Modified: binding/ruby/lib/milter/manager/rspamd-proxy-detector.rb (+1 -0)
===================================================================
--- binding/ruby/lib/milter/manager/rspamd-proxy-detector.rb    2017-06-30 02:29:01 +0900 (4eca6c1)
+++ binding/ruby/lib/milter/manager/rspamd-proxy-detector.rb    2017-07-03 09:37:27 +0900 (7d15234)
@@ -7,6 +7,7 @@ module Milter::Manager
     end
 
     def detect
+      return unless @rspamadm_path
       return unless File.executable?(@rspamadm_path)
 
       config = JSON.parse(`#{@rspamadm_path} configdump --json` || "{}")

  Modified: binding/ruby/test/manager/test-rspamd-proxy-detector.rb (+5 -0)
===================================================================
--- binding/ruby/test/manager/test-rspamd-proxy-detector.rb    2017-06-30 02:29:01 +0900 (b0687b0)
+++ binding/ruby/test/manager/test-rspamd-proxy-detector.rb    2017-07-03 09:37:27 +0900 (f23dfe1)
@@ -19,4 +19,9 @@ class TestRspamdProxyDetector < Test::Unit::TestCase
 
     assert_equal(expected, detector.detect)
   end
+
+  test "detect w/ rspamadm_path is nil" do
+    detector = ::Milter::Manager::RspamdProxyDetector.new(nil)
+    assert_equal(nil, detector.detect)
+  end
 end
-------------- next part --------------
An HTML attachment was scrubbed...
下載 



More information about the milter-manager-commit mailing list
Back to archive index