* Fixed unit test runner (upstream script ./setup-test-env-mongodb.sh isn't
authorThomas Goirand <thomas@goirand.fr>
Tue, 22 Mar 2016 17:01:50 +0000 (17:01 +0000)
committerThomas Goirand <thomas@goirand.fr>
Tue, 22 Mar 2016 17:05:32 +0000 (17:05 +0000)
    available anymore: using one in the debian folder).

Rewritten-From: fc1760007700bac46e7b62ccb03caffb10d60e28

xenial/debian/changelog
xenial/debian/rules
xenial/debian/setup-test-env-mongodb.sh [new file with mode: 0755]

index 676c728011d632752535f37052ca4d922aabd708..0de2be2e2db00850f6a03663d48ab6ab4935396b 100644 (file)
@@ -3,6 +3,8 @@ ceilometer (1:6.0.0~rc1-1) experimental; urgency=medium
   * New upstream release.
   * Added git to build-depends-indep.
   * Fixed (build-)depends for this release.
+  * Fixed unit test runner (upstream script ./setup-test-env-mongodb.sh isn't
+    available anymore: using one in the debian folder).
 
  -- Thomas Goirand <zigo@debian.org>  Thu, 10 Mar 2016 13:17:08 +0100
 
index c922c23c28e68a2ea6e2fbd3e1dd2d8983fd52d6..a6374839ec86562b3b4eb87dedfbe9a4390c2f36 100755 (executable)
@@ -54,7 +54,7 @@ ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
        testr init
        set -e ; \
                TEMP_REZ=`mktemp -t` ; \
-               bash -x ./setup-test-env-mongodb.sh testr run --subunit 'tests\.(?!(.*test_bin.*|.*functional.*|.*gabbi\.test_gabbi_prefix.*|.*meter\.test_notifications\.TestMeterProcessing\.test_fallback_meter_path.*))' | tee $$TEMP_REZ | subunit2pyunit ; \
+               bash -x ./debian/setup-test-env-mongodb.sh testr run --subunit 'tests\.(?!(.*test_bin.*|.*functional.*|.*gabbi\.test_gabbi_prefix.*|.*meter\.test_notifications\.TestMeterProcessing\.test_fallback_meter_path.*))' | tee $$TEMP_REZ | subunit2pyunit ; \
                cat $$TEMP_REZ | subunit-filter -s --no-passthrough | subunit-stats ; \
                rm -f $$TEMP_REZ ;
        testr slowest
diff --git a/xenial/debian/setup-test-env-mongodb.sh b/xenial/debian/setup-test-env-mongodb.sh
new file mode 100755 (executable)
index 0000000..62e4fcc
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/bash
+set -e
+
+source functions.sh
+
+if [ "$1" = "--coverage" ]; then
+       COVERAGE_ARG="$1"
+       shift
+fi
+
+export PATH=${PATH:+$PATH:}/sbin:/usr/sbin
+check_for_cmd mongod
+
+# Start MongoDB process for tests
+MONGO_DATA=`mktemp -d /tmp/CEILO-MONGODB-XXXXX`
+MONGO_PORT=29000
+trap "clean_exit ${MONGO_DATA}" EXIT
+mkfifo ${MONGO_DATA}/out
+mongod --maxConns 32 --nojournal --noprealloc --smallfiles --quiet --noauth --port ${MONGO_PORT} --dbpath "${MONGO_DATA}" --bind_ip localhost --config /dev/null &>${MONGO_DATA}/out &
+# Wait for Mongo to start listening to connections
+wait_for_line "waiting for connections on port ${MONGO_PORT}" ${MONGO_DATA}/out
+# Read the fifo for ever otherwise mongod would block
+cat ${MONGO_DATA}/out > /dev/null &
+export CEILOMETER_TEST_STORAGE_URL="mongodb://localhost:${MONGO_PORT}/ceilometer"
+
+# Yield execution to venv command
+OS_TEST_PATH=./ceilometer/tests/unit $*