summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2014-03-18 00:19:45 -0700
committerelijah <elijah@riseup.net>2014-03-18 00:19:45 -0700
commitcd09ed9eb9d183123652a52651a427bab558c496 (patch)
tree26f7da0b80e2e7f212f299fbd310dc35299d644c
parentb70388856620db47724a3206f528db515eb0e20e (diff)
clean up the names of tests
-rwxr-xr-xbin/run_tests15
-rw-r--r--tests/white-box/couchdb.rb16
-rw-r--r--tests/white-box/network.rb6
-rw-r--r--tests/white-box/openvpn.rb6
-rw-r--r--tests/white-box/webapp.rb10
5 files changed, 28 insertions, 25 deletions
diff --git a/bin/run_tests b/bin/run_tests
index 2336eba8..f4fb0157 100755
--- a/bin/run_tests
+++ b/bin/run_tests
@@ -394,11 +394,9 @@ class LeapRunner < MiniTest::Unit
# Converts snake_case and CamelCase to something more pleasant for humans to read.
#
def readable(str)
- str.gsub(/([A-Z]+)([A-Z][a-z])/, '\1 \2').
- gsub(/([a-z])([A-Z])/, '\1 \2').
+ str.
gsub(/_/, ' ').
- sub(/^test (\d* )?/i, '').
- downcase.capitalize
+ sub(/^test (\d* )?/i, '')
end
def machine_readable(str)
@@ -428,7 +426,12 @@ class TestDependencyGraph
end
def tsort_each_child(test_class_name, &block)
- @dependencies[test_class_name].each(&block)
+ if @dependencies[test_class_name]
+ @dependencies[test_class_name].each(&block)
+ else
+ puts "ERROR: bad dependency, no such class `#{test_class_name}`"
+ exit(1)
+ end
end
def sorted
@@ -476,7 +479,7 @@ def pin_test_name(name)
die name, "there is no test class `#{test_class}`"
end
if test_name
- $pinned_test_method = $pinned_test_class.tests.detect{|m| m.to_s =~ /^test_(\d+_)?#{test_name}$/}
+ $pinned_test_method = $pinned_test_class.tests.detect{|m| m.to_s =~ /^test_(\d+_)?#{Regexp.escape(test_name)}$/}
unless $pinned_test_method
die name, "there is no test `#{test_name}` in class `#{test_class}`"
end
diff --git a/tests/white-box/couchdb.rb b/tests/white-box/couchdb.rb
index 93551367..9d5da94f 100644
--- a/tests/white-box/couchdb.rb
+++ b/tests/white-box/couchdb.rb
@@ -2,13 +2,13 @@ raise SkipTest unless $node["services"].include?("couchdb")
require 'json'
-class TestCouchdb < LeapTest
- depends_on "TestNetwork"
+class CouchDB < LeapTest
+ depends_on "Network"
def setup
end
- def test_00_daemons_running
+ def test_00_Are_daemons_running?
assert_running 'tapicero'
assert_running 'bin/beam'
assert_running 'bin/epmd'
@@ -18,7 +18,7 @@ class TestCouchdb < LeapTest
#
# check to make sure we can get welcome response from local couchdb
#
- def test_01_couch_is_working
+ def test_01_Is_CouchDB_running?
assert_get(couchdb_url) do |body|
assert_match /"couchdb":"Welcome"/, body, "Could not get welcome message from #{couchdb_url}. Probably couchdb is not running."
end
@@ -28,7 +28,7 @@ class TestCouchdb < LeapTest
#
# compare the configured nodes to the nodes that are actually listed in bigcouch
#
- def test_02_nodes_are_in_replication_database
+ def test_02_Is_cluster_membership_ok?
url = couchdb_backend_url("/nodes/_all_docs")
neighbors = assert_property('couch.bigcouch.neighbors')
neighbors << assert_property('domain.full')
@@ -47,7 +47,7 @@ class TestCouchdb < LeapTest
#
# this seems backward to me, so it might be the other way around.
#
- def test_03_replica_membership_is_kosher
+ def test_03_Are_configured_nodes_online?
url = couchdb_url("/_membership")
assert_get(url) do |body|
response = JSON.parse(body)
@@ -65,7 +65,7 @@ class TestCouchdb < LeapTest
end
end
- def test_04_acl_users_exist
+ def test_04_Do_ACL_users_exist?
acl_users = ['_design/_auth', 'leap_mx', 'nickserver', 'soledad', 'tapicero', 'webapp']
url = couchdb_backend_url("/_users/_all_docs")
assert_get(url) do |body|
@@ -77,7 +77,7 @@ class TestCouchdb < LeapTest
pass
end
- def test_05_required_databases_exist
+ def test_05_Do_required_databases_exist?
dbs_that_should_exist = ["customers","identities","keycache","sessions","shared","tickets","tokens","users"]
dbs_that_should_exist.each do |db_name|
assert_get(couchdb_url("/"+db_name)) do |body|
diff --git a/tests/white-box/network.rb b/tests/white-box/network.rb
index 53df80dc..14de2eac 100644
--- a/tests/white-box/network.rb
+++ b/tests/white-box/network.rb
@@ -2,12 +2,12 @@ require 'socket'
raise SkipTest if $node["dummy"]
-class TestNetwork < LeapTest
+class Network < LeapTest
def setup
end
- def test_01_can_connect_to_internet
+ def test_01_Can_connect_to_internet?
assert_get('http://www.google.com/images/srpr/logo11w.png')
pass
end
@@ -25,7 +25,7 @@ class TestNetwork < LeapTest
# accept: 15984
# connect: "127.0.0.1:5984"
#
- def test_02_stunnel_is_running
+ def test_02_Is_stunnel_running?
if $node['stunnel']
good_stunnel_pids = []
$node['stunnel'].each do |stunnel_type, stunnel_configs|
diff --git a/tests/white-box/openvpn.rb b/tests/white-box/openvpn.rb
index 2b1276f4..5eb2bdb5 100644
--- a/tests/white-box/openvpn.rb
+++ b/tests/white-box/openvpn.rb
@@ -1,12 +1,12 @@
raise SkipTest unless $node["services"].include?("openvpn")
-class TestOpenvpn < LeapTest
- depends_on "TestNetwork"
+class Openvpn < LeapTest
+ depends_on "Network"
def setup
end
- def test_01_daemons_running
+ def test_01_Are_daemons_running?
assert_running '/usr/sbin/openvpn .* /etc/openvpn/tcp_config.conf'
assert_running '/usr/sbin/openvpn .* /etc/openvpn/udp_config.conf'
assert_running '/usr/sbin/unbound'
diff --git a/tests/white-box/webapp.rb b/tests/white-box/webapp.rb
index 09e92797..142ac2de 100644
--- a/tests/white-box/webapp.rb
+++ b/tests/white-box/webapp.rb
@@ -2,8 +2,8 @@ raise SkipTest unless $node["services"].include?("webapp")
require 'socket'
-class TestWebapp < LeapTest
- depends_on "TestNetwork"
+class Webapp < LeapTest
+ depends_on "Network"
HAPROXY_CONFIG = '/etc/haproxy/haproxy.cfg'
@@ -20,7 +20,7 @@ class TestWebapp < LeapTest
# connect: couch1.bitmask.i
# connect_port: 15984
#
- def test_01_can_contact_couchdb
+ def test_01_Can_contact_couchdb?
assert_property('stunnel.couch_client')
$node['stunnel']['couch_client'].values.each do |stunnel_conf|
assert port = stunnel_conf['accept_port'], 'Field `accept_port` must be present in `stunnel` property.'
@@ -45,7 +45,7 @@ class TestWebapp < LeapTest
# port: 4000
# weight: 10
#
- def test_02_haproxy_is_working
+ def test_02_Is_haproxy_working?
port = file_match(HAPROXY_CONFIG, /^ bind localhost:(\d+)$/)
url = "http://localhost:#{port}"
assert_get(url) do |body|
@@ -54,7 +54,7 @@ class TestWebapp < LeapTest
pass
end
- def test_03_daemons_running
+ def test_03_Are_daemons_running?
assert_running '/usr/sbin/apache2'
assert_running '/usr/bin/nickserver'
pass