diff options
-rw-r--r-- | jjb/armband/armband-ci-jobs.yml | 20 | ||||
-rw-r--r-- | jjb/compass4nfv/compass-verify-jobs.yml | 29 | ||||
-rw-r--r-- | jjb/dovetail/dovetail-ci-jobs.yml | 7 | ||||
-rwxr-xr-x | jjb/dovetail/dovetail-run.sh | 9 | ||||
-rwxr-xr-x | jjb/functest/functest-suite.sh | 4 | ||||
-rw-r--r-- | utils/test/testapi/docker/Dockerfile | 2 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/resources/scenario_handlers.py | 18 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/resources/scenario_models.py | 13 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/tests/unit/fake_pymongo.py | 1 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/tests/unit/scenario-create.json | 38 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/tests/unit/test_base.py | 17 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/tests/unit/test_scenario.py | 55 |
12 files changed, 174 insertions, 39 deletions
diff --git a/jjb/armband/armband-ci-jobs.yml b/jjb/armband/armband-ci-jobs.yml index 22e1dafba..723811fac 100644 --- a/jjb/armband/armband-ci-jobs.yml +++ b/jjb/armband/armband-ci-jobs.yml @@ -256,23 +256,23 @@ - trigger: name: 'fuel-os-odl_l2-nofeature-ha-armband-baremetal-master-trigger' triggers: - - timed: '0 0 * * 1' + - timed: '0 8 * * 1,3,5,7' - trigger: name: 'fuel-os-nosdn-nofeature-ha-armband-baremetal-master-trigger' triggers: - - timed: '0 0 * * 2' + - timed: '0 16 * * 2,7' - trigger: name: 'fuel-os-odl_l3-nofeature-ha-armband-baremetal-master-trigger' triggers: - - timed: '0 0 * * 3' + - timed: '0 16 * * 1,4,6' - trigger: name: 'fuel-os-odl_l2-bgpvpn-ha-armband-baremetal-master-trigger' triggers: - - timed: '0 0 * * 4' + - timed: '0 8 * * 2,4,6' - trigger: name: 'fuel-os-odl_l2-nofeature-noha-armband-baremetal-master-trigger' triggers: - - timed: '0 0 * * 5' + - timed: '0 16 * * 3,5' - trigger: name: 'fuel-os-odl_l2-sfc-ha-armband-baremetal-master-trigger' triggers: @@ -288,23 +288,23 @@ - trigger: name: 'fuel-os-odl_l2-nofeature-ha-armband-baremetal-colorado-trigger' triggers: - - timed: '0 8 * * 1,3,5,7' + - timed: '0 0 * * 1' - trigger: name: 'fuel-os-nosdn-nofeature-ha-armband-baremetal-colorado-trigger' triggers: - - timed: '0 16 * * 2,7' + - timed: '0 0 * * 2' - trigger: name: 'fuel-os-odl_l2-bgpvpn-ha-armband-baremetal-colorado-trigger' triggers: - - timed: '0 8 * * 2,4,6' + - timed: '0 0 * * 4' - trigger: name: 'fuel-os-odl_l3-nofeature-ha-armband-baremetal-colorado-trigger' triggers: - - timed: '0 16 * * 1,4,6' + - timed: '0 0 * * 3' - trigger: name: 'fuel-os-odl_l2-nofeature-noha-armband-baremetal-colorado-trigger' triggers: - - timed: '0 16 * * 3,5' + - timed: '0 0 * * 5' - trigger: name: 'fuel-os-odl_l2-sfc-ha-armband-baremetal-colorado-trigger' triggers: diff --git a/jjb/compass4nfv/compass-verify-jobs.yml b/jjb/compass4nfv/compass-verify-jobs.yml index 2277e92ab..8feda04e3 100644 --- a/jjb/compass4nfv/compass-verify-jobs.yml +++ b/jjb/compass4nfv/compass-verify-jobs.yml @@ -132,17 +132,24 @@ node-parameters: true kill-phase-on: FAILURE abort-all-job: true -# - multijob: -# name: smoke-test -# condition: SUCCESSFUL -# projects: -# - name: 'functest-compass-virtual-suite-{stream}' -# current-parameters: true -# predefined-parameters: -# FUNCTEST_SUITE_NAME=healthcheck -# node-parameters: true -# kill-phase-on: NEVER -# abort-all-job: true + - multijob: + name: smoke-test + condition: SUCCESSFUL + projects: + - name: 'functest-compass-virtual-suite-{stream}' + current-parameters: true + predefined-parameters: + FUNCTEST_SUITE_NAME=healthcheck + node-parameters: true + kill-phase-on: NEVER + abort-all-job: true + - name: 'functest-compass-virtual-suite-{stream}' + current-parameters: true + predefined-parameters: + FUNCTEST_SUITE_NAME=vping_ssh + node-parameters: true + kill-phase-on: NEVER + abort-all-job: true - job-template: name: 'compass-verify-{phase}-{distro}-{stream}' diff --git a/jjb/dovetail/dovetail-ci-jobs.yml b/jjb/dovetail/dovetail-ci-jobs.yml index 2b6ab7621..08eb5a5f1 100644 --- a/jjb/dovetail/dovetail-ci-jobs.yml +++ b/jjb/dovetail/dovetail-ci-jobs.yml @@ -227,13 +227,6 @@ - shell: !include-raw: ./dovetail-run.sh - -- builder: - name: dovetail-fetch-os-creds - builders: - - shell: - !include-raw: ../../utils/fetch_os_creds.sh - - builder: name: dovetail-cleanup builders: diff --git a/jjb/dovetail/dovetail-run.sh b/jjb/dovetail/dovetail-run.sh index 4cc03f7c9..0a2f156cc 100755 --- a/jjb/dovetail/dovetail-run.sh +++ b/jjb/dovetail/dovetail-run.sh @@ -66,9 +66,12 @@ if [ $(docker ps | grep "opnfv/dovetail:${DOCKER_TAG}" | wc -l) == 0 ]; then exit 1 fi -exec_cmd="python ${DOVETAIL_REPO_DIR}/dovetail/run.py --testsuite ${TESTSUITE} -d true" -echo "Container exec command: ${exec_cmd}" -docker exec ${container_id} ${exec_cmd} +list_cmd="dovetail list ${TESTSUITE}" +run_cmd="dovetail run --testsuite ${TESTSUITE} -d true" +echo "Container exec command: ${list_cmd}" +docker exec $container_id ${list_cmd} +echo "Container exec command: ${run_cmd}" +docker exec $container_id ${run_cmd} sudo cp -r ${DOVETAIL_REPO_DIR}/results ./ #To make sure the file owner is jenkins, for the copied results files in the above line diff --git a/jjb/functest/functest-suite.sh b/jjb/functest/functest-suite.sh index a30fb5973..9dc8deca0 100755 --- a/jjb/functest/functest-suite.sh +++ b/jjb/functest/functest-suite.sh @@ -12,3 +12,7 @@ else fi container_id=$(docker ps -a | grep opnfv/functest | awk '{print $1}' | head -1) docker exec $container_id $cmd + +ret_value=$? + +exit $ret_value diff --git a/utils/test/testapi/docker/Dockerfile b/utils/test/testapi/docker/Dockerfile index b0272e609..86513e05b 100644 --- a/utils/test/testapi/docker/Dockerfile +++ b/utils/test/testapi/docker/Dockerfile @@ -48,5 +48,5 @@ RUN git clone https://gerrit.opnfv.org/gerrit/releng /home/releng WORKDIR /home/releng/utils/test/testapi/ RUN pip install -r requirements.txt -RUN python setup.py install +RUN bash install.sh CMD ["bash", "docker/start-server.sh"] diff --git a/utils/test/testapi/opnfv_testapi/resources/scenario_handlers.py b/utils/test/testapi/opnfv_testapi/resources/scenario_handlers.py index 75754d8b9..7bf3d5d53 100644 --- a/utils/test/testapi/opnfv_testapi/resources/scenario_handlers.py +++ b/utils/test/testapi/opnfv_testapi/resources/scenario_handlers.py @@ -1,3 +1,4 @@ +from opnfv_testapi.common.constants import HTTP_FORBIDDEN from opnfv_testapi.resources.handlers import GenericApiHandler from opnfv_testapi.resources.scenario_models import Scenario from opnfv_testapi.tornado_swagger import swagger @@ -29,10 +30,23 @@ class ScenariosCLHandler(GenericScenarioHandler): """ @description: create a new scenario by name @param body: scenario to be created - @type body: L{string} + @type body: L{ScenarioCreateRequest} + @in body: body @rtype: L{CreateResponse} + @return 200: scenario is created. + @raise 403: scenario already exists + @raise 400: body or name not provided """ - pass + def query(data): + return {'name': data.name} + + def error(data): + message = '{} already exists as a scenario'.format(data.name) + return HTTP_FORBIDDEN, message + + miss_checks = ['name'] + db_checks = [(self.table, False, query, error)] + self._create(miss_checks=miss_checks, db_checks=db_checks) class ScenarioGURHandler(GenericScenarioHandler): diff --git a/utils/test/testapi/opnfv_testapi/resources/scenario_models.py b/utils/test/testapi/opnfv_testapi/resources/scenario_models.py index 0748a3738..b4bb3634b 100644 --- a/utils/test/testapi/opnfv_testapi/resources/scenario_models.py +++ b/utils/test/testapi/opnfv_testapi/resources/scenario_models.py @@ -61,6 +61,17 @@ class ScenarioInstaller(models.ModelBase): @swagger.model() +class ScenarioCreateRequest(models.ModelBase): + """ + @property installers: + @ptype installers: C{list} of L{ScenarioInstaller} + """ + def __init__(self, name='', installers=None): + self.name = name + self.installers = installers if installers else list() + + +@swagger.model() class Scenario(models.ModelBase): """ @property installers: @@ -69,7 +80,7 @@ class Scenario(models.ModelBase): def __init__(self, name='', create_date='', _id='', installers=None): self.name = name self._id = _id - self.create_date = create_date + self.creation_date = create_date self.installers = installers if installers else list() diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/fake_pymongo.py b/utils/test/testapi/opnfv_testapi/tests/unit/fake_pymongo.py index 3dd87e603..d86d8eadf 100644 --- a/utils/test/testapi/opnfv_testapi/tests/unit/fake_pymongo.py +++ b/utils/test/testapi/opnfv_testapi/tests/unit/fake_pymongo.py @@ -189,3 +189,4 @@ pods = MemDb() projects = MemDb() testcases = MemDb() results = MemDb() +scenarios = MemDb() diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/scenario-create.json b/utils/test/testapi/opnfv_testapi/tests/unit/scenario-create.json new file mode 100644 index 000000000..eba8b6c0a --- /dev/null +++ b/utils/test/testapi/opnfv_testapi/tests/unit/scenario-create.json @@ -0,0 +1,38 @@ +{ + "name": "nosdn-nofeature-ha", + "installers": + [ + { + "installer": "apex", + "versions": + [ + { + "owner": "Luke", + "version": "master", + "projects": + [ + { + "project": "functest", + "customs": [ "healthcheck", "vping_ssh"], + "scores": + [ + { + "date": "2017-01-08 22:46:44", + "score": "12/14" + } + + ], + "trust_indicators": [] + }, + { + "project": "yardstick", + "customs": [], + "scores": [], + "trust_indicators": [] + } + ] + } + ] + } + ] +}
\ No newline at end of file diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/test_base.py b/utils/test/testapi/opnfv_testapi/tests/unit/test_base.py index ff1a1932c..9343ab2fb 100644 --- a/utils/test/testapi/opnfv_testapi/tests/unit/test_base.py +++ b/utils/test/testapi/opnfv_testapi/tests/unit/test_base.py @@ -47,11 +47,11 @@ class TestBase(AsyncHTTPTestCase): return self.create_help(self.basePath, req, *args) def create_help(self, uri, req, *args): - if req: - req = req.format() + if req and not isinstance(req, str): + req = json.dumps(req.format()) res = self.fetch(self._update_uri(uri, *args), method='POST', - body=json.dumps(req), + body=req if req else json.dumps(None), headers=self.headers) return self._get_return(res, self.create_res) @@ -123,9 +123,17 @@ class TestBase(AsyncHTTPTestCase): self.assertIn(self.basePath, body.href) def assert_create_body(self, body, req=None, *args): + import inspect if not req: req = self.req_d - new_args = args + tuple([req.name]) + resource_name = '' + if inspect.isclass(req): + resource_name = req.name + elif isinstance(req, dict): + resource_name = req['name'] + elif isinstance(req, str): + resource_name = json.loads(req)['name'] + new_args = args + tuple([resource_name]) self.assertIn(self._get_uri(*new_args), body.href) @staticmethod @@ -134,3 +142,4 @@ class TestBase(AsyncHTTPTestCase): fake_pymongo.projects.clear() fake_pymongo.testcases.clear() fake_pymongo.results.clear() + fake_pymongo.scenarios.clear() diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/test_scenario.py b/utils/test/testapi/opnfv_testapi/tests/unit/test_scenario.py new file mode 100644 index 000000000..8e827813c --- /dev/null +++ b/utils/test/testapi/opnfv_testapi/tests/unit/test_scenario.py @@ -0,0 +1,55 @@ +import json +import os + +from opnfv_testapi.common.constants import HTTP_BAD_REQUEST +from opnfv_testapi.common.constants import HTTP_FORBIDDEN +from opnfv_testapi.common.constants import HTTP_OK +from opnfv_testapi.resources.scenario_models import ScenarioCreateRequest +from test_testcase import TestBase + + +class TestScenarioBase(TestBase): + def setUp(self): + super(TestScenarioBase, self).setUp() + self.basePath = '/api/v1/scenarios' + self.load_request('scenario-create.json') + + def tearDown(self): + pass + + def assert_body(self, project, req=None): + pass + + def load_request(self, f_req): + with open(os.path.join(os.path.dirname(__file__), f_req), 'r') as f: + self.req_d = json.dumps(json.load(f)) + f.close() + + +class TestScenarioCreate(TestScenarioBase): + def test_withoutBody(self): + (code, body) = self.create() + self.assertEqual(code, HTTP_BAD_REQUEST) + + def test_emptyName(self): + req_empty = ScenarioCreateRequest('') + (code, body) = self.create(req_empty) + self.assertEqual(code, HTTP_BAD_REQUEST) + self.assertIn('name missing', body) + + def test_noneName(self): + req_none = ScenarioCreateRequest(None) + (code, body) = self.create(req_none) + self.assertEqual(code, HTTP_BAD_REQUEST) + self.assertIn('name missing', body) + + def test_success(self): + (code, body) = self.create_d() + self.assertEqual(code, HTTP_OK) + self.assert_create_body(body) + + def test_alreadyExist(self): + self.create_d() + (code, body) = self.create_d() + self.assertEqual(code, HTTP_FORBIDDEN) + self.assertIn('already exists', body) |