Permalink
Browse files

Bug 810439 - mozharness support for mozpool. r=dustin

add 'environment' to request_device()
  • Loading branch information...
1 parent 8771a72 commit f8c87d123663f6e8ae091ae263ef718aac80a908 @jhopkinsmoz jhopkinsmoz committed Dec 6, 2012
@@ -246,7 +246,7 @@ def query_device_details(self, device_id, error_level=WARNING, **kwargs):
level=error_level)
def request_device(self, device_id, assignee, image, duration, pxe_config=None,
- b2gbase=None, error_level=WARNING, **kwargs):
+ b2gbase=None, environment='any', error_level=WARNING, **kwargs):
""" requests the given device. {id} may be "any" to let MozPool choose an
unassigned device. The body must be a JSON object with at least the keys
"requester", "duration", and "image". The value for "requester" takes an
@@ -283,7 +283,7 @@ def request_device(self, device_id, assignee, image, duration, pxe_config=None,
assert b2gbase is not None, "b2gbase must be supplied when image=='b2gbase'"
assert duration == int(duration)
- data = {'assignee': assignee, 'duration': duration, 'image': image}
+ data = {'assignee': assignee, 'duration': duration, 'image': image, 'environment': environment}
if pxe_config is not None:
data['pxe_config'] = pxe_config
if b2gbase is not None:
@@ -25,8 +25,10 @@ def test_query_all_device_details(self):
self.assertIsInstance(d, dict)
for k, v in d.items():
self.assertIsInstance(k, basestring)
- if k in ['fqdn', 'imaging_server', 'mac_address', 'name', 'relay_info', 'state']:
- self.assertIsInstance(v, basestring)
+ if k in ['fqdn', 'imaging_server', 'mac_address', 'name', 'relay_info', \
+ 'state', 'last_pxe_config', 'comments', 'environment']:
+ if v is not None:
+ self.assertIsInstance(v, basestring)
elif k in ['id', 'inventory_id']:
self.assertIsInstance(v, int)
else:
@@ -22,7 +22,7 @@ def _test_query_all_requests(self):
for request in response['requests']:
for request_key in request.keys():
self.assertIn(request_key, ['assigned_device', 'assignee', 'boot_config', 'device_state',
- 'expires', 'id', 'imaging_server', 'requested_device', 'state'])
+ 'expires', 'id', 'imaging_server', 'requested_device', 'state', 'environment'])
self.assertNotIn(request['state'], ['closed'])
response = self.mph.query_all_requests(include_closed_requests=True)
@@ -31,7 +31,7 @@ def _test_query_all_requests(self):
for request in response['requests']:
for request_key in request.keys():
self.assertIn(request_key, ['assigned_device', 'assignee', 'boot_config', 'device_state',
- 'expires', 'id', 'imaging_server', 'requested_device', 'state'])
+ 'expires', 'id', 'imaging_server', 'requested_device', 'state', 'environment'])
def _test_renew_request(self, request_url, old_expires):
""" Reset the lifetime of a request.

0 comments on commit f8c87d1

Please sign in to comment.