From e97a5ce265f7e1d3380fab9c4132e2b002e8636c Mon Sep 17 00:00:00 2001 From: Michal Jagiello Date: Mon, 27 Jul 2020 10:02:19 +0000 Subject: Run in Python 3.8 Use image recommended by SECCOM Issue-ID: DCAEGEN2-2292 Signed-off-by: Michal Jagiello Change-Id: I8d77f150c9fe314bf26bac2c9fac7ebc9782c9d8 --- Dockerfile | 58 ++++++++++++++------------- miss_htbt_service/cbs_polling.py | 7 ++-- miss_htbt_service/config_notif.py | 7 ++-- miss_htbt_service/db_monitoring.py | 7 ++-- miss_htbt_service/htbtworker.py | 5 ++- miss_htbt_service/misshtbt.sh | 8 ++-- miss_htbt_service/misshtbtd.py | 29 +++++++------- miss_htbt_service/mod/trapd_exit.py | 3 +- miss_htbt_service/mod/trapd_get_cbs_config.py | 7 ++-- miss_htbt_service/mod/trapd_io.py | 5 ++- miss_htbt_service/mod/trapd_vnf_table.py | 13 +++--- mvn-phase-script.sh | 2 +- pom.xml | 2 +- requirements.txt | 3 +- setup.py | 6 +-- tests/test_config_notif.py | 25 ++++++------ tests/test_trapd_vnf_table.py | 11 ++--- tox.ini | 4 +- version.properties | 2 +- 19 files changed, 110 insertions(+), 94 deletions(-) diff --git a/Dockerfile b/Dockerfile index dd687c9..fee54d1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,17 @@ -FROM python:3.6 +FROM python:3.8.2-alpine3.11 MAINTAINER gs244f@att.com -ENV INSROOT /opt/app -ENV APPUSER misshtbt -ENV APPDIR ${INSROOT}/${APPUSER} +ARG user=onap +ARG group=onap -RUN useradd -d ${APPDIR} ${APPUSER} - -WORKDIR ${APPDIR} +RUN addgroup -S $group && adduser -S -D -h /home/$user $user $group && \ + chown -R $user:$group /home/$user && \ + mkdir /var/log/$user && \ + chown -R $user:$group /var/log/$user && \ + mkdir /app && \ + chown -R $user:$group /app + +WORKDIR /app #ADD . /tmp #RUN mkdir /tmp/config @@ -20,27 +24,27 @@ COPY requirements.txt ./ COPY setup.py ./ #need pip > 8 to have internal pypi repo in requirements.txt -RUN pip install --upgrade pip #do the install -#WORKDIR /tmp -RUN pip install pyyaml --upgrade -RUN pip install -r requirements.txt -RUN pip install -e . - -RUN mkdir -p ${APPDIR}/data \ - && mkdir -p ${APPDIR}/logs \ - && mkdir -p ${APPDIR}/tmp \ - && chown -R ${APPUSER}:${APPUSER} ${APPDIR} \ - && chmod a+w ${APPDIR}/data \ - && chmod a+w ${APPDIR}/logs \ - && chmod a+w ${APPDIR}/tmp \ - && chmod a+w ${APPDIR}/etc \ - && chmod 500 ${APPDIR}/bin/*.py \ - && chmod 500 ${APPDIR}/bin/*.sh \ - && chmod 500 ${APPDIR}/bin/*/*.py - -USER ${APPUSER} -VOLUME ${APPDIR}/logs +RUN apk add build-base libffi-dev postgresql-dev && \ + pip install --upgrade pip && \ + pip install pyyaml --upgrade && \ + pip install -r requirements.txt && \ + pip install -e . + +RUN mkdir -p data \ + && mkdir -p logs \ + && mkdir -p tmp \ + && chown -R $user:$group . \ + && chmod a+w data \ + && chmod a+w logs \ + && chmod a+w tmp \ + && chmod a+w etc \ + && chmod 500 bin/*.py \ + && chmod 500 bin/*.sh \ + && chmod 500 bin/*/*.py + +USER $user +VOLUME logs CMD ["./bin/misshtbt.sh"] diff --git a/miss_htbt_service/cbs_polling.py b/miss_htbt_service/cbs_polling.py index 7d19610..1b9d00c 100644 --- a/miss_htbt_service/cbs_polling.py +++ b/miss_htbt_service/cbs_polling.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 # Copyright 2018-2020 AT&T Intellectual Property, Inc. All rights reserved. # Copyright (c) 2019 Pantheon.tech. All rights reserved. +# Copyright 2020 Deutsche Telekom. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -26,9 +27,9 @@ import sys import os import socket import logging -from . import htbtworker as pm -from . import misshtbtd as db -from . import get_logger +import htbtworker as pm +import misshtbtd as db +import get_logger _logger = get_logger.get_logger(__name__) diff --git a/miss_htbt_service/config_notif.py b/miss_htbt_service/config_notif.py index 6b54bad..b420dc2 100644 --- a/miss_htbt_service/config_notif.py +++ b/miss_htbt_service/config_notif.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 # Copyright 2018-2020 AT&T Intellectual Property, Inc. All rights reserved. # Copyright (c) 2019 Pantheon.tech. All rights reserved. +# Copyright 2020 Deutsche Telekom. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -28,10 +29,10 @@ import json import psycopg2 from pathlib import Path import os.path as path -from .mod import trapd_settings as tds +import mod.trapd_settings as tds # use the fully qualified name here to let monkeypatching work # from .mod.trapd_get_cbs_config import get_cbs_config -import miss_htbt_service.mod.trapd_get_cbs_config +import mod.trapd_get_cbs_config hb_properties_file = path.abspath(path.join(__file__, "../config/hbproperties.yaml")) @@ -169,7 +170,7 @@ def update_hb_common(update_flg, process_id, state, user_name,password,ip_addres def fetch_json_file(download_json = "../etc/download1.json", config_json = "../etc/config.json"): # use the fully qualified name here to let monkeypatching work # if get_cbs_config(): - if miss_htbt_service.mod.trapd_get_cbs_config.get_cbs_config(): + if mod.trapd_get_cbs_config.get_cbs_config(): current_runtime_config_file_name = download_json envPytest = os.getenv('pytest', "") if (envPytest == 'test'): diff --git a/miss_htbt_service/db_monitoring.py b/miss_htbt_service/db_monitoring.py index 6ab7732..0c59772 100644 --- a/miss_htbt_service/db_monitoring.py +++ b/miss_htbt_service/db_monitoring.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 # Copyright 2018-2020 AT&T Intellectual Property, Inc. All rights reserved. # Copyright (c) 2019 Pantheon.tech. All rights reserved. +# Copyright 2020 Deutsche Telekom. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -28,9 +29,9 @@ import os import logging import socket import requests -from . import htbtworker as pm -from . import misshtbtd as db -from . import get_logger +import htbtworker as pm +import misshtbtd as db +import get_logger _logger = get_logger.get_logger(__name__) diff --git a/miss_htbt_service/htbtworker.py b/miss_htbt_service/htbtworker.py index db0561f..9472473 100644 --- a/miss_htbt_service/htbtworker.py +++ b/miss_htbt_service/htbtworker.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 # Copyright 2018-2020 AT&T Intellectual Property, Inc. All rights reserved. # Copyright (c) 2019 Pantheon.tech. All rights reserved. +# Copyright 2020 Deutsche Telekom. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -25,8 +26,8 @@ import os import os.path as path import json,sys,time import logging -from . import misshtbtd as db -from . import get_logger +import misshtbtd as db +import get_logger _logger = get_logger.get_logger(__name__) diff --git a/miss_htbt_service/misshtbt.sh b/miss_htbt_service/misshtbt.sh index df453b4..c93da98 100644 --- a/miss_htbt_service/misshtbt.sh +++ b/miss_htbt_service/misshtbt.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh # # ============LICENSE_START======================================================= # org.onap.dcae @@ -19,13 +19,13 @@ # ============LICENSE_END========================================================= # get to where we are supposed to be for startup -cd /opt/app/misshtbt/bin +cd /app/bin # include path to 3.6+ version of python that has required dependencies included -export PATH=/usr/local/lib/python3.6/bin:$PATH:/opt/app/misshtbt/bin +export PATH=/usr/local/lib/python3.8/bin:$PATH:/app/bin # expand search for python modules to include ./mod in runtime dir -export PYTHONPATH=/usr/local/lib/python3.6/site-packages:./mod:./:$PYTHONPATH:/opt/app/misshtbt/bin +export PYTHONPATH=/usr/local/lib/python3.8/site-packages:./mod:./:$PYTHONPATH:/app/bin # set location of SSL certificates export REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-bundle.crt diff --git a/miss_htbt_service/misshtbtd.py b/miss_htbt_service/misshtbtd.py index c56ad99..0edc76e 100644 --- a/miss_htbt_service/misshtbtd.py +++ b/miss_htbt_service/misshtbtd.py @@ -2,6 +2,7 @@ # ============LICENSE_START======================================================= # Copyright (c) 2017-2020 AT&T Intellectual Property. All rights reserved. # Copyright (c) 2019 Pantheon.tech. All rights reserved. +# Copyright 2020 Deutsche Telekom. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -39,13 +40,13 @@ import socket import os.path as path from pathlib import Path -from . import htbtworker as heartbeat -from . import get_logger -from .mod import trapd_settings as tds -from .mod.trapd_runtime_pid import save_pid, rm_pid -from .mod.trapd_get_cbs_config import get_cbs_config -from .mod.trapd_exit import cleanup_and_exit -from .mod.trapd_http_session import init_session_obj +import htbtworker as heartbeat +import get_logger +from mod import trapd_settings as tds +from mod.trapd_runtime_pid import save_pid, rm_pid +from mod.trapd_get_cbs_config import get_cbs_config +from mod.trapd_exit import cleanup_and_exit +from mod.trapd_http_session import init_session_obj hb_properties_file = path.abspath(path.join(__file__, "../config/hbproperties.yaml")) ip_address = "localhost" @@ -196,18 +197,18 @@ def create_update_vnf_table_1(jsfile,update_db,connection_db): def hb_cbs_polling_process(pid_current): my_file = Path("./miss_htbt_service/cbs_polling.py") # if my_file.is_file(): - subprocess.call(["python3.6",ABSOLUTE_PATH4 , str(pid_current) ]) + subprocess.call(["python3.8",ABSOLUTE_PATH4 , str(pid_current) ]) # else: -# subprocess.call(["python3.6",ABSOLUTE_PATH4 , str(pid_current) ]) +# subprocess.call(["python3.8",ABSOLUTE_PATH4 , str(pid_current) ]) sys.stdout.flush() _logger.info("MSHBT:Creaated CBS polling process") return def hb_worker_process(config_file_path): my_file = Path("./miss_htbt_service/htbtworker.py") # if my_file.is_file(): - subprocess.call(["python3.6",ABSOLUTE_PATH1 , config_file_path ]) + subprocess.call(["python3.8",ABSOLUTE_PATH1 , config_file_path ]) # else: -# subprocess.call(["python3.6",ABSOLUTE_PATH1 , config_file_path ]) +# subprocess.call(["python3.8",ABSOLUTE_PATH1 , config_file_path ]) sys.stdout.flush() _logger.info("MSHBT:Creaated Heartbeat worker process") return @@ -215,9 +216,9 @@ def hb_worker_process(config_file_path): def db_monitoring_process(current_pid,jsfile): my_file = Path("./miss_htbt_service/db_monitoring.py") # if my_file.is_file(): - subprocess.call(["python3.6",ABSOLUTE_PATH2 , str(current_pid),jsfile]) + subprocess.call(["python3.8",ABSOLUTE_PATH2 , str(current_pid),jsfile]) # else: -# subprocess.call(["python3.6",ABSOLUTE_PATH2 , str(current_pid),jsfile]) +# subprocess.call(["python3.8",ABSOLUTE_PATH2 , str(current_pid),jsfile]) sys.stdout.flush() _logger.info("MSHBT:Creaated DB Monitoring process") return @@ -339,7 +340,7 @@ _logger = get_logger.get_logger(__name__) def main(): try: - p = subprocess.Popen(['python3.6',ABSOLUTE_PATH3],stdout=subprocess.PIPE,stderr=subprocess.STDOUT) + p = subprocess.Popen(['python3.8',ABSOLUTE_PATH3],stdout=subprocess.PIPE,stderr=subprocess.STDOUT) _logger.info("MSHBD:Execution Started") job_list = [] pid_current = os.getpid() diff --git a/miss_htbt_service/mod/trapd_exit.py b/miss_htbt_service/mod/trapd_exit.py index b1bd68f..c741fe5 100644 --- a/miss_htbt_service/mod/trapd_exit.py +++ b/miss_htbt_service/mod/trapd_exit.py @@ -3,6 +3,7 @@ # ================================================================================ # Copyright (c) 2017-2020 AT&T Intellectual Property. All rights reserved. # Copyright (c) 2019 Pantheon.tech. All rights reserved. +# Copyright 2020 Deutsche Telekom. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -27,7 +28,7 @@ __docformat__ = 'restructuredtext' import sys import os import string -from .trapd_runtime_pid import save_pid, rm_pid +from mod.trapd_runtime_pid import save_pid, rm_pid prog_name = os.path.basename(__file__) diff --git a/miss_htbt_service/mod/trapd_get_cbs_config.py b/miss_htbt_service/mod/trapd_get_cbs_config.py index d0b8110..1fa3572 100644 --- a/miss_htbt_service/mod/trapd_get_cbs_config.py +++ b/miss_htbt_service/mod/trapd_get_cbs_config.py @@ -3,6 +3,7 @@ # ================================================================================ # Copyright (c) 2018-2020 AT&T Intellectual Property. All rights reserved. # Copyright (c) 2019 Pantheon.tech. All rights reserved. +# Copyright 2020 Deutsche Telekom. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -33,9 +34,9 @@ import time import traceback import collections from onap_dcae_cbs_docker_client.client import get_config -from . import trapd_settings as tds -from .trapd_exit import cleanup,cleanup_and_exit -from .trapd_io import stdout_logger +from mod import trapd_settings as tds +from mod.trapd_exit import cleanup,cleanup_and_exit +from mod.trapd_io import stdout_logger prog_name = os.path.basename(__file__) diff --git a/miss_htbt_service/mod/trapd_io.py b/miss_htbt_service/mod/trapd_io.py index 4f0904e..d60f060 100644 --- a/miss_htbt_service/mod/trapd_io.py +++ b/miss_htbt_service/mod/trapd_io.py @@ -3,6 +3,7 @@ # ================================================================================ # Copyright (c) 2018-2020 AT&T Intellectual Property. All rights reserved. # Copyright (c) 2019 Pantheon.tech. All rights reserved. +# Copyright 2020 Deutsche Telekom. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -36,8 +37,8 @@ import time import traceback import unicodedata # dcae_snmptrap -from . import trapd_settings as tds -from .trapd_exit import cleanup_and_exit +import mod.trapd_settings as tds +from mod.trapd_exit import cleanup_and_exit prog_name = os.path.basename(__file__) diff --git a/miss_htbt_service/mod/trapd_vnf_table.py b/miss_htbt_service/mod/trapd_vnf_table.py index eeb4dc6..6b883af 100644 --- a/miss_htbt_service/mod/trapd_vnf_table.py +++ b/miss_htbt_service/mod/trapd_vnf_table.py @@ -3,6 +3,7 @@ # ================================================================================ # Copyright (c) 2017-2020 AT&T Intellectual Property. All rights reserved. # Copyright (c) 2019 Pantheon.tech. All rights reserved. +# Copyright 2020 Deutsche Telekom. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -35,12 +36,12 @@ import time import subprocess from onap_dcae_cbs_docker_client.client import get_config -from .. import get_logger -from .. import db_monitoring as dbmon -from .. import htbtworker as pm -from .. import misshtbtd as db -from .. import config_notif as cf -from .. import cbs_polling as cbs +import get_logger +import db_monitoring as dbmon +import htbtworker as pm +import misshtbtd as db +import config_notif as cf +import cbs_polling as cbs prog_name = os.path.basename(__file__) diff --git a/mvn-phase-script.sh b/mvn-phase-script.sh index b17056b..ea67237 100755 --- a/mvn-phase-script.sh +++ b/mvn-phase-script.sh @@ -137,7 +137,7 @@ run_tox_test() source ./venv-tox/bin/activate pip install pip==10.0.1 pip install --upgrade argparse - pip install tox==2.9.1 + pip install tox==3.18.0 pip freeze tox deactivate diff --git a/pom.xml b/pom.xml index bcf7de8..758ef44 100644 --- a/pom.xml +++ b/pom.xml @@ -36,7 +36,7 @@ limitations under the License. org.onap.dcaegen2.services heartbeat dcaegen2-services-heartbeat - 2.1.0 + 2.1.1 UTF-8 . diff --git a/requirements.txt b/requirements.txt index 3b0cf75..2d6f25c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,3 @@ -request==1.0.1 requests==2.18.3 onap_dcae_cbs_docker_client==1.0.1 six==1.10.0 @@ -7,4 +6,4 @@ httplib2==0.9.2 HTTPretty==0.8.14 pyOpenSSL==17.5.0 Wheel==0.31.0 -psycopg2==2.7.6.1 +psycopg2-binary==2.8.5 diff --git a/setup.py b/setup.py index c8aef86..f5abfd2 100644 --- a/setup.py +++ b/setup.py @@ -34,11 +34,10 @@ from setuptools import setup, find_packages setup( name='miss_htbt_service', description='Missing heartbeat microservice to communicate with policy-engine', - version='2.1.0', + version='2.1.1', #packages=find_packages(exclude=["tests.*", "tests"]), packages=find_packages(), install_requires=[ -"request==1.0.1", "requests==2.18.3", "onap_dcae_cbs_docker_client==1.0.1", "six==1.10.0", @@ -46,7 +45,8 @@ setup( "httplib2==0.9.2", "HTTPretty==0.8.14", "pyOpenSSL==17.5.0", -"Wheel==0.31.0" +"Wheel==0.31.0", +"psycopg2-binary==2.8.5" ], author = "Vijay Venkatesh Kumar", author_email = "vv770d@att.com", diff --git a/tests/test_config_notif.py b/tests/test_config_notif.py index b59696e..707717c 100644 --- a/tests/test_config_notif.py +++ b/tests/test_config_notif.py @@ -1,5 +1,6 @@ # ============LICENSE_START======================================================= # Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. +# Copyright 2020 Deutsche Telekom. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,10 +15,10 @@ # limitations under the License. # ============LICENSE_END========================================================= -from miss_htbt_service import config_notif +import config_notif # from miss_htbt_service.mod.trapd_get_cbs_config import get_cbs_config -import miss_htbt_service.mod.trapd_get_cbs_config -import miss_htbt_service.mod.trapd_settings +import mod.trapd_get_cbs_config +import mod.trapd_settings from . import monkey_psycopg2 import psycopg2 @@ -204,7 +205,7 @@ def monkeypatch_get_cbs_config_False(): Required side affect: c_config is set to a json value """ print("monkeypatch_get_cbs_config_False()") - miss_htbt_service.mod.trapd_settings.c_config = { "patch": "false" } + mod.trapd_settings.c_config = { "patch": "false" } return False def monkeypatch_get_cbs_config_True(): @@ -213,14 +214,14 @@ def monkeypatch_get_cbs_config_True(): Required side affect: c_config is set to a json value """ print("monkeypatch_get_cbs_config_True()") - miss_htbt_service.mod.trapd_settings.c_config = { "patch": "true" } + mod.trapd_settings.c_config = { "patch": "true" } return True def test_fetch_json_file_get_cbs_config_is_true(monkeypatch): """ test fetch_json_file() with get_cbs_config() returning True """ - monkeypatch.setattr(miss_htbt_service.mod.trapd_get_cbs_config, 'get_cbs_config', monkeypatch_get_cbs_config_True) + monkeypatch.setattr(mod.trapd_get_cbs_config, 'get_cbs_config', monkeypatch_get_cbs_config_True) tmp1 = tempfile.NamedTemporaryFile(mode="w+") tmp2 = tempfile.NamedTemporaryFile(mode="w+") output = config_notif.fetch_json_file(download_json = tmp1.name, config_json = tmp2.name) @@ -234,7 +235,7 @@ def test_fetch_json_file_get_cbs_config_is_false(monkeypatch): """ test fetch_json_file() with get_cbs_config() returning False """ - monkeypatch.setattr(miss_htbt_service.mod.trapd_get_cbs_config, 'get_cbs_config', monkeypatch_get_cbs_config_False) + monkeypatch.setattr(mod.trapd_get_cbs_config, 'get_cbs_config', monkeypatch_get_cbs_config_False) tmp1 = tempfile.NamedTemporaryFile(mode="w+") tmp2 = tempfile.NamedTemporaryFile(mode="w+") output = config_notif.fetch_json_file(download_json = tmp1.name, config_json = tmp2.name) @@ -263,7 +264,7 @@ def test_config_notif_run_good(monkeypatch): everything good: "dbname" found (from below JSON info), "hb_common" listed in tables and hb_common has data. """ - monkeypatch.setattr(miss_htbt_service.config_notif, 'fetch_json_file', monkeypatch_fetch_json_file) + monkeypatch.setattr(config_notif, 'fetch_json_file', monkeypatch_fetch_json_file) tmp = tempfile.NamedTemporaryFile(mode="w+") global FETCH_JSON_FILE @@ -307,7 +308,7 @@ def test_config_notif_run_fail1(monkeypatch): Failure case 1: "dbname" NOT found (from below JSON info), "hb_common" listed in tables and hb_common has data. """ - monkeypatch.setattr(miss_htbt_service.config_notif, 'fetch_json_file', monkeypatch_fetch_json_file) + monkeypatch.setattr(config_notif, 'fetch_json_file', monkeypatch_fetch_json_file) tmp = tempfile.NamedTemporaryFile(mode="w+") global FETCH_JSON_FILE @@ -351,7 +352,7 @@ def test_config_notif_run_fail2(monkeypatch): Failure case 2: "dbname" found (from below JSON info), "hb_common" NOT listed in tables and hb_common has data. """ - monkeypatch.setattr(miss_htbt_service.config_notif, 'fetch_json_file', monkeypatch_fetch_json_file) + monkeypatch.setattr(config_notif, 'fetch_json_file', monkeypatch_fetch_json_file) tmp = tempfile.NamedTemporaryFile(mode="w+") global FETCH_JSON_FILE @@ -395,8 +396,8 @@ def test_config_notif_run_fail3(monkeypatch): Failure case 3: "dbname" found (from below JSON info), "hb_common" listed in tables and update_hb_common() fails """ - monkeypatch.setattr(miss_htbt_service.config_notif, 'fetch_json_file', monkeypatch_fetch_json_file) - monkeypatch.setattr(miss_htbt_service.config_notif, 'update_hb_common', monkeypatch_return_False) + monkeypatch.setattr(config_notif, 'fetch_json_file', monkeypatch_fetch_json_file) + monkeypatch.setattr(config_notif, 'update_hb_common', monkeypatch_return_False) tmp = tempfile.NamedTemporaryFile(mode="w+") global FETCH_JSON_FILE diff --git a/tests/test_trapd_vnf_table.py b/tests/test_trapd_vnf_table.py index 4f5cace..d0bf51c 100644 --- a/tests/test_trapd_vnf_table.py +++ b/tests/test_trapd_vnf_table.py @@ -3,6 +3,7 @@ # ================================================================================ # Copyright (c) 2017-2020 AT&T Intellectual Property. All rights reserved. # Copyright (c) 2019 Pantheon.tech. All rights reserved. +# Copyright 2020 Deutsche Telekom. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -26,11 +27,11 @@ import unittest import sys import pytest import logging -from miss_htbt_service import misshtbtd as db -from miss_htbt_service import htbtworker as pm -from miss_htbt_service import db_monitoring as dbmon -from miss_htbt_service import get_logger -from miss_htbt_service.mod.trapd_vnf_table import ( +import misshtbtd as db +import htbtworker as pm +import db_monitoring as dbmon +import get_logger +from mod.trapd_vnf_table import ( verify_DB_creation_1, verify_DB_creation_2, verify_DB_creation_hb_common, verify_cbsPolling_required, hb_properties, verify_cbspolling, verify_sendControlLoop_VNF_ONSET, verify_sendControlLoop_VM_ONSET, diff --git a/tox.ini b/tox.ini index 9d75d5c..6d0e5c1 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ # content of: tox.ini , put in same dir as setup.py [tox] -envlist = py36,py37 +envlist = py37,py38 [testenv] deps= @@ -10,8 +10,10 @@ deps= pytest-cov setenv = CBS_HTBT_JSON={toxinidir}/etc/config.json + PYTHONPATH = {toxinidir}/miss_htbt_service recreate = True commands= + {envbindir}/python setup.py install mkdir -p /tmp/opt/app/miss_htbt_service/logs/ mkdir -p /tmp/opt/app/miss_htbt_service/tmp/ mkdir -p /tmp/opt/app/miss_htbt_service/etc/ diff --git a/version.properties b/version.properties index 7a7808c..3c5fba7 100644 --- a/version.properties +++ b/version.properties @@ -1,6 +1,6 @@ major=2 minor=1 -patch=0 +patch=1 base_version=${major}.${minor}.${patch} release_version=${base_version} snapshot_version=${base_version}-SNAPSHOT -- cgit 1.2.3-korg