浏览代码

Merge pull request #249 from phillipCouto/force_cover_target

Added testing coverage mandate to travis testing.
Ben Hood 11 年之前
父节点
当前提交
575bcb96db
共有 2 个文件被更改,包括 13 次插入2 次删除
  1. 6 1
      .travis.yml
  2. 7 1
      integration.sh

+ 6 - 1
.travis.yml

@@ -8,14 +8,19 @@ go:
   - 1.2
   - 1.3
 
-before_script:
+before_install:
+  - sudo apt-get update
+
+install:
   - sudo apt-get install -y libjna-java python-pip
   - sudo pip install cql PyYAML six
   - go get code.google.com/p/go.tools/cmd/vet
+  - go get code.google.com/p/go.tools/cmd/cover
   - git clone https://github.com/pcmanus/ccm.git
   - pushd ccm
   - sudo ./setup.py install
   - popd
+  - go get .
 
 script:
   - bash integration.sh $CASS

+ 7 - 1
integration.sh

@@ -20,8 +20,14 @@ function run_tests() {
 		proto=1
 	fi
 
-	go test -v -proto=$proto -rf=3 -cluster=$(ccm liveset) -clusterSize=$clusterSize -autowait=2000ms ./...
+	go test -cover -v -proto=$proto -rf=3 -cluster=$(ccm liveset) -clusterSize=$clusterSize -autowait=2000ms ./... > results
 
+	cat results
+	cover=`cat results | grep coverage: | grep -o "[0-9]\{1,3\}" | head -n 1`
+	if [[ $cover -lt "64" ]]; then
+		echo "--- FAIL: expected coverage of at least 64 %, but coverage was $cover %"
+		exit 1
+	fi
 	ccm clear
 }