diff options
author | garren smith <garren.smith@gmail.com> | 2017-08-16 14:30:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-16 14:30:12 +0200 |
commit | 61b215d91982417259f7260b344554b8d25106d7 (patch) | |
tree | ccfda2d55eb24b73b0650fc0ebef9c29aa477049 | |
parent | 89e99e54d2d3f7536378082d41506c3a1756137f (diff) | |
download | couchdb-61b215d91982417259f7260b344554b8d25106d7.tar.gz |
run mango tests on travis (#753)
Run's the mango tests after the js couchdb tests.
-rw-r--r-- | .travis.yml | 8 | ||||
-rw-r--r-- | Makefile | 6 | ||||
-rw-r--r-- | src/mango/test/01-index-crud-test.py | 17 | ||||
-rwxr-xr-x | test/build/test-run-couch-for-mango.sh | 25 |
4 files changed, 55 insertions, 1 deletions
diff --git a/.travis.yml b/.travis.yml index c8ebb824f..56a2b7d71 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 @@ -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 342c94f9b..6582020f5 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 000000000..3decdecbb --- /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 |