Exemplo n.º 1
0
    def test_run(self):
        """Invokes the run class method on an agent.

        This will create an agent instance,  parse the cli args, passes them to
        the agent, and starts the agent runner.
        """
        self.change_args("es-agent", "--zookeeper-servers", get_test_zookeeper_address())
        runner = self.mocker.patch(AgentRunner)
        runner.run()
        mock_agent = self.mocker.patch(BaseAgent)

        def match_args(config):
            self.assertEqual(config["zookeeper_servers"], get_test_zookeeper_address())
            return True

        mock_agent.configure(MATCH(match_args))
        self.mocker.passthrough()

        self.mocker.replay()
        BaseAgent.run()
Exemplo n.º 2
0
    def test_run(self):
        """Invokes the run class method on an agent.

        This will create an agent instance,  parse the cli args, passes them to
        the agent, and starts the agent runner.
        """
        self.change_args("es-agent", "--zookeeper-servers",
                         get_test_zookeeper_address())
        runner = self.mocker.patch(AgentRunner)
        runner.run()
        mock_agent = self.mocker.patch(BaseAgent)

        def match_args(config):
            self.assertEqual(config["zookeeper_servers"],
                             get_test_zookeeper_address())
            return True

        mock_agent.configure(MATCH(match_args))
        self.mocker.passthrough()

        self.mocker.replay()
        BaseAgent.run()