blob: 6d1693956d496647b79de81896cda14c6376a5a5 [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
Zack Williams38e8cdb2018-05-31 12:36:27 -070065 pip install grpcio==1.9.1
66 pip install grpcio-tools==1.9.1
Kailash Khalasie6f414c2018-05-14 13:40:36 -070067 echo "Requirements Installed"
68
69 cd $BASEDIR/cord/orchestration/xos/lib/xos-util; python setup.py install; echo "xos-util Installed"
70 cd $BASEDIR/cord/orchestration/xos/lib/xos-config; python setup.py install; echo "xos-config Installed"
71 cd $BASEDIR/cord/orchestration/xos/lib/xos-genx; python setup.py install; echo "xos-genx Installed"
Zack Williams35d92482018-05-31 12:17:53 -070072
73 cd $BASEDIR/cord/orchestration/xos/xos/xos_client/xosapi; ln -s ../../../../../component/chameleon chameleon
Zack Williamsa834c342018-05-31 11:30:15 -070074 cd $BASEDIR/cord/orchestration/xos/xos/xos_client; make; echo "xos-client Installed"
Kailash Khalasie6f414c2018-05-14 13:40:36 -070075
76 # Run the tests
Kailash Khalasif4f484c2018-05-25 14:08:01 -070077 if [ $GERRIT_PROJECT = 'xos' ] ; then
78 cd $BASEDIR
79 else
80 cd $BASEDIR/cord/orchestration/xos_services/$GERRIT_PROJECT/xos
81 fi
Kailash Khalasie6f414c2018-05-14 13:40:36 -070082 nose2 --verbose --exclude-ignored-files