コード例 #1
0
    def test_start_smoketests_presto(
            self, execute_mock, unused_configure_mock, smoketest_presto_mock, create_connectors_mock):
        presto_coordinator = Coordinator()

        presto_coordinator.start(self.mock_env)

        assert smoketest_presto_mock.called
コード例 #2
0
    def test_start_smoketests_presto(
            self, execute_mock, unused_configure_mock, smoketest_presto_mock, create_connectors_mock):
        presto_coordinator = Coordinator()

        presto_coordinator.start(self.mock_env)

        assert smoketest_presto_mock.called
コード例 #3
0
    def test_lifecycle_methods_shell_out_to_execute(self, execute_mock,
                                                    unused_configure_mock,
                                                    unused_smoketest_presto):
        presto_coordinator = Coordinator()

        presto_coordinator.install(self.mock_env)
        assert execute_mock.call_count is 2
        assert 'wget' in execute_mock.call_args_list[0][0][0]
        assert 'rpm -i' in execute_mock.call_args_list[1][0][0]
        assert 'export JAVA8_HOME=' in execute_mock.call_args_list[1][0][0]
        execute_mock.reset_mock()

        presto_coordinator.stop(self.mock_env)
        assert execute_mock.call_count is 1
        assert 'stop' in execute_mock.call_args_list[0][0][0]
        execute_mock.reset_mock()

        presto_coordinator.start(self.mock_env)
        assert execute_mock.call_count is 1
        assert 'start' in execute_mock.call_args_list[0][0][0]
        execute_mock.reset_mock()

        presto_coordinator.status(self.mock_env)
        assert execute_mock.call_count is 1
        assert 'status' in execute_mock.call_args_list[0][0][0]
コード例 #4
0
    def test_configure_adds_tpch_connector(self, create_connectors_mock):
        presto_coordinator = Coordinator()
        open_mock = mock_open()

        with patch('__builtin__.open', open_mock):
            presto_coordinator.configure(self.mock_env)

        assert call({}, "{'tpch': ['connector.name=tpch']}") in create_connectors_mock.call_args_list
コード例 #5
0
    def test_configure_adds_tpch_connector(self, create_connectors_mock):
        presto_coordinator = Coordinator()
        open_mock = mock_open()

        with patch('__builtin__.open', open_mock):
            presto_coordinator.configure(self.mock_env)

        assert call({}, "{'tpch': ['connector.name=tpch']}") in create_connectors_mock.call_args_list
コード例 #6
0
    def test_install_start_configure_presto(
            self, unused_execute_mock, configure_mock, unused_smoketest_presto):
        presto_coordinator = Coordinator()

        presto_coordinator.install(self.mock_env)
        assert configure_mock.called
        configure_mock.reset_mock()

        presto_coordinator.start(self.mock_env)
        assert configure_mock.called
コード例 #7
0
    def test_install_start_configure_presto(
            self, unused_execute_mock, configure_mock, unused_smoketest_presto):
        presto_coordinator = Coordinator()

        presto_coordinator.install(self.mock_env)
        assert configure_mock.called
        configure_mock.reset_mock()

        presto_coordinator.start(self.mock_env)
        assert configure_mock.called
コード例 #8
0
    def test_lifecycle_methods_shell_out_to_execute(
            self, execute_mock, unused_configure_mock, unused_smoketest_presto):
        presto_coordinator = Coordinator()

        presto_coordinator.install(self.mock_env)
        assert execute_mock.call_count is 2
        assert 'wget' in execute_mock.call_args_list[0][0][0]
        assert 'rpm -i' in execute_mock.call_args_list[1][0][0]
        execute_mock.reset_mock()

        presto_coordinator.stop(self.mock_env)
        assert execute_mock.call_count is 1
        assert 'stop' in execute_mock.call_args_list[0][0][0]
        execute_mock.reset_mock()

        presto_coordinator.start(self.mock_env)
        assert execute_mock.call_count is 1
        assert 'start' in execute_mock.call_args_list[0][0][0]
        execute_mock.reset_mock()

        presto_coordinator.status(self.mock_env)
        assert execute_mock.call_count is 1
        assert 'status' in execute_mock.call_args_list[0][0][0]
コード例 #9
0
    def test_memory_settings_have_units(self, create_connectos_mock):
        config = collect_config_vars_written_out(self.mock_env, Coordinator())

        assert_memory_configs_properly_formatted(config)
コード例 #10
0
    def test_configure_pseudo_distributed(self, create_connectors_mock):
        config = collect_config_vars_written_out(self.mock_env, Coordinator())

        assert 'node-scheduler.include-coordinator=true\n' in config
コード例 #11
0
    def test_configure_ignore_empty_queue_config_file(self,
                                                      create_connectors_mock):
        config = collect_config_vars_written_out(self.mock_env, Coordinator())

        for item in config:
            assert not item.startswith('query.queue-config-file')
コード例 #12
0
    def test_assert_constant_properties(self, create_connectors_mock):
        config = collect_config_vars_written_out(self.mock_env, Coordinator())

        assert 'discovery-server.enabled=true\n' in config
        assert 'coordinator=true\n' in config
        assert 'node.data-dir=/var/lib/presto\n'