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.")