def create_presto_client(self, host=None): ips = self.cluster.get_ip_address_dict() config_path = os.path.join('~', LOCAL_CONF_DIR, COORDINATOR_DIR_NAME, CONFIG_PROPERTIES) config = self.cluster.exec_cmd_on_host(self.cluster.master, 'cat ' + config_path) user = '******' if host is None: host = self.cluster.master return PrestoClient(ips[host], user, PrestoConfig.from_file(StringIO(config), config_path, host))
def create_presto_client(self, host=None): ips = self.cluster.get_ip_address_dict() config_path = os.path.join('~', LOCAL_CONF_DIR, COORDINATOR_DIR_NAME, CONFIG_PROPERTIES) config = self.cluster.exec_cmd_on_host(self.cluster.master, 'cat ' + config_path) user = '******' if host is None: host = self.cluster.master return PrestoClient( ips[host], user, PrestoConfig.from_file(StringIO(config), config_path, host))
def __init__(self, server, user): # immutable stuff self.server = server self.user = user self.coordinator_config = PrestoConfig.coordinator_config() self.port = PrestoClient._get_configured_port(self.coordinator_config) # mutable stuff self.ca_file_path = "" self.keystore_data = "" self.rows = [] self.next_uri = '' self.response_from_server = {}
def _get_presto_config(self, config, node_config): config_file = StringIO(config) return PrestoConfig.from_file(config_file, StringIO(node_config))
def _get_presto_config(self, config): config_file = StringIO(config) return PrestoConfig.from_file(config_file)
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from mock import patch from prestoadmin.standalone.config import StandaloneConfig from prestoadmin.util.presto_config import PrestoConfig from tests.base_test_case import BaseTestCase PRESTO_CONFIG = PrestoConfig({ 'http-server.http.enabled': 'true', 'http-server.https.enabled': 'false', 'http-server.http.port': '8080', 'http-server.https.port': '7878', 'http-server.https.keystore.path': '/UPDATE/THIS/PATH', 'http-server.https.keystore.key': 'UPDATE PASSWORD'}, "TEST_PATH", "TEST_HOST") class BaseUnitCase(BaseTestCase): ''' Tasks generally require that the configuration they need to run has been loaded. This takes care of loading the config without going to the filesystem. For cases where you want to test the configuration load process itself, you should pass load_config=False to setUp. ''' def setUp(self, capture_output=False, load_config=True):
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from mock import patch from prestoadmin.standalone.config import StandaloneConfig from prestoadmin.util.presto_config import PrestoConfig from tests.base_test_case import BaseTestCase PRESTO_CONFIG = PrestoConfig( { 'http-server.http.enabled': 'true', 'http-server.https.enabled': 'false', 'http-server.http.port': '8080', 'http-server.https.port': '7878', 'http-server.https.keystore.path': '/UPDATE/THIS/PATH', 'http-server.https.keystore.key': 'UPDATE PASSWORD', 'internal-communication.shared-secret': 'update internal secret' }, {'node.environmet': 'presto'}, "TEST_PATH", "TEST_HOST") class BaseUnitCase(BaseTestCase): ''' Tasks generally require that the configuration they need to run has been loaded. This takes care of loading the config without going to the filesystem. For cases where you want to test the configuration load process itself, you should pass load_config=False to setUp. ''' def setUp(self, capture_output=False, load_config=True): super(BaseUnitCase, self).setUp(capture_output=capture_output)