Exemplo n.º 1
0
 def test_update_services_logs_when_service_not_recognised(self):
     service_name = factory.make_name("service")
     service = self.make_service(service_name)
     rack_controller = factory.make_RackController()
     with FakeLogger(services.__name__) as logger:
         update_services(rack_controller.system_id, [service])
     self.assertThat(
         logger.output,
         DocTestMatches(
             "Rack ... reported status for '...' but this is not a "
             "recognised service (status='...', info='...')."))
Exemplo n.º 2
0
 def test_update_services_updates_all_services(self):
     services = {
         service: self.make_service(service)
         for service in RACK_SERVICES
     }
     rack_controller = factory.make_RackController()
     update_services(rack_controller.system_id, services.values())
     for service in RACK_SERVICES:
         self.expectThat(
             Service.objects.get(node=rack_controller, name=service),
             MatchesStructure.byEquality(
                 status=services[service]["status"],
                 status_info=services[service]["status_info"]))