summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2013-03-06 11:43:49 +0100
committerAzul <azul@leap.se>2013-03-06 12:12:49 +0100
commitf70366e27aaac985c876d1d0260d7aab8b7ed8b5 (patch)
treee496cbc1f9da52b400e010889ce17bdafc841b34
parentc3bf76fcacb9576f674895a57fd3a47a2872fd8e (diff)
simulate couch migration workflow on travis
* first setup couch similar to what we'll have on the platform * then run migrations as admin * then drop admin privileges * then proceed with the normal test script
-rw-r--r--.travis.yml14
-rw-r--r--test/config/couchdb.yml.admin (renamed from config/couchdb.yml.admin)3
-rw-r--r--test/config/couchdb.yml.user (renamed from config/couchdb.yml.user)0
-rwxr-xr-xtest/setup_couch.sh15
4 files changed, 22 insertions, 10 deletions
diff --git a/.travis.yml b/.travis.yml
index 445be1a..232467c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,15 +2,9 @@ services:
- couchdb
notifications:
email: false
-before_script:
- - "mv config/couchdb.yml.admin config/couchdb.yml"
+before_script:
+ - "test/setup_couch.sh"
+ - "mv test/config/couchdb.yml.admin config/couchdb.yml"
- "bundle exec rake couchrest:migrate_with_proxies"
- "bundle exec rake couchrest:migrate_with_proxies" # looks like this needs to run twice
- - 'HOST="http://localhost:5984"'
- - "curl -HContent-Type:application/json -vXPUT $HOST/_users/org.couchdb.user:me --data-binary '{\"_id\": \"org.couchdb.user:me\",\"name\": \"me\",\"roles\": [],\"type\": \"user\",\"password\": \"pwd\"}'"
- - "curl -X PUT $HOST/sessions"
- - "curl -vX PUT $HOST/sessions/_security -Hcontent-type:application/json --data-binary '{\"admins\":{\"names\":[],\"roles\":[]},\"members\":{\"names\":[\"me\"],\"roles\":[]}}'"
- - "curl -vX PUT $HOST/users/_security -Hcontent-type:application/json --data-binary '{\"admins\":{\"names\":[],\"roles\":[]},\"members\":{\"names\":[\"me\"],\"roles\":[]}}'"
- - "curl -vX PUT $HOST/tickets/_security -Hcontent-type:application/json --data-binary '{\"admins\":{\"names\":[],\"roles\":[]},\"members\":{\"names\":[\"me\"],\"roles\":[]}}'"
- - "curl -X PUT $HOST/_config/admins/anna -d '\"secret\"'"
- - "mv config/couchdb.yml.user config/couchdb.yml"
+ - "mv test/config/couchdb.yml.user config/couchdb.yml"
diff --git a/config/couchdb.yml.admin b/test/config/couchdb.yml.admin
index d3cb72c..0988bc1 100644
--- a/config/couchdb.yml.admin
+++ b/test/config/couchdb.yml.admin
@@ -1,3 +1,6 @@
test:
auto_update_design_doc: false
+ username: "anna"
+ password: "secret"
prefix: ""
+
diff --git a/config/couchdb.yml.user b/test/config/couchdb.yml.user
index 9c8b67b..9c8b67b 100644
--- a/config/couchdb.yml.user
+++ b/test/config/couchdb.yml.user
diff --git a/test/setup_couch.sh b/test/setup_couch.sh
new file mode 100755
index 0000000..39e264f
--- /dev/null
+++ b/test/setup_couch.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+HOST="http://localhost:5984"
+echo "creating user :"
+curl -HContent-Type:application/json -XPUT $HOST/_users/org.couchdb.user:me --data-binary '{"_id": "org.couchdb.user:me","name": "me","roles": [],"type": "user","password": "pwd"}'
+echo "creating databases :"
+curl -X PUT $HOST/sessions
+curl -X PUT $HOST/users
+curl -X PUT $HOST/tickets
+echo "restricting database access :"
+curl -X PUT $HOST/sessions/_security -Hcontent-type:application/json --data-binary '{"admins":{"names":[],"roles":[]},"members":{"names":["me"],"roles":[]}}'
+curl -X PUT $HOST/users/_security -Hcontent-type:application/json --data-binary '{"admins":{"names":[],"roles":[]},"members":{"names":["me"],"roles":[]}}'
+curl -X PUT $HOST/tickets/_security -Hcontent-type:application/json --data-binary '{"admins":{"names":[],"roles":[]},"members":{"names":["me"],"roles":[]}}'
+echo "adding admin :"
+curl -X PUT $HOST/_config/admins/anna -d '"secret"'