From 4e6055ae646463a6c4dc76811aff157103948002 Mon Sep 17 00:00:00 2001 From: Curtis Faith Date: Wed, 4 Oct 2017 14:16:39 +0800 Subject: [PATCH] added some coverage for JobDescriptor, fixed hard-clean for Mac --- agent/tests/test_jobs.py | 35 +++++++++++++++++++++++++++++++++++ tools.sh | 8 ++++---- 2 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 agent/tests/test_jobs.py diff --git a/agent/tests/test_jobs.py b/agent/tests/test_jobs.py new file mode 100644 index 0000000..be2883b --- /dev/null +++ b/agent/tests/test_jobs.py @@ -0,0 +1,35 @@ +import logging + +import pytest +from sn_agent.log import setup_logging +from sn_agent import ontology +from sn_agent.ontology.service_descriptor import ServiceDescriptor +from sn_agent.job.job_descriptor import JobDescriptor +from sn_agent.job.job_descriptor import init_test_jobs + +log = logging.getLogger(__name__) + + + +# Tests + +# Test performance of services - all of them +def test_jobs(): + print() + setup_logging() + init_test_jobs() + test_jobs = JobDescriptor.get_test_jobs(ontology.DOCUMENT_SUMMARIZER_ID) + for job in test_jobs: + service_id = 0 + if str(job) != "NO_JOB": + service_id = ontology.DOCUMENT_SUMMARIZER_ID + + job_parameters = {'input_type': 'file', + 'input_url': 'http://test.com/inputs/test_input.txt', + 'output_type': 'file_url_put', + 'output_url': 'test_output.txt'} + service_id = ontology.DOCUMENT_SUMMARIZER_ID + new_job = JobDescriptor(ServiceDescriptor(service_id), job_parameters) + test_jobs.append(new_job) + total_jobs = len(test_jobs) + del test_jobs[total_jobs-1] diff --git a/tools.sh b/tools.sh index d79c079..1c4916f 100755 --- a/tools.sh +++ b/tools.sh @@ -56,10 +56,10 @@ clean) hard-clean) docker-compose down --rmi all --remove-orphans - docker ps -q | xargs -r docker kill - docker ps -a -q | xargs -r docker rm - docker images -q | xargs -r docker rmi - docker volume ls -qf dangling=true | xargs -r docker volume rm + docker kill `docker ps -q` + docker rm `docker ps -a -q` + docker rmi `docker images -q` + docker volume rm `docker volume ls -qf dangling=true` ;; create-web-cookie)