Fix coverage job to compare proper git diff and make it more strict

Allow only 4 lines non covered by unit tets

Currently we are testing patch against master, instead of HEAD^
which produce issue when checked commit is not after current rebase.

master
  |
patch1
  |
patch2
  |
old_master <- your_patch

Proper way to check coverage is to do diff between
your_patch and old_master instead of master.

Change-Id: Ib0a177eafa9c7dcce799bde1c6b45d541fedde05
This commit is contained in:
Boris Pavlovic 2015-04-23 14:47:10 +03:00
parent 5268460642
commit 6756a82e1e

View File

@ -15,7 +15,7 @@
# License for the specific language governing permissions and limitations
# under the License.
ALLOWED_EXTRA_MISSING=8
ALLOWED_EXTRA_MISSING=4
show_diff () {
head -1 $1
@ -25,7 +25,8 @@ show_diff () {
# Stash uncommited changes, checkout master and save coverage report
uncommited=$(git status --porcelain | grep -v "^??")
[[ -n $uncommited ]] && git stash > /dev/null
git checkout master
git checkout HEAD^
baseline_report=$(mktemp -t rally_coverageXXXXXXX)
python setup.py testr --coverage --testr-args="$*"
coverage report > $baseline_report