本文整理汇总了Python中remote.remote_util.RemoteMachineShellConnection.wait_till_file_added方法的典型用法代码示例。如果您正苦于以下问题:Python RemoteMachineShellConnection.wait_till_file_added方法的具体用法?Python RemoteMachineShellConnection.wait_till_file_added怎么用?Python RemoteMachineShellConnection.wait_till_file_added使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类remote.remote_util.RemoteMachineShellConnection
的用法示例。
在下文中一共展示了RemoteMachineShellConnection.wait_till_file_added方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_win_install
# 需要导入模块: from remote.remote_util import RemoteMachineShellConnection [as 别名]
# 或者: from remote.remote_util.RemoteMachineShellConnection import wait_till_file_added [as 别名]
def test_win_install(self):
query = BuildQuery()
builds, changes = query.get_all_builds()
version = self.input.test_params['version']
os_version = self.input.test_params['win']
task = 'install'
ok = True
ex_type = 'exe'
bat_file = 'install.bat'
version_file = 'VERSION.txt'
if self.input.test_params["ostype"] == '64':
Arch = 'x86_64'
os_type = '64'
elif self.input.test_params["ostype"] == '32':
Arch = 'x86'
os_type = '32'
else:
ok = False
self.log.error("Unknown os version.")
product = self.input.test_params["product"]
if product == 'cse':
name = 'couchbase-server-enterprise'
elif product == 'csse':
name = 'couchbase-single-server-enterprise'
elif product == 'csc':
name = 'couchbase-server-community'
elif product == 'cssc':
name = 'couchbase-single-server-community'
else:
ok = False
self.log.error("Unknon product type.")
cb_server_alias = ['cse','csc']
cb_single_alias = ['csse','cssc']
if product in cb_server_alias:
server_path = "/cygdrive/c/Program Files/Couchbase/Server/"
elif product in cb_single_alias:
server_path = "/cygdrive/c/Program Files (x86)/Couchbase/Server/"
if ok:
for serverInfo in self.servers:
remote_client = RemoteMachineShellConnection(serverInfo)
info = RemoteMachineShellConnection(serverInfo).extract_remote_info()
build = query.find_build(builds, name, ex_type, Arch, version)
#self.log.info("what is this {0}".format(build.url))
# check if previous couchbase server installed
exist = remote_client.file_exists("/cygdrive/c/Program Files/Couchbase/Server/", version_file)
if exist:
# call uninstall function to install couchbase server
self.log.info("Start uninstall cb server on this server")
self.test_win_uninstall(remote_client, product, os_type, os_version, version, server_path)
else:
self.log.info('I am free. You can install couchbase server now')
# directory path in remote server used to create or delete directory
dir_paths = ['/cygdrive/c/automation','/cygdrive/c/tmp']
remote_client.create_multiple_dir(dir_paths)
# copy files from local server to remote server
remote_client.copy_files_local_to_remote('resources/windows/automation', '/cygdrive/c/automation')
downloaded = remote_client.download_binary_in_win(build.url,product,version)
if downloaded:
self.log.info('Successful download {0}_{1}.exe'.format(product, version))
else:
self.log.error('Download {0}_{1}.exe failed'.format(product, version))
remote_client.modify_bat_file('/cygdrive/c/automation', bat_file,
product, os_type, os_version, version, task)
self.log.info('sleep for 5 seconds before running task schedule install me')
time.sleep(5)
# run task schedule to install Couchbase Server
output, error = remote_client.execute_command("cmd /c schtasks /run /tn installme")
remote_client.log_command_output(output, error)
remote_client.wait_till_file_added(server_path, version_file, timeout_in_seconds=600)
self.log.info('sleep 15 seconds before running the next job ...')
time.sleep(15)
else:
self.log.error("Can not install Couchbase Server.")