3cT1qPwc7LhCgNm63a9aSg changeset

Changeset333366616534 (b)
ParentNone (a)
ab
0+#!/bin/sh -ex
0+
0+cd /tmp
0+TESTDIR=couchdb-upgrade-1.0-to-1.1
0+mkdir -p $TESTDIR
0+cd $TESTDIR
0+
0+mkdir -p src
0+mkdir -p 1.0
0+mkdir -p 1.1
0+
0+cd src
0+
0+if [ ! -d couchdb ]; then
0+  git clone git://git.apache.org/couchdb.git --depth=1
0+fi
0+
0+cd couchdb
0+
0+# build 1.0.x
0+git checkout 1.0.x
0+./bootstrap
0+./configure --prefix=/tmp/$TESTDIR/1.0
0+make -j4
0+make install
0+
0+# build 1.1.x
0+git checkout 1.1.x
0+./bootstrap
0+./configure --prefix=/tmp/$TESTDIR/1.1
0+make -j4
0+make install
0+
0+cd ../..
0+cd 1.0
0+
0+# launch 1.0
0+echo "[couchdb]" > llocal.ini
0+echo "delayed_commits=false" >> llocal.ini
0+echo "" >> llocal.ini
0+./bin/couchdb -b -a llocal.ini
0+
0+cd ..
0+cd 1.1
0+
0+# launch 1.1
0+echo "[couchdb]" > llocal.ini
0+echo "delayed_commits=false" >> llocal.ini
0+echo "[httpd]" >> llocal.ini
0+echo "port=5985" >> llocal.ini
0+echo "" >> llocal.ini
0+./bin/couchdb -b -a llocal.ini
0+
0+sleep 2
0+cd ..
0+
0+# create test db in 1.0
0+
0+COUCH10=http://127.0.0.1:5984
0+curl -X PUT $COUCH10/test-db
0+curl -X PUT $COUCH10/test-db/test-doc/attachment.txt \
0+  -H "Content-Type: text/plain" \
0+  -d "My Hovercraft is full of eels"
0+RESULT=`curl $COUCH10/test-db/test-doc/attachment.txt`
0+if [ "$RESULT" = "My Hovercraft is full of eels" ]; then
0+  echo "PASS SETUP"
0+else
0+  echo "FAIL SETUP"
0+fi
0+
0+# copy test db to 1.1
0+cp 1.0/var/lib/couchdb/test-db.couch 1.1/var/lib/couchdb/test-db.couch
0+
0+# compact with 1.1
0+COUCH11=http://127.0.0.1:5985
0+curl -X POST $COUCH11/test-db/_compact -H "Content-Type: application/json"
0+
0+# validate test db
0+
0+RESULT=`curl $COUCH11/test-db/test-doc/attachment.txt`
0+if [ "$RESULT" = "My Hovercraft is full of eels" ]; then
0+  echo "PASS SETUP"
0+else
0+  echo "FAIL VALIDATION"
0+fi
0+
0+
0+# shutdown couches
0+
0+cd /tmp/$TESTDIR
0+
0+cd 1.0
0+./bin/couchdb -d
0+
0+cd ..
0+cd 1.1
0+./bin/couchdb -d
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
--- Revision None
+++ Revision 333366616534
@@ -0,0 +1,97 @@
+#!/bin/sh -ex
+
+cd /tmp
+TESTDIR=couchdb-upgrade-1.0-to-1.1
+mkdir -p $TESTDIR
+cd $TESTDIR
+
+mkdir -p src
+mkdir -p 1.0
+mkdir -p 1.1
+
+cd src
+
+if [ ! -d couchdb ]; then
+ git clone git://git.apache.org/couchdb.git --depth=1
+fi
+
+cd couchdb
+
+# build 1.0.x
+git checkout 1.0.x
+./bootstrap
+./configure --prefix=/tmp/$TESTDIR/1.0
+make -j4
+make install
+
+# build 1.1.x
+git checkout 1.1.x
+./bootstrap
+./configure --prefix=/tmp/$TESTDIR/1.1
+make -j4
+make install
+
+cd ../..
+cd 1.0
+
+# launch 1.0
+echo "[couchdb]" > llocal.ini
+echo "delayed_commits=false" >> llocal.ini
+echo "" >> llocal.ini
+./bin/couchdb -b -a llocal.ini
+
+cd ..
+cd 1.1
+
+# launch 1.1
+echo "[couchdb]" > llocal.ini
+echo "delayed_commits=false" >> llocal.ini
+echo "[httpd]" >> llocal.ini
+echo "port=5985" >> llocal.ini
+echo "" >> llocal.ini
+./bin/couchdb -b -a llocal.ini
+
+sleep 2
+cd ..
+
+# create test db in 1.0
+
+COUCH10=http://127.0.0.1:5984
+curl -X PUT $COUCH10/test-db
+curl -X PUT $COUCH10/test-db/test-doc/attachment.txt \
+ -H "Content-Type: text/plain" \
+ -d "My Hovercraft is full of eels"
+RESULT=`curl $COUCH10/test-db/test-doc/attachment.txt`
+if [ "$RESULT" = "My Hovercraft is full of eels" ]; then
+ echo "PASS SETUP"
+else
+ echo "FAIL SETUP"
+fi
+
+# copy test db to 1.1
+cp 1.0/var/lib/couchdb/test-db.couch 1.1/var/lib/couchdb/test-db.couch
+
+# compact with 1.1
+COUCH11=http://127.0.0.1:5985
+curl -X POST $COUCH11/test-db/_compact -H "Content-Type: application/json"
+
+# validate test db
+
+RESULT=`curl $COUCH11/test-db/test-doc/attachment.txt`
+if [ "$RESULT" = "My Hovercraft is full of eels" ]; then
+ echo "PASS SETUP"
+else
+ echo "FAIL VALIDATION"
+fi
+
+
+# shutdown couches
+
+cd /tmp/$TESTDIR
+
+cd 1.0
+./bin/couchdb -d
+
+cd ..
+cd 1.1
+./bin/couchdb -d