diff options
| author | elijah <elijah@riseup.net> | 2014-09-02 22:02:41 -0700 | 
|---|---|---|
| committer | elijah <elijah@riseup.net> | 2014-09-02 22:02:41 -0700 | 
| commit | 72bad39f8a21c3be33b17134d2e3ca11f5e0d58f (patch) | |
| tree | c18d2ac185aefb8b3897fd6695e4795315b69eca /tests | |
| parent | a54b82ff7cdae2e44bc3c159473ca03e283f0746 (diff) | |
tests: make warnings not produce a non-zero exit code, add 'ignore' command to tests, make shorewall optional.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/white-box/network.rb | 40 | 
1 files changed, 20 insertions, 20 deletions
| diff --git a/tests/white-box/network.rb b/tests/white-box/network.rb index 118861a7..f2041710 100644 --- a/tests/white-box/network.rb +++ b/tests/white-box/network.rb @@ -26,35 +26,35 @@ class Network < LeapTest    #     connect: "127.0.0.1:5984"    #    def test_02_Is_stunnel_running? -    if $node['stunnel'] -      good_stunnel_pids = [] -      $node['stunnel']['clients'].each do |stunnel_type, stunnel_configs| -        stunnel_configs.each do |stunnel_name, stunnel_conf| -          config_file_name = "/etc/stunnel/#{stunnel_name}.conf" -          processes = pgrep(config_file_name) -          assert_equal 6, processes.length, "There should be six stunnel processes running for `#{config_file_name}`" -          good_stunnel_pids += processes.map{|ps| ps[:pid]} -          assert port = stunnel_conf['accept_port'], 'Field `accept_port` must be present in `stunnel` property.' -          assert_tcp_socket('localhost', port) -        end -      end -      $node['stunnel']['servers'].each do |stunnel_name, stunnel_conf| +    ignore unless $node['stunnel'] +    good_stunnel_pids = [] +    $node['stunnel']['clients'].each do |stunnel_type, stunnel_configs| +      stunnel_configs.each do |stunnel_name, stunnel_conf|          config_file_name = "/etc/stunnel/#{stunnel_name}.conf"          processes = pgrep(config_file_name)          assert_equal 6, processes.length, "There should be six stunnel processes running for `#{config_file_name}`"          good_stunnel_pids += processes.map{|ps| ps[:pid]} -        assert accept_port = stunnel_conf['accept_port'], "Field `accept` must be present in property `stunnel.servers.#{stunnel_name}`" -        assert_tcp_socket('localhost', accept_port) -        assert connect_port = stunnel_conf['connect_port'], "Field `connect` must be present in property `stunnel.servers.#{stunnel_name}`" -        assert_tcp_socket('localhost', connect_port) +        assert port = stunnel_conf['accept_port'], 'Field `accept_port` must be present in `stunnel` property.' +        assert_tcp_socket('localhost', port)        end -      all_stunnel_pids = pgrep('/usr/bin/stunnel').collect{|process| process[:pid]}.uniq -      assert_equal good_stunnel_pids.sort, all_stunnel_pids.sort, "There should not be any extra stunnel processes that are not configured in /etc/stunnel" -      pass      end +    $node['stunnel']['servers'].each do |stunnel_name, stunnel_conf| +      config_file_name = "/etc/stunnel/#{stunnel_name}.conf" +      processes = pgrep(config_file_name) +      assert_equal 6, processes.length, "There should be six stunnel processes running for `#{config_file_name}`" +      good_stunnel_pids += processes.map{|ps| ps[:pid]} +      assert accept_port = stunnel_conf['accept_port'], "Field `accept` must be present in property `stunnel.servers.#{stunnel_name}`" +      assert_tcp_socket('localhost', accept_port) +      assert connect_port = stunnel_conf['connect_port'], "Field `connect` must be present in property `stunnel.servers.#{stunnel_name}`" +      assert_tcp_socket('localhost', connect_port) +    end +    all_stunnel_pids = pgrep('/usr/bin/stunnel').collect{|process| process[:pid]}.uniq +    assert_equal good_stunnel_pids.sort, all_stunnel_pids.sort, "There should not be any extra stunnel processes that are not configured in /etc/stunnel" +    pass    end    def test_03_Is_shorewall_running? +    ignore unless File.exists?('/sbin/shorewall')      assert_run('/sbin/shorewall status')      pass    end | 
