aboutsummaryrefslogtreecommitdiff
path: root/lava_scheduler_app/tests/test_submission.py
diff options
context:
space:
mode:
authorNeil Williams <neil.williams@linaro.org>2016-03-17 09:13:11 +0000
committerSenthil Kumaran S <senthil.kumaran@linaro.org>2016-03-18 18:06:08 +0530
commita2446d4bf02a88238712ffb563ae867647855bd9 (patch)
tree402c942f500baaf58fc605a175d77ed599ff561a /lava_scheduler_app/tests/test_submission.py
parent2d5dcbae6713f5ec750efff6161cf86be553baf6 (diff)
Bug: #2130 API submission of JSON multinode jobs
Ensure that the health_check determination only handles singlenode jobs. Add a unit test for the bug. Reduce noise in scheduler log by outputting counts before the outer loop starts. Change-Id: Ia57a5f1fa5e4bfd0b101156151b65f7a54c76697
Diffstat (limited to 'lava_scheduler_app/tests/test_submission.py')
-rw-r--r--lava_scheduler_app/tests/test_submission.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/lava_scheduler_app/tests/test_submission.py b/lava_scheduler_app/tests/test_submission.py
index c8ed7a4b4..c75a0b364 100644
--- a/lava_scheduler_app/tests/test_submission.py
+++ b/lava_scheduler_app/tests/test_submission.py
@@ -24,6 +24,7 @@ from lava_scheduler_app.models import (
JSONDataError,
Tag,
TestJob,
+ TemporaryDevice,
DevicesUnavailableException,
DeviceDictionary,
_check_exclusivity,
@@ -983,6 +984,23 @@ actions:
def_dict['target'] = 'nosuchdevice'
definition = json.dumps(def_dict)
self.assertRaises(Device.DoesNotExist, testjob_submission, definition, user)
+ # check multinode API submission. bug #2130
+ filename = os.path.join(os.path.dirname(__file__), 'master-multinode.json')
+ self.assertTrue(os.path.exists(filename))
+ with open(filename, 'r') as json_file:
+ definition = json_file.read()
+ job_list = testjob_submission(definition, user)
+ self.assertIsInstance(job_list, list)
+ for job in job_list:
+ self.assertIsNotNone(job.vm_group)
+ self.assertFalse(job.health_check)
+ if job.requested_device_type == device_type:
+ self.assertIsNone(job.requested_device)
+ else:
+ self.assertIsNotNone(job.requested_device)
+ self.assertIsInstance(job.requested_device, TemporaryDevice)
+ job.requested_device.delete()
+ job.delete()
class TransactionTestCaseWithFactory(TransactionTestCase):