if 'COVERAGE_ENABLED' in os.environ:
import coverage
- _cov = coverage.Coverage(config_file="{}/.coveragerc".format(os.path.dirname(__file__)))
- _cov.start()
+ __cov = coverage.Coverage(config_file="{}/.coveragerc".format(os.path.dirname(__file__)),
+ data_suffix=True)
+
+ cherrypy.engine.subscribe('start', __cov.start)
+ cherrypy.engine.subscribe('after_request', __cov.save)
+ cherrypy.engine.subscribe('stop', __cov.stop)
# pylint: disable=wrong-import-position
from . import logger, mgr
return os.path.join(current_dir, 'frontend/dist')
def serve(self):
- if 'COVERAGE_ENABLED' in os.environ:
- _cov.start()
-
AuthManager.initialize()
load_sso_db()
self.shutdown_event.clear()
NotificationQueue.stop()
cherrypy.engine.stop()
- if 'COVERAGE_ENABLED' in os.environ:
- _cov.stop()
- _cov.save()
logger.info('Engine stopped')
def shutdown(self):
read -r -d '' TEUTHOLOGY_PY_REQS <<EOF
apache-libcloud==2.2.1 \
asn1crypto==0.22.0 \
+backports.ssl-match-hostname==3.5.0.1 \
bcrypt==3.1.4 \
certifi==2018.1.18 \
cffi==1.10.0 \
fi
fi
-# export COVERAGE_ENABLED=true
-# export COVERAGE_FILE=.coverage.mgr.dashboard
-
cd $CURR_DIR
+
+ COVERAGE_VERSION=$(cat requirements.txt | grep coverage)
+ if [[ "$CEPH_MGR_PY_VERSION_MAJOR" == '3' ]]; then
+ pip3 install "$COVERAGE_VERSION"
+ else
+ pip install "$COVERAGE_VERSION"
+ fi
}
run_teuthology_tests() {
export RGW=1
fi
+ export COVERAGE_ENABLED=true
+ export COVERAGE_FILE=.coverage.mgr.dashboard
+ find . -iname "*${COVERAGE_FILE}*" -type f -delete
+
eval python ../qa/tasks/vstart_runner.py $OPTIONS $TEST_CASES
deactivate
cd "$BUILD_DIR"
killall ceph-mgr
sleep 10
+ if [[ "$COVERAGE_ENABLED" == 'true' ]]; then
+ source $TEMP_DIR/venv/bin/activate
+ (coverage combine && coverage report) || true
+ deactivate
+ fi
../src/stop.sh
sleep 5