Exemplo n.º 1
0
 def setUp(self):
     """ Create a dummy supvisors and a ZMQ context. """
     from supvisors.supvisorszmq import create_zmq_context
     # the dummy Supvisors is used for addresses and ports
     self.supvisors = DummySupvisors()
     # create the ZeroMQ context
     self.zmq_context = create_zmq_context()
Exemplo n.º 2
0
 def setUp(self):
     """ Create a dummy supvisors, ZMQ context and sockets. """
     from supvisors.supvisorszmq import create_zmq_context, RequestPusher, RequestPuller
     # the dummy Supvisors is used for addresses and ports
     self.supvisors = DummySupvisors()
     # create the ZeroMQ context
     self.zmq_context = create_zmq_context()
     # create pusher and puller
     self.pusher = RequestPusher(self.zmq_context, self.supvisors)
     self.puller = RequestPuller(self.zmq_context, self.supvisors)
     # socket configuration is meant to be blocking
     # however, a failure would block the unit test, so a timeout is set for reception
     self.puller.socket.setsockopt(zmq.RCVTIMEO, 1000)
Exemplo n.º 3
0
 def setUp(self):
     """ Create a dummy supvisors, ZMQ context and sockets. """
     from supvisors.supvisorszmq import create_zmq_context, InternalEventPublisher, InternalEventSubscriber
     # the dummy Supvisors is used for addresses and ports
     self.supvisors = DummySupvisors()
     # create the ZeroMQ context
     self.zmq_context = create_zmq_context()
     # create publisher and subscriber
     self.publisher = InternalEventPublisher(self.zmq_context,
                                             self.supvisors)
     self.subscriber = InternalEventSubscriber(self.zmq_context,
                                               self.supvisors)
     # socket configuration is meant to be blocking
     # however, a failure would block the unit test, so a timeout is set for reception
     self.subscriber.socket.setsockopt(zmq.RCVTIMEO, 1000)
     # publisher does not wait for subscriber clients to work, so give some time for connections
     time.sleep(1)
Exemplo n.º 4
0
 def setUp(self):
     """ Create a dummy supvisors. """
     self.supvisors = DummySupvisors()
     # add addresses to context
     from supvisors.ttypes import AddressStates
     self.supvisors.context.addresses['10.0.0.0'] = DummyAddressStatus(
         '10.0.0.0', AddressStates.SILENT, 0)
     self.supvisors.context.addresses['10.0.0.1'] = DummyAddressStatus(
         '10.0.0.1', AddressStates.RUNNING, 50)
     self.supvisors.context.addresses['10.0.0.2'] = DummyAddressStatus(
         '10.0.0.2', AddressStates.ISOLATED, 0)
     self.supvisors.context.addresses['10.0.0.3'] = DummyAddressStatus(
         '10.0.0.3', AddressStates.RUNNING, 20)
     self.supvisors.context.addresses['10.0.0.4'] = DummyAddressStatus(
         '10.0.0.4', AddressStates.UNKNOWN, 0)
     self.supvisors.context.addresses['10.0.0.5'] = DummyAddressStatus(
         '10.0.0.5', AddressStates.RUNNING, 80)
     # initialize dummy address mapper with all address names (keep the alpha order)
     self.supvisors.address_mapper.addresses = sorted(
         self.supvisors.context.addresses.keys())
Exemplo n.º 5
0
 def setUp(self):
     """ Create a dummy supvisors and a ZMQ context. """
     from supvisors.supvisorszmq import create_zmq_context, EventPublisher, EventSubscriber
     # the dummy Supvisors is used for addresses and ports
     self.supvisors = DummySupvisors()
     # create the ZeroMQ context
     self.zmq_context = create_zmq_context()
     # create publisher and subscriber
     self.publisher = EventPublisher(self.zmq_context, self.supvisors)
     self.subscriber = EventSubscriber(self.zmq_context,
                                       self.supvisors.options.event_port,
                                       self.supvisors.logger)
     # WARN: this subscriber does not include a subscription
     # when using a subscription, use a time sleep to give time to PyZMQ to handle it
     # WARN: socket configuration is meant to be blocking
     # however, a failure would block the unit test, so a timeout is set for reception
     self.subscriber.socket.setsockopt(zmq.RCVTIMEO, 1000)
     # create test payloads
     self.supvisors_payload = Payload({
         'state': 'running',
         'version': '1.0'
     })
     self.address_payload = Payload({
         'state': 'silent',
         'name': 'cliche01',
         'date': 1234
     })
     self.application_payload = Payload({
         'state': 'starting',
         'name': 'supvisors'
     })
     self.process_payload = Payload({
         'state': 'running',
         'process_name': 'plugin',
         'application_name': 'supvisors',
         'date': 1230
     })
Exemplo n.º 6
0
 def setUp(self):
     """ Create a dummy supvisors. """
     self.supvisors = DummySupvisors()
Exemplo n.º 7
0
 def setUp(self):
     """ Create a logger that stores log traces. """
     self.supvisors = DummySupvisors()
     from supvisors.ttypes import AddressStates
     self.all_states = AddressStates._values()
Exemplo n.º 8
0
 def setUp(self):
     """ Create a logger that stores log traces. """
     self.supvisors = DummySupvisors()