Esempio n. 1
0
  def test_reset_completed_build(self):
    self.test_build.status = model.BuildStatus.COMPLETED
    self.test_build.result = model.BuildResult.SUCCESS
    self.test_build.put()

    with self.assertRaises(errors.BuildIsCompletedError):
      service.reset(self.test_build.key.id())
Esempio n. 2
0
 def clear(self):
   self.totalUtilityList = []
   self.utilityValue = 1e12
   self.roundCount = 0;
   for node in self.computationNodes:
     node.reset()
   for service in self.services:
     service.reset()
   self.I = np.zeros((len(self.computationNodes), len(self.services)),dtype=bool)
Esempio n. 3
0
 def test_reset(self):
     build = self.new_started_build(id=1)
     build = service.reset(1)
     self.assertEqual(build.proto.status, common_pb2.SCHEDULED)
     self.assertEqual(build.status_changed_time, utils.utcnow())
     self.assertIsNone(build.lease_key)
     self.assertIsNone(build.lease_expiration_date)
     self.assertIsNone(build.leasee)
     self.lease(1)
Esempio n. 4
0
 def test_reset(self):
   self.lease()
   build = service.reset(self.test_build.key.id())
   self.assertEqual(build.status, model.BuildStatus.SCHEDULED)
   self.assertEqual(build.status_changed_time, utils.utcnow())
   self.assertIsNone(build.lease_key)
   self.assertIsNone(build.lease_expiration_date)
   self.assertIsNone(build.leasee)
   self.assertTrue(self.lease())
Esempio n. 5
0
 def test_reset_with_auth_error(self):
     self.new_leased_build(id=1)
     self.mock_cannot(user.Action.RESET_BUILD)
     with self.assertRaises(auth.AuthorizationError):
         service.reset(1)
Esempio n. 6
0
 def test_cannot_reset_nonexistent_build(self):
     with self.assertRaises(errors.BuildNotFoundError):
         service.reset(123)
Esempio n. 7
0
 def test_reset_completed_build(self):
     self.classic_build(id=1, status=common_pb2.SUCCESS).put()
     with self.assertRaises(errors.BuildIsCompletedError):
         service.reset(1)
Esempio n. 8
0
 def test_reset_is_idempotent(self):
     self.new_leased_build(id=1)
     service.reset(1)
     service.reset(1)
Esempio n. 9
0
 def reset(self, request):
     """Forcibly unleases a build and resets its state to SCHEDULED."""
     build = service.reset(request.id)
     return build_to_response_message(build)
Esempio n. 10
0
 def reset(self, request):
   """Forcibly unleases a build and resets its state to SCHEDULED."""
   build = service.reset(request.id)
   return build_to_response_message(build)
Esempio n. 11
0
 def test_reset_with_auth_error(self):
   self.lease()
   self.mock_cannot(acl.Action.RESET_BUILD)
   with self.assertRaises(auth.AuthorizationError):
     service.reset(self.test_build.key.id())
Esempio n. 12
0
 def test_cannot_reset_nonexistent_build(self):
   with self.assertRaises(errors.BuildNotFoundError):
     service.reset(123)
Esempio n. 13
0
 def test_reset_is_idempotent(self):
   self.lease()
   build_id = self.test_build.key.id()
   service.reset(build_id)
   service.reset(build_id)