couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gar...@apache.org
Subject [couchdb] branch master updated: run mango tests on travis (#753)
Date Wed, 16 Aug 2017 12:30:14 GMT
This is an automated email from the ASF dual-hosted git repository.

garren pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 61b215d  run mango tests on travis (#753)
61b215d is described below

commit 61b215d91982417259f7260b344554b8d25106d7
Author: garren smith <garren.smith@gmail.com>
AuthorDate: Wed Aug 16 14:30:12 2017 +0200

    run mango tests on travis (#753)
    
    Run's the mango tests after the js couchdb tests.
---
 .travis.yml                            |  8 +++++++-
 Makefile                               |  6 ++++++
 src/mango/test/01-index-crud-test.py   | 17 +++++++++++++++++
 test/build/test-run-couch-for-mango.sh | 25 +++++++++++++++++++++++++
 4 files changed, 55 insertions(+), 1 deletion(-)

diff --git a/.travis.yml b/.travis.yml
index c8ebb82..56a2b7d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -19,6 +19,7 @@ addons:
     - pkg-config
     - python-requests
     - python-sphinx
+    - python-virtualenv
 #    - sphinx-rtd-theme
     - help2man
     - shunit2
@@ -50,9 +51,14 @@ before_script:
   - rm -rf /tmp/couchjslogs
   - mkdir -p /tmp/couchjslogs
   - ./configure -c --disable-docs --disable-fauxton
+  - cd src/mango
+  - make venv
+  - source venv/bin/activate
+  - make pip-install
+  - cd ../..
 
 script:
-   - make check
+   - make check mango-test
 
 after_failure:
   - build-aux/logfile-uploader.py
diff --git a/Makefile b/Makefile
index 1fba02c..c1dd3a9 100644
--- a/Makefile
+++ b/Makefile
@@ -176,6 +176,12 @@ build-test:
 	@test/build/test-configure.sh
 
 
+.PHONY: mango-test
+# target: mango-test - Run Mango tests
+mango-test: all
+	./test/build/test-run-couch-for-mango.sh \
+
+
 ################################################################################
 # Developing
 ################################################################################
diff --git a/src/mango/test/01-index-crud-test.py b/src/mango/test/01-index-crud-test.py
index 342c94f..6582020 100644
--- a/src/mango/test/01-index-crud-test.py
+++ b/src/mango/test/01-index-crud-test.py
@@ -16,6 +16,9 @@ import mango
 import unittest
 
 class IndexCrudTests(mango.DbPerClass):
+    def setUp(self):
+        self.db.recreate()
+
     def test_bad_fields(self):
         bad_fields = [
             None,
@@ -92,6 +95,8 @@ class IndexCrudTests(mango.DbPerClass):
     def test_create_idx_01_exists(self):
         fields = ["foo", "bar"]
         ret = self.db.create_index(fields, name="idx_01")
+        assert ret is True
+        ret = self.db.create_index(fields, name="idx_01")
         assert ret is False
 
     def test_create_idx_02(self):
@@ -106,6 +111,8 @@ class IndexCrudTests(mango.DbPerClass):
         raise AssertionError("index not created")
 
     def test_read_idx_doc(self):
+        self.db.create_index(["foo", "bar"], name="idx_01")
+        self.db.create_index(["hello", "bar"])
         for idx in self.db.list_indexes():
             if idx["type"] == "special":
                 continue
@@ -116,6 +123,7 @@ class IndexCrudTests(mango.DbPerClass):
             assert info["name"] == ddocid.split('_design/')[-1]
 
     def test_delete_idx_escaped(self):
+        self.db.create_index(["foo", "bar"], name="idx_01")
         pre_indexes = self.db.list_indexes()
         ret = self.db.create_index(["bing"], name="idx_del_1")
         assert ret is True
@@ -205,6 +213,7 @@ class IndexCrudTests(mango.DbPerClass):
             raise AssertionError("bad index delete")
 
         # Missing view name
+        ret = self.db.create_index(["fields"], name="idx_01")
         indexes = self.db.list_indexes()
         not_special = [idx for idx in indexes if idx["type"] != "special"]
         idx = random.choice(not_special)
@@ -279,6 +288,14 @@ class IndexCrudTests(mango.DbPerClass):
         ret = self.db.create_index(fields, name="idx_03")
         assert ret is True
 
+        fields = ["field4"]
+        ret = self.db.create_index(fields, name="idx_04")
+        assert ret is True
+
+        fields = ["field5"]
+        ret = self.db.create_index(fields, name="idx_05")
+        assert ret is True
+
         skip_add = 0
 
         if mango.has_text_service():
diff --git a/test/build/test-run-couch-for-mango.sh b/test/build/test-run-couch-for-mango.sh
new file mode 100755
index 0000000..3decdec
--- /dev/null
+++ b/test/build/test-run-couch-for-mango.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+./dev/run -n 1 --admin=testuser:testpass &
+export SERVER_PID=$!
+sleep 10
+curl http://dev:15984
+cd src/mango/ 
+nosetests
+
+EXIT_STATUS=$?
+if [[ ! -z $SERVER_PID ]]; then
+  kill $SERVER_PID
+fi
+exit $EXIT_STATUS
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
['"commits@couchdb.apache.org" <commits@couchdb.apache.org>'].

Mime
View raw message