name: code run_id: commands[0] env LANG: C.UTF-8 env HOME: /home/jenkins env PATH: /w/workspace/smo-ves-cli-sonar/.tox/code/bin:/opt/pyenv/bin:/tmp/venv-0t3z/bin:/opt/pyenv/shims:/home/jenkins/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/puppetlabs/bin env PYTHONHASHSEED: 1389313171 env PIP_DISABLE_PIP_VERSION_CHECK: 1 env PYTHONIOENCODING: utf-8 env TOX_ENV_NAME: code env TOX_WORK_DIR: /w/workspace/smo-ves-cli-sonar/.tox env TOX_ENV_DIR: /w/workspace/smo-ves-cli-sonar/.tox/code env VIRTUAL_ENV: /w/workspace/smo-ves-cli-sonar/.tox/code metadata pid: 2754 cwd: /w/workspace/smo-ves-cli-sonar allow: /w/workspace/smo-ves-cli-sonar/.tox/code/bin/* cmd: pytest --ignore=functionaltest --ignore=collector --cov /w/workspace/smo-ves-cli-sonar --cov-report xml --cov-report term-missing --cov-report html --cov-fail-under=70 --junitxml=/w/workspace/smo-ves-cli-sonar/tmp/tests.xml exit_code: 1 ============================= test session starts ============================== platform linux -- Python 3.10.6, pytest-8.2.2, pluggy-1.5.0 cachedir: .tox/code/.pytest_cache rootdir: /w/workspace/smo-ves-cli-sonar plugins: mock-3.14.0, cov-5.0.0, requests-mock-1.12.1 collected 114 items tests/collector/test_monitor.py ..............................F..F. [ 30%] tests/collector/test_rest_dispatcher.py .... [ 34%] tests/dmaap_adaptor/test_appConfig.py ....... [ 40%] tests/dmaap_adaptor/test_consumer.py ............ [ 50%] tests/dmaap_adaptor/test_dmaap_adapter.py ..ss.... [ 57%] tests/dmaap_adaptor/test_prepare_response.py .... [ 61%] tests/influxdb_connector/test_influxdb_connector.py .... [ 64%] tests/influxdb_connector/test_influxdb_events.py ....................... [ 85%] ................. [100%] =================================== FAILURES =================================== _________________________ test_check_schema_file_exist _________________________ vel_schema_path = '/w/workspace/smo-ves-cli-sonar/collector/evel-test-collector/docs/schema' schema_ref = 'https://forge.3gpp.org/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/faultMnS.yaml#components/schemas/NotifyNewAlarm' @patch("monitor.logger", logging.getLogger("monitor")) def test_check_schema_file_exist(vel_schema_path, schema_ref): > result = monitor.check_schema_file_exist(vel_schema_path, schema_ref) tests/collector/test_monitor.py:832: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ vel_schema_path = '/w/workspace/smo-ves-cli-sonar/collector/evel-test-collector/docs/schema' schema_ref = 'https://forge.3gpp.org/rep/sa5/MnS/raw/SA88-Rel16/OpenAPI/faultMnS.yaml?inline=false' def check_schema_file_exist(vel_schema_path, schema_ref): logger.debug('in check yaml file') assert (vel_schema_path != ""), "Value of property 'schema_file' is missing in config file" # Fetching file and folder name from url schema_ref = schema_ref.split('#')[0] name_list = schema_ref.split('/') folder_name = '_'.join(name_list[2:-1]) file_name = name_list[-1] updated_vel_schema_path = vel_schema_path +'/{0}/{1}'.format(folder_name,file_name) if "https://forge.3gpp.org" in schema_ref: schema_ref = schema_ref.replace("blob","raw") schema_ref = schema_ref + '?inline=false' if not os.path.exists(updated_vel_schema_path): logger.warning('Event Listener Schema File ({0}) not found. ''No validation will be undertaken.'.format(vel_schema_path)) logger.info('Start downloading yaml file :{}'.format(schema_ref)) result = os.system('curl -JOL "{0}"'.format(schema_ref)) logger.debug("result {0}".format(result)) assert(result == 0), "Invalid URL {0}".format(schema_ref) logger.info("Download Completed") > with open(file_name, "r") as file: E FileNotFoundError: [Errno 2] No such file or directory: 'faultMnS.yaml' collector/evel-test-collector/code/collector/monitor.py:284: FileNotFoundError ----------------------------- Captured stderr call ----------------------------- % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 3054 100 3054 0 0 4013 0 --:--:-- --:--:-- --:--:-- 4018 ------------------------------ Captured log call ------------------------------- WARNING monitor:monitor.py:278 Event Listener Schema File (/w/workspace/smo-ves-cli-sonar/collector/evel-test-collector/docs/schema) not found. No validation will be undertaken. INFO monitor:monitor.py:279 Start downloading yaml file :https://forge.3gpp.org/rep/sa5/MnS/raw/SA88-Rel16/OpenAPI/faultMnS.yaml?inline=false INFO monitor:monitor.py:283 Download Completed ______________________ test_stnd_define_event_validation _______________________ mocker_check = vel_schema_path = '/w/workspace/smo-ves-cli-sonar/collector/evel-test-collector/docs/schema' body = {'event': {'stndDefinedFields': {'data': {'alarmId': 'lossOfSignal', 'alarmType': 'COMMUNICATIONS_ALARM', 'backUpObjec...rence': 'https://forge.3gpp.org/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/faultMnS.yaml#components/schemas/NotifyNewAlarm'}}} schema_ref = 'https://forge.3gpp.org/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/faultMnS.yaml#components/schemas/NotifyNewAlarm' @patch("monitor.logger", logging.getLogger("monitor")) @mock.patch("monitor.check_schema_file_exist") def test_stnd_define_event_validation(mocker_check, vel_schema_path, body, schema_ref): body = { "event": { "stndDefinedFields": { "schemaReference": schema_ref, "data": { "href": "href1", "notificationId": 0, "notificationType": "notifyNewAlarm", "eventTime": "2022-06-22T12:43:50.579315Z", "systemDN": "xyz", "alarmType": "COMMUNICATIONS_ALARM", "alarmId": "lossOfSignal", "probableCause": "lossOfSignal", "specificProblem": "lossOfSignal", "perceivedSeverity": "CRITICAL", "correlatedNotifications": [], "rootCauseIndicator": False, "backedUpStatus": True, "backUpObject": "xyz", "trendIndication": "MORE_SEVERE", }, } } } path = os.getcwd() mocker_check.return_value = os.path.join( path, "collector/evel-test-collector/docs/schema/forge.3gpp.org_rep_sa5_MnS_blob_SA88-Rel16_OpenAPI/faultMnS.yaml", ) > result = monitor.stnd_define_event_validation(vel_schema_path, body) tests/collector/test_monitor.py:931: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ schema_path = '/w/workspace/smo-ves-cli-sonar/collector/evel-test-collector/docs/schema/forge.3gpp.org_rep_sa5_MnS_blob_SA88-Rel16_OpenAPI/faultMnS.yaml' body = {'event': {'stndDefinedFields': {'data': {'alarmId': 'lossOfSignal', 'alarmType': 'COMMUNICATIONS_ALARM', 'backUpObjec...rence': 'https://forge.3gpp.org/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/faultMnS.yaml#components/schemas/NotifyNewAlarm'}}} def stnd_define_event_validation(schema_path , body): logger.debug('in second level validation ') schema_ref = body['event']['stndDefinedFields']["schemaReference"] schema_path = check_schema_file_exist(schema_path , schema_ref) logger.debug('end check yaml path ') > schema = yaml.full_load(open(schema_path, 'r')) E FileNotFoundError: [Errno 2] No such file or directory: '/w/workspace/smo-ves-cli-sonar/collector/evel-test-collector/docs/schema/forge.3gpp.org_rep_sa5_MnS_blob_SA88-Rel16_OpenAPI/faultMnS.yaml' collector/evel-test-collector/code/collector/monitor.py:307: FileNotFoundError =============================== warnings summary =============================== influxdb-connector/influxdb-connector/code/influxdb_connector.py:240 /w/workspace/smo-ves-cli-sonar/influxdb-connector/influxdb-connector/code/influxdb_connector.py:240: DeprecationWarning: invalid escape sequence '\ ' for search_char, replace_char in {" ": "\ ", ",": "\,"}.items(): influxdb-connector/influxdb-connector/code/influxdb_connector.py:240 /w/workspace/smo-ves-cli-sonar/influxdb-connector/influxdb-connector/code/influxdb_connector.py:240: DeprecationWarning: invalid escape sequence '\,' for search_char, replace_char in {" ": "\ ", ",": "\,"}.items(): tests/influxdb_connector/test_influxdb_events.py:423 /w/workspace/smo-ves-cli-sonar/tests/influxdb_connector/test_influxdb_events.py:423: DeprecationWarning: invalid escape sequence '\,' data = "measurement,domain=measurement,eventId=O-RAN-FH-IPv6-01_1639984500_PM15min,eventName=measurement_O_RAN_COMPONENT_PM15min,eventType=O_RAN_COMPONENT_PM15min,priority=Low,reportingEntityName=ORAN-DEV,sourceName=O-RAN-FH-IPv6-01,intervalStartTime=Mon\,\ 20\ Dec\ 2021\ 07:00:00\ +0000,intervalEndTime=Mon\,\ 20\ Dec\ 2021\ 07:15:00\ +0000,version=4.1,vesEventListenerVersion=7.2.1" tests/collector/test_monitor.py::test_listener tests/collector/test_monitor.py::test_schema_ref_url tests/collector/test_monitor.py::test_gerrit_schema_ref_url /w/workspace/smo-ves-cli-sonar/collector/evel-test-collector/code/collector/monitor.py:204: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead logger.warn('Failed to authenticate OK; creds: ' , credentials) tests/collector/test_monitor.py::test_listener_jsonschema_validation /w/workspace/smo-ves-cli-sonar/collector/evel-test-collector/code/collector/monitor.py:234: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead logger.warn('Event is not valid against schema! {0}'.format(e)) tests/collector/test_monitor.py::test_listener_jsonschema_validation /w/workspace/smo-ves-cli-sonar/collector/evel-test-collector/code/collector/monitor.py:235: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead logger.warn('Bad JSON body decoded:\n' tests/collector/test_monitor.py::test_listener_schma_is_empty /w/workspace/smo-ves-cli-sonar/collector/evel-test-collector/code/collector/monitor.py:252: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead logger.warn('Valid JSON body (no schema checking) decoded:\n' tests/collector/test_monitor.py::test_listener_schma_is_empty /w/workspace/smo-ves-cli-sonar/collector/evel-test-collector/code/collector/monitor.py:257: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead logger.warn('Event is valid JSON but not checked against schema!') tests/collector/test_monitor.py::test_TestControl_listener_schema_validation_error /w/workspace/smo-ves-cli-sonar/collector/evel-test-collector/code/collector/monitor.py:396: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead logger.warn('TestControl input not valid: {0}'.format(e)) tests/collector/test_monitor.py::test_TestControl_listener_schema_validation_error /w/workspace/smo-ves-cli-sonar/collector/evel-test-collector/code/collector/monitor.py:397: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead logger.warn('Bad JSON body decoded:\n' -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ------- generated xml file: /w/workspace/smo-ves-cli-sonar/tmp/tests.xml ------- ---------- coverage: platform linux, python 3.10.6-final-0 ----------- Name Stmts Miss Cover Missing ------------------------------------------------------------------------------------------------ collector/evel-test-collector/code/collector/monitor.py 339 7 98% 308-314 collector/evel-test-collector/code/collector/rest_dispatcher.py 26 0 100% dmaapadapter/adapter/code/app_config.py 43 0 100% dmaapadapter/adapter/code/consumer.py 106 10 91% 55, 62-70, 74 dmaapadapter/adapter/code/dmaap_adapter.py 63 20 68% 56-63, 68-85 dmaapadapter/adapter/code/prepare_response.py 12 0 100% influxdb-connector/influxdb-connector/code/influxdb_connector.py 286 57 80% 343-470 tests/__init__.py 0 0 100% tests/collector/__init__.py 27 18 33% 26-44 tests/collector/test_monitor.py 474 22 95% 162-165, 400-403, 420-423, 460-463, 511-512, 833-834, 862, 932 tests/collector/test_rest_dispatcher.py 48 0 100% tests/dmaap_adaptor/__init__.py 5 0 100% tests/dmaap_adaptor/test_appConfig.py 68 0 100% tests/dmaap_adaptor/test_consumer.py 132 0 100% tests/dmaap_adaptor/test_dmaap_adapter.py 104 22 79% 43-47, 53-57, 65-69, 76-80, 84-85 tests/dmaap_adaptor/test_prepare_response.py 23 0 100% tests/influxdb_connector/__init__.py 5 0 100% tests/influxdb_connector/test_influxdb_connector.py 29 0 100% tests/influxdb_connector/test_influxdb_events.py 445 9 98% 35, 306-312, 1219-1220, 1239-1240, 1263-1264 ------------------------------------------------------------------------------------------------ TOTAL 2235 165 93% Coverage HTML written to dir htmlcov Coverage XML written to file coverage.xml Required test coverage of 70% reached. Total coverage: 92.62% =========================== short test summary info ============================ FAILED tests/collector/test_monitor.py::test_check_schema_file_exist - FileNo... FAILED tests/collector/test_monitor.py::test_stnd_define_event_validation - F... ============ 2 failed, 110 passed, 2 skipped, 12 warnings in 5.94s =============