code: install_deps> python -I -m pip install connexion==2.14.2 coverage Flask==2.2.5 pytest pytest-cov code: freeze> python -m pip freeze --all code: attrs==23.2.0,certifi==2023.11.17,charset-normalizer==3.3.2,click==8.1.7,clickclick==20.10.2,connexion==2.14.2,coverage==7.4.0,exceptiongroup==1.2.0,Flask==2.2.5,idna==3.6,inflection==0.5.1,iniconfig==2.0.0,itsdangerous==2.1.2,Jinja2==3.1.3,jsonschema==4.20.0,jsonschema-specifications==2023.12.1,MarkupSafe==2.1.3,packaging==23.2,pip==23.3.1,pluggy==1.3.0,pytest==7.4.4,pytest-cov==4.1.0,PyYAML==6.0.1,referencing==0.32.1,requests==2.31.0,rpds-py==0.16.2,setuptools==69.0.2,tomli==2.0.1,urllib3==2.1.0,Werkzeug==2.2.3,wheel==0.42.0 code: commands[0]> pytest --cov /w/workspace/sim-a1-interface-tox-sonarqube/near-rt-ric-simulator --cov-report xml --cov-report term-missing --cov-report html --cov-fail-under=70 /w/workspace/sim-a1-interface-tox-sonarqube/near-rt-ric-simulator/tests/test_osc_2_1_0.py ============================= test session starts ============================== platform linux -- Python 3.10.6, pytest-7.4.4, pluggy-1.3.0 cachedir: .tox/code/.pytest_cache rootdir: /w/workspace/sim-a1-interface-tox-sonarqube plugins: cov-4.1.0 collected 4 items near-rt-ric-simulator/tests/test_osc_2_1_0.py ...F [100%] =================================== FAILURES =================================== _______________________________ test_sendstatus ________________________________ client = > def test_sendstatus(client): # Create a new thread to run the Flask app in parallel on a different port so that we can call the callback. proc = multiprocessing.Process(target=run_flask_app, args=()) proc.start() test_data = get_testdata_dir() + 'pi2.json' header = { "Content-Type" : "application/json" } # === Send status for pi2=== with open(test_data) as json_file: payload = json.load(json_file) response = client.post(SERVER_URL+'sendstatus?policyid=pi2', headers=header, data=json.dumps(payload)) > assert response.status_code == 201 E assert 502 == 201 E + where 502 = .status_code /w/workspace/sim-a1-interface-tox-sonarqube/near-rt-ric-simulator/tests/test_osc_2_1_0.py:612: AssertionError ----------------------------- Captured stdout call ----------------------------- -----Request----- Req Headers: User-Agent: werkzeug/2.2.3 Host: localhost:2222 Content-Type: application/json Content-Length: 79 Req Body: b'{"scope": {"ueId": "ue2", "qosId": "qos2"}, "statement": {"priorityLevel": 10}}' -----Response----- Resp Headers: Content-Type: text/plain; charset=utf-8 Content-Length: 92 Resp Body: b'Post status failed with Connection Error, could not send to http://localhost:8086/statustest' * Serving Flask app 'var_declaration' * Debug mode: off =============================== warnings summary =============================== near-rt-ric-simulator/tests/test_osc_2_1_0.py::test_enforce_reason near-rt-ric-simulator/tests/test_osc_2_1_0.py::test_enforce_reason /w/workspace/sim-a1-interface-tox-sonarqube/.tox/code/lib/python3.10/site-packages/connexion/decorators/validation.py:16: DeprecationWarning: Accessing jsonschema.draft4_format_checker is deprecated and will be removed in a future release. Instead, use the FORMAT_CHECKER attribute on the corresponding Validator. from jsonschema import Draft4Validator, ValidationError, draft4_format_checker near-rt-ric-simulator/tests/test_osc_2_1_0.py::test_enforce_reason near-rt-ric-simulator/tests/test_osc_2_1_0.py::test_enforce_reason /w/workspace/sim-a1-interface-tox-sonarqube/.tox/code/lib/python3.10/site-packages/connexion/json_schema.py:16: DeprecationWarning: jsonschema.RefResolver is deprecated as of v4.18.0, in favor of the https://github.com/python-jsonschema/referencing library, which provides more compliant referencing behavior as well as more flexible APIs for customization. A future release will remove RefResolver. Please file a feature request (on referencing) if you are missing an API for the kind of customization you need. from jsonschema import Draft4Validator, RefResolver near-rt-ric-simulator/tests/test_osc_2_1_0.py::test_enforce_reason /w/workspace/sim-a1-interface-tox-sonarqube/.tox/code/lib/python3.10/site-packages/connexion/json_schema.py:17: DeprecationWarning: jsonschema.exceptions.RefResolutionError is deprecated as of version 4.18.0. If you wish to catch potential reference resolution errors, directly catch referencing.exceptions.Unresolvable. from jsonschema.exceptions import RefResolutionError, ValidationError # noqa near-rt-ric-simulator/tests/test_osc_2_1_0.py::test_enforce_reason /w/workspace/sim-a1-interface-tox-sonarqube/.tox/code/lib/python3.10/site-packages/connexion/apps/flask_app.py:36: DeprecationWarning: 'app.json_encoder' is deprecated and will be removed in Flask 2.3. Customize 'app.json_provider_class' or 'app.json' instead. app.json_encoder = FlaskJSONEncoder near-rt-ric-simulator/tests/test_osc_2_1_0.py: 56 warnings /w/workspace/sim-a1-interface-tox-sonarqube/.tox/code/lib/python3.10/site-packages/connexion/apis/flask_api.py:236: DeprecationWarning: '_request_ctx_stack' is deprecated and will be removed in Flask 2.3. setattr(flask._request_ctx_stack.top, 'connexion_context', context_dict) near-rt-ric-simulator/tests/test_osc_2_1_0.py: 56 warnings /w/workspace/sim-a1-interface-tox-sonarqube/.tox/code/lib/python3.10/site-packages/connexion/apis/flask_api.py:236: DeprecationWarning: '_request_ctx_stack' is deprecated and will be removed in Flask 2.3. Use 'g' to store data, or 'request_ctx' to access the current context. setattr(flask._request_ctx_stack.top, 'connexion_context', context_dict) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ---------- coverage: platform linux, python 3.10.6-final-0 ----------- Name Stmts Miss Cover Missing --------------------------------------------------------------------------------------------------------- near-rt-ric-simulator/src/OSC_2.1.0/controllers/__init__.py 0 0 100% near-rt-ric-simulator/src/OSC_2.1.0/controllers/a1_mediator_controller.py 206 26 87% 107, 111-112, 124-126, 129-130, 163, 168-169, 172-173, 196, 225-227, 238, 248, 253-256, 298, 330-331 near-rt-ric-simulator/src/OSC_2.1.0/main.py 182 41 77% 48-51, 62, 94-95, 99-100, 103, 121, 124-125, 129, 135, 150-151, 173, 175, 179, 193-194, 223, 232, 234, 241-244, 248-253, 259-265, 270 near-rt-ric-simulator/src/OSC_2.1.0/models/__init__.py 0 0 100% near-rt-ric-simulator/src/OSC_2.1.0/models/enforceStatus.py 28 0 100% near-rt-ric-simulator/src/OSC_2.1.0/var_declaration.py 17 0 100% near-rt-ric-simulator/src/common/maincommon.py 39 8 79% 34-35, 53, 56, 60-63, 72 near-rt-ric-simulator/src/common/payload_logging.py 28 6 79% 31-38 near-rt-ric-simulator/src/common/utils.py 10 9 10% 20-29 near-rt-ric-simulator/test/common/compare_json.py 63 24 62% 46, 57, 67, 71, 74, 80, 83, 87, 103-105, 108-127 near-rt-ric-simulator/tests/test_osc_2_1_0.py 370 7 98% 613-624 near-rt-ric-simulator/tests/unittest_setup.py 29 2 93% 63-64 --------------------------------------------------------------------------------------------------------- TOTAL 972 123 87% Coverage HTML written to dir htmlcov Coverage XML written to file coverage.xml Required test coverage of 70% reached. Total coverage: 87.35% =========================== short test summary info ============================ FAILED near-rt-ric-simulator/tests/test_osc_2_1_0.py::test_sendstatus - asser... ================== 1 failed, 3 passed, 118 warnings in 11.42s ================== code: exit -15 (793.14 seconds) /w/workspace/sim-a1-interface-tox-sonarqube> pytest --cov /w/workspace/sim-a1-interface-tox-sonarqube/near-rt-ric-simulator --cov-report xml --cov-report term-missing --cov-report html --cov-fail-under=70 /w/workspace/sim-a1-interface-tox-sonarqube/near-rt-ric-simulator/tests/test_osc_2_1_0.py pid=27739