def test05_delete_package_from_archive_on_standby(self): ''' Known issue: MPP-15737 ''' gppkg_file = self.gppkg_spec.get_filename() archive_file = os.path.join(ARCHIVE_PATH, gppkg_file) self.install(gppkg_file) # Remove package from standby standby = get_host_list()[0] RemoveRemoteFile(os.path.join(ARCHIVE_PATH, gppkg_file), standby).run() try: self.install(gppkg_file) except ExecutionError, e: Scp(name="copy to segment", srcFile=gppkg_file, dstFile=archive_file, srcHost=None, dstHost=standby).run(validateAfter=True) self.fail("ExecutionError %s" % e)
def test04_delete_package_from_archive_on_segment(self): ''' Known issue: MPP-15737 ''' gppkg_file = self.gppkg_spec.get_filename() archive_file = os.path.join(ARCHIVE_PATH, gppkg_file) self.install(gppkg_file) # Remove package from archive segment_host_list = get_host_list()[1] self.assertTrue(len(segment_host_list) > 0) RemoveRemoteFile(archive_file, segment_host_list[0]) try: self.install(gppkg_file) except ExecutionError as e: Scp(name="copy to segment", srcFile=gppkg_file, dstFile=archive_file, srcHost=None, dstHost=segment_host_list[0]).run(validateAfter=True) self.fail("ExecutionError %s" % e)
def test07_delete_package_from_archive_on_segment_and_uninstall(self): """ Delete a package from the archive on the segment and try to uninstall the gppkg. """ gppkg_file = self.alpha_spec.get_filename() archive_file = os.path.join(ARCHIVE_PATH, gppkg_file) self.install(gppkg_file) #Remove package from archive segment_host_list = get_host_list()[1] self.assertTrue(len(segment_host_list) > 0) host = segment_host_list[0] RemoveRemoteFile(archive_file, host).run() try: self.remove(gppkg_file) except ExecutionError as e: GpScp(source_path=gppkg_file, target_path=archive_file, host_list=segment_host_list).run() self.fail("ExecutionError %s" % str(e))
def test07_no_package_on_standby(self): """ This test covers the case when there is no package installed on the standby, but the package is installed across the other hosts in the cluster. JIRA - MPP-15969 """ self.install(self.alpha_spec.get_filename()) standby = get_host_list()[0] RemoveRemoteFile( os.path.join(ARCHIVE_PATH, self.alpha_spec.get_filename()), standby).run() self.uninstall_rpm_remotely(self.A_spec.get_filename(), standby) run_command(self.clean_command) self.check_remote_rpm_install(self.A_spec.get_package_name(), standby) self.assertTrue( CheckRemoteFile( os.path.join(ARCHIVE_PATH, self.alpha_spec.get_filename()), standby).run())
def test02_uninstall_rpm_on_standby_and_install(self): #Use gppkg from previous test gppkg_file = self.alpha_spec.get_filename() self.install(gppkg_file) standby = get_host_list()[0] self.uninstall_rpm_remotely(self.A_spec.get_filename(), standby) try: self.install(gppkg_file) except ExecutionError as e: #Install the rpm with closing(tarfile.open(self.alpha_spec.get_filename())) as tf: tf.extract(self.A_spec.get_filename()) Scp(name="copy rpm to standby", srcFile=self.A_spec.get_filename(), dstFile=self.A_spec.get_filename(), srcHost=None, dstHost=standby).run(validateAfter=True) self.install_rpm_remotely(self.A_spec.get_filename(), standby) os.remove(self.A_spec.get_filename()) RemoveRemoteFile(self.A_spec.get_filename(), standby).run() self.fail("ExecutionError %s" % e)
def test01_delete_package_from_archive_on_standby_and_uninstall(self): """ Known issue: MPP-15737 """ gppkg_file = self.alpha_spec.get_filename() archive_file = os.path.join(ARCHIVE_PATH, gppkg_file) self.install(gppkg_file) #Remove package from standby standby = get_host_list()[0] RemoveRemoteFile(os.path.join(ARCHIVE_PATH, gppkg_file), standby).run() try: self.remove(gppkg_file) except ExecutionError as e: GpScp(source_path=gppkg_file, target_path=archive_file, host_list=get_host_list()[1]).run() Scp(name="copy gppkg to standby", srcFile=gppkg_file, dstFile=archive_file, srcHost=None, dstHost=standby).run(validateAfter=True) self.fail("ExecutionError %s" % e)
def test06_delete_package_from_archive_on_segment_and_install(self): """ Delete a package from the archive on the segment and try to install the gppkg again. """ gppkg_file = self.alpha_spec.get_filename() archive_file = os.path.join(ARCHIVE_PATH, gppkg_file) self.install(gppkg_file) #Remove package from archive segment_host_list = get_host_list()[1] self.assertTrue(len(segment_host_list) > 0) host = segment_host_list[0] RemoveRemoteFile(archive_file, host).run() try: self.install(gppkg_file) except ExecutionError as e: Scp(name="copy gppkg to segment", srcFile=gppkg_file, dstFile=archive_file, srcHost=None, dstHost=host).run(validateAfter=True) self.fail("ExecutionError %s" % e)
operations = [] gparray = GpArray.initFromCatalog(dbconn.DbURL(port=self.master_port), utility=True) primaries = [ seg for seg in gparray.getDbList() if seg.isSegmentPrimary(current_role=True) ] for seg in primaries: path = os.path.join( seg.getSegmentDataDirectory(), DUMP_DIR, self.fake_timestamp[0:8], "%s0_%d_%s" % (DBDUMP_PREFIX, seg.getSegmentDbId(), self.fake_timestamp)) if self.compress: path += '.gz' host = seg.getSegmentHostName() operations.append(RemoveRemoteFile(path, host)) ParallelOperation(operations, self.batch_default).run() for operation in operations: try: operation.get_ret() except OSError, e: logger.warn('Failed to remove %s on %s' % (path, host)) def BuildRemoteTableDump(restore_tables, real_filename, fake_filename, compress, host): return RemoteOperation( BuildTableDump(restore_tables, real_filename, fake_filename, compress), host)