def stop_host(self, host_name): if host_name not in self.all_hosts(): raise Exception('Must specify external hostname to stop_host') # Change the topology to something that doesn't exist ips = self.get_ip_address_dict() down_hostname = self.get_down_hostname(host_name) self.exec_cmd_on_host( self.master, 'sed -i s/%s/%s/g %s' % (host_name, down_hostname, get_config_file_path()) ) self.exec_cmd_on_host( self.master, 'sed -i s/%s/%s/g %s' % (ips[host_name], down_hostname, get_config_file_path()) ) index = self.all_hosts().index(host_name) self.exec_cmd_on_host( self.master, 'sed -i s/%s/%s/g %s' % (self.all_internal_hosts()[index], down_hostname, get_config_file_path()) ) if index >= len(self.internal_slaves): self.internal_master = down_hostname else: self.internal_slaves[index] = down_hostname
def dump_and_cp_topology(self, topology, cluster=None): if not cluster: cluster = self.cluster cluster.write_content_to_host( json.dumps(topology), get_config_file_path(), cluster.master )
def dump_and_cp_topology(self, topology, cluster=None): if not cluster: cluster = self.cluster cluster.write_content_to_host( json.dumps(topology), get_config_file_path(), cluster.master )
def test_topology_show_bad_json(self): self.cluster.copy_to_host( os.path.join(LOCAL_RESOURCES_DIR, 'invalid_json.json'), self.cluster.master) self.cluster.exec_cmd_on_host( self.cluster.master, 'cp %s %s' % (os.path.join(self.cluster.mount_dir, 'invalid_json.json'), get_config_file_path())) self.assertRaisesRegexp( OSError, 'Expecting , delimiter: line 3 column 3 ' '\(char 21\) More detailed information ' 'can be found in ' '.*/.prestoadmin/log/presto-admin.log\n', self.run_prestoadmin, 'topology show')
def stop_host(self, host_name): if host_name not in self.all_hosts(): raise Exception('Must specify external hostname to stop_host') # Change the topology to something that doesn't exist ips = self.get_ip_address_dict() down_hostname = self.get_down_hostname(host_name) self.exec_cmd_on_host( self.master, 'sed -i s/%s/%s/g %s' % (host_name, down_hostname, get_config_file_path())) self.exec_cmd_on_host( self.master, 'sed -i s/%s/%s/g %s' % (ips[host_name], down_hostname, get_config_file_path())) index = self.all_hosts().index(host_name) self.exec_cmd_on_host( self.master, 'sed -i s/%s/%s/g %s' % (self.all_internal_hosts()[index], down_hostname, get_config_file_path())) if index >= len(self.internal_slaves): self.internal_master = down_hostname else: self.internal_slaves[index] = down_hostname
def test_topology_show_bad_json(self): self.cluster.copy_to_host( os.path.join(LOCAL_RESOURCES_DIR, 'invalid_json.json'), self.cluster.master ) self.cluster.exec_cmd_on_host( self.cluster.master, 'cp %s %s' % (os.path.join(self.cluster.mount_dir, 'invalid_json.json'), get_config_file_path()) ) self.assertRaisesRegexp(OSError, 'Expecting , delimiter: line 3 column 3 ' '\(char 21\) More detailed information ' 'can be found in ' '.*/.prestoadmin/log/presto-admin.log\n', self.run_prestoadmin, 'topology show')
def assert_installed(testcase, msg=None): testcase.cluster.exec_cmd_on_host( testcase.cluster.master, 'test -r %s' % get_config_file_path())