Bottlenecks: unittest job added 25/21425/2
authorMatthewLi <matthew.lijun@huawei.com>
Mon, 19 Sep 2016 11:59:52 +0000 (07:59 -0400)
committerMatthewLi <matthew.lijun@huawei.com>
Mon, 19 Sep 2016 12:09:29 +0000 (08:09 -0400)
unittest script shown in https://git.opnfv.org/cgit/bottlenecks/tree/tests.sh
only flake8 is included by now

Change-Id: I1962cd5e44300fc9bd792c3221663e186223d885
Signed-off-by: MatthewLi <matthew.lijun@huawei.com>
jjb/bottlenecks/bottlenecks-project-jobs.yml

index fffc22d..ca2fa40 100644 (file)
@@ -71,9 +71,7 @@
                   - branch-compare-type: 'ANT'
                     branch-pattern: '**/{branch}'
     builders:
-         - shell: |
-             echo "bottlenecks: verify job"
-         #TO DO: this should be changed when the unittest ready
+        - bottlenecks-unit-tests
 
 - job-template:
     name: 'bottlenecks-merge-{stream}'
                       branch-pattern: '**/{branch}'
 
     builders:
-         - shell: |
-             echo "bottlenecks: merge"
+        - bottlenecks-unit-tests
 
 - job-template:
     name: 'bottlenecks-{suite}-upload-artifacts-{stream}'
             echo "Bottlenecks: cleanup cache used for storage downloaded packages"
 
             /bin/rm -rf $CACHE_DIR
+
+- builder:
+    name: bottlenecks-unit-tests
+    builders:
+        - shell: |
+            #!/bin/bash
+            set -o errexit
+            set -o pipefail
+
+            echo "Running unit tests..."
+            cd $WORKSPACE
+            virtualenv $WORKSPACE/bottlenecks_venv
+            source $WORKSPACE/bottlenecks_venv/bin/activate
+
+            # install python packages
+            easy_install -U setuptools
+            easy_install -U pip
+            pip install -r requirements.txt
+
+            # unit tests
+            ./tests.sh
+
+            deactivate