Esempio n. 1
0
 def test_recipe_not_provisioned_yet(self):
     with session.begin():
         recipe = data_setup.create_recipe()
         data_setup.create_job_for_recipes([recipe])
         data_setup.mark_recipe_scheduled(recipe, virt=True)
         # VM is created but recipe.provision() hasn't been called yet
     response = requests.get(get_server_base() + "systems/by-uuid/%s/ipxe-script" % recipe.resource.instance_id)
     self.assertEquals(response.status_code, 503)
Esempio n. 2
0
 def test_recipe_not_provisioned_yet(self):
     with session.begin():
         recipe = data_setup.create_recipe()
         data_setup.create_job_for_recipes([recipe])
         data_setup.mark_recipe_scheduled(recipe, virt=True)
         # VM is created but recipe.provision() hasn't been called yet
     response = requests.get(get_server_base() +
                             'systems/by-uuid/%s/ipxe-script' %
                             recipe.resource.instance_id)
     self.assertEquals(response.status_code, 503)
Esempio n. 3
0
 def test_get_scheduled_recipe(self):
     with session.begin():
         recipe = data_setup.create_recipe()
         job = data_setup.create_job_for_recipes([recipe])
         data_setup.mark_recipe_scheduled(recipe)
         self.assertIsNone(recipe.watchdog.kill_time)
     response = requests.get(get_server_base() +
             'recipes/%s' % recipe.id,
             headers={'Accept': 'application/json'})
     json = response.json()
     self.assertEquals(json['t_id'], recipe.t_id)
     # time_remaining_seconds should be None as the recipe sits in Scheduled
     # with no watchdog kill time.
     self.assertIsNone(json['time_remaining_seconds'])
Esempio n. 4
0
 def test_get_scheduled_recipe(self):
     with session.begin():
         recipe = data_setup.create_recipe()
         job = data_setup.create_job_for_recipes([recipe])
         data_setup.mark_recipe_scheduled(recipe)
         self.assertIsNone(recipe.watchdog.kill_time)
     response = requests.get(get_server_base() +
             'recipes/%s' % recipe.id,
             headers={'Accept': 'application/json'})
     json = response.json()
     self.assertEquals(json['t_id'], recipe.t_id)
     # time_remaining_seconds should be None as the recipe sits in Scheduled
     # with no watchdog kill time.
     self.assertIsNone(json['time_remaining_seconds'])
Esempio n. 5
0
    def test_scheduler_status_is_not_reset_on_already_released_systems(self):
        first_recipe = data_setup.create_recipe()
        second_recipe = data_setup.create_recipe()
        job = data_setup.create_job_for_recipesets([
                data_setup.create_recipeset_for_recipes([first_recipe]),
                data_setup.create_recipeset_for_recipes([second_recipe])])
        data_setup.mark_recipe_complete(first_recipe)
        first_system = first_recipe.resource.system
        self.assertEquals(first_system.scheduler_status, SystemSchedulerStatus.pending)
        # Pretend the scheduler has set the system back to idle
        first_system.scheduler_status = SystemSchedulerStatus.idle

        data_setup.mark_recipe_scheduled(second_recipe)
        job.update_status()
        # The bug was that job.update_status() would reset the *first* recipe's 
        # system back to pending, even though it had already been released and 
        # could potentially be reserved for another recipe already.
        self.assertEquals(first_system.scheduler_status, SystemSchedulerStatus.idle)