Skip to content
Snippets Groups Projects
Commit f0a126e6 authored by Carlos Natalino Da Silva's avatar Carlos Natalino Da Silva
Browse files

Fixing tests for dbscanserving.

parent 1d7d9178
No related branches found
No related tags found
2 merge requests!142Release TeraFlowSDN 2.1,!138Fixing the tests of the optical cybersecurity components
......@@ -54,7 +54,7 @@ unit_test dbscanserving:
- sleep 5
- docker ps -a
- docker logs $IMAGE_NAME
- docker exec ps -a
- docker ps -a
- sleep 5
- docker logs $IMAGE_NAME
- docker exec -i $IMAGE_NAME bash -c "coverage run -m pytest --log-level=INFO --verbose $IMAGE_NAME/tests/test_unitary.py --junitxml=/home/${IMAGE_NAME}/results/${IMAGE_NAME}_report.xml"
......
......@@ -23,30 +23,27 @@ from common.proto.dbscanserving_pb2 import (DetectionRequest,
DetectionResponse, Sample)
from dbscanserving.client.DbscanServingClient import DbscanServingClient
from dbscanserving.Config import GRPC_SERVICE_PORT
from dbscanserving.service.DbscanService import DbscanService
port = 10000 + GRPC_SERVICE_PORT # avoid privileged ports
LOGGER = logging.getLogger(__name__)
LOGGER.setLevel(logging.DEBUG)
@pytest.fixture(scope="session")
def dbscanserving_service():
_service = DbscanService(port=port)
_service = DbscanService()
_service.start()
yield _service
_service.stop()
@pytest.fixture(scope="session")
def dbscanserving_client():
def dbscanserving_client(dbscanserving_service: DbscanService):
with patch.dict(
os.environ,
{
"DBSCANSERVINGSERVICE_SERVICE_HOST": "127.0.0.1",
"DBSCANSERVINGSERVICE_SERVICE_PORT_GRPC": str(port),
"DBSCANSERVINGSERVICE_SERVICE_PORT_GRPC": str(dbscanserving_service.bind_port),
},
clear=True,
):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment