blob: 3ac10ed39056305cca92eddbf84114c63428cfc2 [file] [log] [blame]
Kailash Khalasie6f414c2018-05-14 13:40:36 -07001---
2# xos unit test
3
4- job-template:
5 id: 'xos-unit-test'
Kailash Khalasi38cb5cd2018-05-16 09:49:15 -07006 name: 'verify_{project}_unit-test'
Kailash Khalasie6f414c2018-05-14 13:40:36 -07007
8 description: |
9 Created by {id} job-template from ci-management/jjb/xos-unit.yaml
10
11 triggers:
12 - cord-infra-gerrit-trigger-patchset:
13 gerrit-server-name: '{gerrit-server-name}'
14 project-regexp: '^{project}$'
15 branch-regexp: '{branch-regexp}'
16 dependency-jobs: '{dependency-jobs}'
17 file-include-regexp: '{all-files-regexp}'
18
19 properties:
20 - cord-infra-properties:
21 build-days-to-keep: '{build-days-to-keep}'
22 artifact-num-to-keep: '{artifact-num-to-keep}'
23
24 wrappers:
25 - lf-infra-wrappers:
26 build-timeout: 20
27 jenkins-ssh-credential: '{jenkins-ssh-credential}'
28
29 scm:
30 - lf-infra-gerrit-scm:
31 git-url: '$GIT_URL/$GERRIT_PROJECT'
32 refspec: '$GERRIT_REFSPEC'
33 branch: '$GERRIT_BRANCH'
34 submodule-recursive: 'false'
35 choosing-strategy: gerrit
36 jenkins-ssh-credential: '{jenkins-ssh-credential}'
37
38 node: 'ubuntu16.04-basebuild-1c-2g'
39 project-type: freestyle
40 concurrent: true
41
42 builders:
43 - shell: |
44 #/usr/bin/env bash
45 BASEDIR=$(pwd)
46
47 # setup virtual env
48 virtualenv -q venv-xos --no-site-packages
49 source $BASEDIR/venv-xos/bin/activate
50 pip install --upgrade pip setuptools
51
52 # download changeset
53 mkdir cord && cd cord/
54 repo init -u https://gerrit.opencord.org/manifest -b $GERRIT_BRANCH
55 repo sync
56 repo download $GERRIT_PROJECT $GERRIT_CHANGE_NUMBER/$GERRIT_PATCHSET_NUMBER
57
58 # Install XOS dependencies
Kailash Khalasi206e90a2018-05-15 14:57:51 -070059 pip install nose2 requests_mock plyxproto jinja2 pattern astunparse pyyaml colorama
60 pip install pykwalify==1.6.1
61 pip install multistructlog==1.5
Kailash Khalasi4f04d632018-05-24 10:23:27 -070062 pip install networkx==1.11
63 pip install netaddr==0.7.19
64 pip install ipaddress==1.0.19
Kailash Khalasie6f414c2018-05-14 13:40:36 -070065 echo "Requirements Installed"
66
67 cd $BASEDIR/cord/orchestration/xos/lib/xos-util; python setup.py install; echo "xos-util Installed"
68 cd $BASEDIR/cord/orchestration/xos/lib/xos-config; python setup.py install; echo "xos-config Installed"
69 cd $BASEDIR/cord/orchestration/xos/lib/xos-genx; python setup.py install; echo "xos-genx Installed"
70
71 # Run the tests
Kailash Khalasif4f484c2018-05-25 14:08:01 -070072 if [ $GERRIT_PROJECT = 'xos' ] ; then
73 cd $BASEDIR
74 else
75 cd $BASEDIR/cord/orchestration/xos_services/$GERRIT_PROJECT/xos
76 fi
Kailash Khalasie6f414c2018-05-14 13:40:36 -070077 nose2 --verbose --exclude-ignored-files