summaryrefslogtreecommitdiff
path: root/tests/white-box/network.rb
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2013-12-27 10:32:10 -0800
committerelijah <elijah@riseup.net>2013-12-27 10:32:10 -0800
commitf1ba024e9c529b5f9ac988d6600931f914ec1d31 (patch)
treeadc322b9c8f4e817e61e4ad4f91bb2efb5c9298b /tests/white-box/network.rb
parent34678e895a5a40da6f444199983fee3f8ce518ee (diff)
improved stunnel test
Diffstat (limited to 'tests/white-box/network.rb')
-rw-r--r--tests/white-box/network.rb30
1 files changed, 21 insertions, 9 deletions
diff --git a/tests/white-box/network.rb b/tests/white-box/network.rb
index 8ca56ffd..02eb80ca 100644
--- a/tests/white-box/network.rb
+++ b/tests/white-box/network.rb
@@ -11,18 +11,30 @@ class TestNetwork < LeapTest
# example properties:
#
# stunnel:
- # couch_client:
- # couch1_5984:
- # accept_port: 4000
- # connect: couch1.bitmask.i
- # connect_port: 15984
+ # ednp_clients:
+ # elk_9002:
+ # accept_port: 4003
+ # connect: elk.dev.bitmask.i
+ # connect_port: 19002
+ # couch_server:
+ # accept: 15984
+ # connect: "127.0.0.1:5984"
#
def test_01_stunnel_is_running
if $node['stunnel']
- $node['stunnel'].values.each do |stunnel_type|
- stunnel_type.values.each do |stunnel_conf|
- assert port = stunnel_conf['accept_port'], 'Field `accept_port` must be present in `stunnel` property.'
- assert_tcp_socket('localhost', port)
+ $node['stunnel'].each do |stunnel_type, stunnel_configs|
+ if stunnel_type =~ /_clients?$/
+ stunnel_configs.values.each do |stunnel_conf|
+ assert port = stunnel_conf['accept_port'], 'Field `accept_port` must be present in `stunnel` property.'
+ assert_tcp_socket('localhost', port)
+ end
+ elsif stunnel_type =~ /_server$/
+ assert accept = stunnel_configs['accept'], "Field `accept` must be present in property `stunnel.#{stunnel_type}`"
+ assert_tcp_socket('localhost', accept)
+ assert connect = stunnel_configs['connect'], "Field `connect` must be present in property `stunnel.#{stunnel_type}`"
+ assert_tcp_socket(*connect.split(':'))
+ else
+ skip "Unknown stunnel type `#{stunnel_type}`"
end
end
end