def test_expiring_reservation(self):
     with session.begin():
         # recipe running /distribution/reservesys expiring soon
         expiring_soon = data_setup.create_recipe_reservation(self.user, u'/distribution/reservesys',
                                                       (self.reservation_expiry - 1) * 3600)
         # recipe running /distribution/reservesys expiring after the cut-off
         expiring_later = data_setup.create_recipe_reservation(self.user, u'/distribution/reservesys',
                                                       (self.reservation_expiry * 2) * 3600)
         # recipe expiring soon but running a real task
         not_reserved = data_setup.create_recipe_reservation(self.user, u'/something/else',
                                                      (self.reservation_expiry - 1) * 3600)
     beaker_usage = BeakerUsage(self.user, self.reservation_expiry, self.reservation_length,
                                self.waiting_recipe_age, self.delayed_job_age)
     expiring_reservations = beaker_usage.expiring_reservations()
     self.assertEqual(len(expiring_reservations), 1)
     self.assertEqual(expiring_reservations[0][1], expiring_soon.resource.fqdn)
Exemple #2
0
    def _create_expiring_reservation(self):
        recipe = data_setup.create_recipe_reservation(self.user, u'/distribution/reservesys',
                                                      (self.reservation_expiry - 1) * 3600)
        email_content = u"""
Your reservations of the following systems in %s are going to expire within %s hours.
If you wish to ensure you retain the contents of these systems, please extend your reservation.

Expiry Date              FQDN
%s      %s
"""     % (absolute_url('/'),
           self.reservation_expiry,
           recipe.watchdog.kill_time.strftime('%Y-%m-%d %H:%M:%S'),
           recipe.resource.fqdn)
        return email_content
Exemple #3
0
    def _create_expiring_reservation(self):
        recipe = data_setup.create_recipe_reservation(self.user, u'/distribution/reservesys',
                                                      (self.reservation_expiry - 1) * 3600)
        email_content = u"""
Your reservations of the following systems in %s are going to expire within %s hours.
If you wish to ensure you retain the contents of these systems, please extend your reservation.

Expiry Date              FQDN
%s      %s
"""     % (absolute_url('/'),
           self.reservation_expiry,
           recipe.watchdog.kill_time.strftime('%Y-%m-%d %H:%M:%S'),
           recipe.resource.fqdn)
        return email_content