def test_configure_adds_tpch_connector(self, create_connectors_mock): presto_worker = Worker() with patch('__builtin__.open'): presto_worker.configure(self.mock_env) assert call({}, "{'tpch': ['connector.name=tpch']}") in create_connectors_mock.call_args_list
def test_install_start_configure_presto( self, unused_execute_mock, configure_mock): presto_worker = Worker() presto_worker.install(self.mock_env) assert configure_mock.called configure_mock.reset_mock() presto_worker.start(self.mock_env) assert configure_mock.called
def test_lifecycle_methods_shell_out_to_execute(self, execute_mock, unused_configure_mock): presto_worker = Worker() presto_worker.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_worker.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_worker.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_worker.status(self.mock_env) assert execute_mock.call_count is 1 assert 'status' in execute_mock.call_args_list[0][0][0]
def test_install_start_configure_presto(self, unused_execute_mock, configure_mock): presto_worker = Worker() presto_worker.install(self.mock_env) assert configure_mock.called configure_mock.reset_mock() presto_worker.start(self.mock_env) assert configure_mock.called
def test_lifecycle_methods_shell_out_to_execute( self, execute_mock, unused_configure_mock): presto_worker = Worker() presto_worker.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_worker.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_worker.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_worker.status(self.mock_env) assert execute_mock.call_count is 1 assert 'status' in execute_mock.call_args_list[0][0][0]
def test_configure_ignore_pseudo_distribute_enabled_property( self, create_connectors_mock): config = collect_config_vars_written_out(self.mock_env, Worker()) assert 'pseudo.distributed.enabled=true\n' not in config
def test_memory_settings_have_units(self, create_connectors_mock): from test_coordinator import assert_memory_configs_properly_formatted config = collect_config_vars_written_out(self.mock_env, Worker()) assert_memory_configs_properly_formatted(config)
def test_constant_properties(self, create_connectors_mock): config = collect_config_vars_written_out(self.mock_env, Worker()) assert 'coordinator=false\n' in config assert 'node.data-dir=/var/lib/presto\n' in config
def test_configure_ignore_empty_queue_config_file(self, create_connectors_mock): config = collect_config_vars_written_out(self.mock_env, Worker()) for item in config: assert not item.startswith('query.queue-config-file')