Пример #1
0
    def test_exec_mode(self):
        """Test exec mode"""
        action = Action(name='start', command='echo %%h %%rank',
                        target='%s,localhost' % HOSTNAME)
        action.mode = 'exec'
        svc = Service('test')
        svc.add_action(action)
        svc.resolve_all()
        svc.run('start')

        # Need 2 checks because we do not know which target will be used first
        outputs = [action.worker.node_buffer(HOSTNAME),
                   action.worker.node_buffer('localhost')]
        self.assertTrue(outputs == ["%s 0" % HOSTNAME, "localhost 1"] or
                        outputs == ["%s 1" % HOSTNAME, "localhost 0"])
Пример #2
0
    def test_exec_mode(self):
        """Test exec mode"""
        action = Action(name='start',
                        command='echo %%h %%rank',
                        target='%s,localhost' % HOSTNAME)
        action.mode = 'exec'
        svc = Service('test')
        svc.add_action(action)
        svc.resolve_all()
        svc.run('start')

        # Need 2 checks because we do not know which target will be used first
        outputs = [
            action.worker.node_buffer(HOSTNAME).decode(),
            action.worker.node_buffer('localhost').decode()
        ]
        self.assertTrue(outputs == ["%s 0" % HOSTNAME, "localhost 1"]
                        or outputs == ["%s 1" % HOSTNAME, "localhost 0"])