def testCancelRun(self):
   device_serial = str(uuid.uuid4())
   # Schedule test run and cancel it
   test_run_id = self.container.ScheduleTestRun(device_serial)['id']
   self.container.WaitForState(test_run_id, 'QUEUED')
   self.container.CancelTestRun(test_run_id)
   # Can't lease with matching run target, task was cancelled
   task = self.container.LeaseTask(integration_util.DeviceInfo(device_serial))
   self.assertIsNone(task)
 def testError(self):
     """Test that non-fatal errors should trigger an automatic retry."""
     self.container.SubmitCommandEvent(self.task, 'ExecuteFailed')
     self.container.WaitForState(self.test_run_id,
                                 'QUEUED')  # Back to QUEUED
     # Retry attempt can be leased
     retry = self.container.LeaseTask(
         integration_util.DeviceInfo(self.device_serial))
     self.assertIsNotNone(retry)
     self.assertNotEqual(self.task['attempt_id'], retry['attempt_id'])
 def testScheduleRun(self):
   device_serial = str(uuid.uuid4())
   # Schedule test run
   test_run_id = self.container.ScheduleTestRun(device_serial)['id']
   self.container.WaitForState(test_run_id, 'QUEUED')
   # Should be able to lease with matching run target
   task = self.container.LeaseTask(integration_util.DeviceInfo(device_serial))
   self.assertIsNotNone(task)
   self.assertEqual([device_serial], task['device_serials'])
   self.assertEqual(
       'util/timewaster --invocation-data mtt=1', task['command_line'])
 def testScheduleRun_extraArgs(self):
   device_serial = str(uuid.uuid4())
   # Schedule test run
   test_run = self.container.ScheduleTestRun(
       device_serial, extra_args='extra_args')
   test_run_id = test_run['id']
   self.container.WaitForState(test_run_id, 'QUEUED')
   # Task should have extra command line arguments
   task = self.container.LeaseTask(integration_util.DeviceInfo(device_serial))
   self.assertEqual(
       'util/timewaster extra_args --invocation-data mtt=1',
       task['command_line'])
 def setUp(self):
     super(EventHandlerIntegrationTest, self).setUp()
     # Schedule test run
     self.device_serial = str(uuid.uuid4())
     self.test_run_id = self.container.ScheduleTestRun(
         self.device_serial)['id']
     self.container.WaitForState(self.test_run_id, 'QUEUED')
     # Lease task and start test run
     self.task = self.container.LeaseTask(
         integration_util.DeviceInfo(self.device_serial))
     self.container.SubmitCommandEvent(self.task, 'InvocationStarted')
     self.container.WaitForState(self.test_run_id, 'RUNNING')
 def testCompleted_failure(self):
     """Test that failed tests will trigger an automatic retry."""
     self.container.SubmitCommandEvent(self.task,
                                       'InvocationCompleted',
                                       data={
                                           'failed_test_count': 1,
                                           'passed_test_count': 1,
                                       })
     self.container.WaitForState(self.test_run_id,
                                 'QUEUED')  # Back to QUEUED
     # Retry attempt can be leased
     retry = self.container.LeaseTask(
         integration_util.DeviceInfo(self.device_serial))
     self.assertIsNotNone(retry)
     self.assertNotEqual(self.task['attempt_id'], retry['attempt_id'])
     # Test run will contain result information
     test_run = self.container.GetTestRun(self.test_run_id)
     self.assertEqual('2', test_run['total_test_count'])
     self.assertEqual('1', test_run['failed_test_count'])
Example #7
0
 def setUp(self):
     super(FileServerIntegrationTest, self).setUp()
     # Upload test resource to local file store
     test_resource_file = os.path.join(TEST_DATA_DIR, 'android-cts.zip')
     self.container.UploadFile(test_resource_file,
                               'local_file_store/android-cts.zip')
     # Schedule test run with test resource
     self.device_serial = str(uuid.uuid4())
     self.test_run_id = self.container.ScheduleTestRun(
         self.device_serial,
         test_id='android.cts.9_0.arm',
         test_resource_objs=[{
             'name':
             'android-cts.zip',
             'url':
             'file://localhost/data/local_file_store/android-cts.zip',
         }])['id']
     # Lease task, allowing additional time for resource download
     self.container.WaitForState(self.test_run_id, 'QUEUED', timeout=60)
     self.task = self.container.LeaseTask(
         integration_util.DeviceInfo(self.device_serial))