Ejemplo n.º 1
0
    def testIntegration(self):
        # CONFIG:
        config.beah_conf(args=[])
        conf = config.get_conf('beah')
        srv = start_server(conf=conf)
        log = logging.getLogger('backend')

        class FakeTask(object):
            origin = {'signature': 'FakeTask'}
            task_id = 'no-id'

            def proc_cmd(self, cmd):
                log.debug("FakeTask.proc_cmd(%r)", cmd)

        class FakeBackend(object):
            def proc_evt(self, evt, **kwargs):
                log.debug("FakeBackend.proc_evt(%r, **%r)", evt, kwargs)

        t = FakeTask()
        reactor.callLater(2, srv.proc_evt, t,
                          event.variable_set('say_hi', 'Hello World!'))
        #reactor.callLater(2.1, srv.proc_evt, t, event.variable_get('say_hi'))
        reactor.callLater(2.2, srv.proc_evt, t,
                          event.variable_get('say_hi', dest='test.loop'))

        b = FakeBackend()
        reactor.callLater(3, srv.proc_cmd, b, command.kill())

        forwarder.main(args=[])
Ejemplo n.º 2
0
    def testIntegration(self):
        # CONFIG:
        config.beah_conf(args=[])
        conf = config.get_conf('beah')
        srv = start_server(conf=conf)
        log = logging.getLogger('backend')

        class FakeTask(object):
            origin = {'signature':'FakeTask'}
            task_id = 'no-id'
            def proc_cmd(self, cmd):
                log.debug("FakeTask.proc_cmd(%r)", cmd)

        class FakeBackend(object):
            def proc_evt(self, evt, **kwargs):
                log.debug("FakeBackend.proc_evt(%r, **%r)", evt, kwargs)

        t = FakeTask()
        reactor.callLater(2, srv.proc_evt, t, event.variable_set('say_hi', 'Hello World!'))
        #reactor.callLater(2.1, srv.proc_evt, t, event.variable_get('say_hi'))
        reactor.callLater(2.2, srv.proc_evt, t, event.variable_get('say_hi', dest='test.loop'))

        b = FakeBackend()
        reactor.callLater(3, srv.proc_cmd, b, command.kill())

        forwarder.main(args=[])
Ejemplo n.º 3
0
 def xmlrpc_block(self, recipe_set_id, test_order, result_server, states,
                  hostnames):
     log.debug("XMLRPC: sync.block(%r, %r, %r, %r, %r)", recipe_set_id,
               test_order, result_server, states, hostnames)
     answ = []
     wait_for = []
     for hostname in hostnames:
         name = ('sync/recipe_set_%s/test_order_%s/long_state' %
                 (recipe_set_id, test_order))
         dest = self.trhostname(hostname)
         evt = event.variable_get(name, dest=dest)
         self.main.send_evt(evt)
         wait_for.append((name, '', dest))
     return self.main.wait_for_variables(wait_for, states)
Ejemplo n.º 4
0
 def xmlrpc_block(self, recipe_set_id, test_order, result_server, states,
         hostnames):
     log.debug("XMLRPC: sync.block(%r, %r, %r, %r, %r)", recipe_set_id,
             test_order, result_server, states, hostnames)
     answ = []
     wait_for = []
     for hostname in hostnames:
         name = ('sync/recipe_set_%s/test_order_%s/long_state'
                 % (recipe_set_id, test_order))
         dest = self.trhostname(hostname)
         evt = event.variable_get(name, dest=dest)
         self.main.send_evt(evt)
         wait_for.append((name, '', dest))
     return self.main.wait_for_variables(wait_for, states)