summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2013-12-27 15:00:10 -0800
committerelijah <elijah@riseup.net>2013-12-27 15:00:10 -0800
commitd86e34564cda2d28fd42d10e584184af7e8b7553 (patch)
tree883658af4da54935d2b4812bfee9f38a6a4fbc11 /tests
parent0a56b656f8fbfd38ee1a9babdb93fbed39c4a973 (diff)
more couchdb tests
Diffstat (limited to 'tests')
-rw-r--r--tests/white-box/couchdb.rb31
1 files changed, 30 insertions, 1 deletions
diff --git a/tests/white-box/couchdb.rb b/tests/white-box/couchdb.rb
index 6ffc6a4f..3abddefc 100644
--- a/tests/white-box/couchdb.rb
+++ b/tests/white-box/couchdb.rb
@@ -33,12 +33,18 @@ class TestCouchdb < LeapTest
pass
end
+ #
+ # all configured nodes are in 'cluster_nodes'
+ # all nodes online and communicating are in 'all_nodes'
+ #
+ # this seems backward to me, so it might be the other way around.
+ #
def test_03_replica_membership
url = couchdb_url("/_membership")
assert_get(url) do |body|
response = JSON.parse(body)
nodes_configured_but_not_available = response['cluster_nodes'] - response['all_nodes']
- nodes_available_but_not_configured = response['cluster_nodes'] - response['all_nodes']
+ nodes_available_but_not_configured = response['all_nodes'] - response['cluster_nodes']
if nodes_configured_but_not_available.any?
warn "These nodes are configured but not available:", nodes_configured_but_not_available
end
@@ -51,6 +57,29 @@ class TestCouchdb < LeapTest
end
end
+ def test_04_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|
+ response = JSON.parse(body)
+ assert_equal 6, response['total_rows']
+ actual_users = response['rows'].map{|row| row['id'].sub(/^org.couchdb.user:/, '') }
+ assert_equal acl_users, actual_users
+ end
+ pass
+ end
+
+ def test_05_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|
+ assert response = JSON.parse(body)
+ assert_equal db_name, response['db_name']
+ end
+ end
+ pass
+ end
+
private
def couchdb_url(path="", port=nil)