How to use get_filename method in Slash

Best Python code snippet using slash

test_regress_muck_with_internals.py

Source:test_regress_muck_with_internals.py Github

copy

Full Screen

...35 Known issue: MPP-1573736 """37 #Building off of last test case's state38 #Use gppkg from previous test39 gppkg_file = self.alpha_spec.get_filename()40 self.install(gppkg_file)41 #Remove the package from archive42 os.remove(os.path.join(ARCHIVE_PATH, gppkg_file))43 try:44 self.remove(self.alpha_spec.get_filename())45 except ExecutionError, e:46 shutil.copy(gppkg_file, os.path.join(ARCHIVE_PATH, gppkg_file))47 self.fail("Execution Error %s" % e)48 def test02_delete_rpm_and_install(self):49 """50 Delete the main comprising rpm from the master51 and try to install the gppkg again.52 """53 #Use gppkg from previous test54 gppkg_file = self.alpha_spec.get_filename()55 self.install(gppkg_file)56 57 #Uninstall the RPM58 self.uninstall_rpm(self.A_spec.get_filename()) 59 self.install(gppkg_file) 60 def test03_delete_rpm_and_uninstall(self):61 """62 Delete the main comprising rpm from the master63 and try to install the gppkg again.64 """65 #Use gppkg from previous test66 gppkg_file = self.alpha_spec.get_filename()67 self.install(gppkg_file)68 69 #Uninstall the RPM70 self.uninstall_rpm(self.A_spec.get_filename())71 self.remove(gppkg_file) 72 def test04_install_rpm_and_install(self):73 """74 Install the main comprising rpm on the master75 and try to install a gppkg.76 """77 with closing(tarfile.open(self.alpha_spec.get_filename())) as tf:78 tf.extract(self.A_spec.get_filename())79 80 self.install_rpm(self.A_spec.get_filename()) 81 #Use gppkg from previous test82 gppkg_file = self.alpha_spec.get_filename()83 84 self.install(gppkg_file)85 @unittest.expectedFailure86 def test05_install_rpm_and_uninstall(self):87 """88 Install the main comprising rpm on the master and 89 try to uninstall a gppkg.90 """91 with closing(tarfile.open(self.alpha_spec.get_filename())) as tf:92 tf.extract(self.A_spec.get_filename())93 94 self.install_rpm(self.A_spec.get_filename())95 gppkg_file = self.alpha_spec.get_filename()96 97 try: 98 self.remove(gppkg_file)99 except ExecutionError, e:100 run_command("rpm -e %s --dbpath %s" % (self.A_spec.get_package_name(), RPM_DATABASE))101 os.remove(self.A_spec.get_filename())102 self.fail("ExecutionError %s" % e)103 @skipIfSingleNode()104 @unittest.expectedFailure105 def test06_delete_package_from_archive_on_segment_and_install(self):106 """107 Delete a package from the archive on the segment 108 and try to install the gppkg again.109 """110 gppkg_file = self.alpha_spec.get_filename()111 archive_file = os.path.join(ARCHIVE_PATH, gppkg_file)112 self.install(gppkg_file)113 #Remove package from archive114 segment_host_list = get_host_list()[1]115 self.assertTrue(len(segment_host_list) > 0)116 host = segment_host_list[0]117 RemoveRemoteFile(archive_file ,host).run()118 try:119 self.install(gppkg_file)120 except ExecutionError, e:121 Scp(name = "copy gppkg to segment",122 srcFile = gppkg_file, 123 dstFile = archive_file, 124 srcHost = None,125 dstHost = host).run(validateAfter = True)126 self.fail("ExecutionError %s" % e)127 128 @skipIfSingleNode()129 @unittest.expectedFailure 130 def test07_delete_package_from_archive_on_segment_and_uninstall(self):131 """132 Delete a package from the archive on the segment133 and try to uninstall the gppkg.134 """135 gppkg_file = self.alpha_spec.get_filename()136 archive_file = os.path.join(ARCHIVE_PATH, gppkg_file)137 self.install(gppkg_file)138 #Remove package from archive139 segment_host_list = get_host_list()[1]140 self.assertTrue(len(segment_host_list) > 0)141 host = segment_host_list[0]142 RemoveRemoteFile(archive_file ,host).run()143 try:144 self.remove(gppkg_file)145 except ExecutionError, e:146 GpScp(source_path = gppkg_file,147 target_path = archive_file,148 host_list = segment_host_list).run()149 self.fail("ExecutionError %s" % str(e))150 @skipIfSingleNode()151 @unittest.expectedFailure152 def test08_uninstall_rpm_on_segments_and_install(self):153 """154 Try to install a gppkg again, when rpm has not been 155 installed on one of the segments.156 """157 #Use gppkg from previous test158 gppkg_file = self.alpha_spec.get_filename()159 self.install(gppkg_file)160 161 segment_host_list = get_host_list()[1]162 self.assertTrue(len(segment_host_list) > 0)163 host = segment_host_list[0]164 165 self.uninstall_rpm_remotely(self.A_spec.get_filename(), host)166 try:167 self.install(gppkg_file) 168 except ExecutionError, e:169 #Install the rpm 170 with closing(tarfile.open(self.alpha_spec.get_filename())) as tf:171 tf.extract(self.A_spec.get_filename())172 Scp(name = "copy rpm to segment", 173 srcFile = self.A_spec.get_filename(), 174 dstFile = self.A_spec.get_filename(), 175 srcHost = None,176 dstHost = host).run(validateAfter = True)177 self.install_rpm_remotely(self.A_spec.get_filename(), host)178 os.remove(self.A_spec.get_filename())179 RemoveRemoteFile(self.A_spec.get_filename(), host).run()180 self.fail("ExecutionError %s" % e)181 @skipIfSingleNode()182 def test09_uninstall_rpm_on_segments_and_uninstall(self):183 """184 Try to uninstall a gppkg when the rpm has already been 185 uninstalled on one of the segments.186 """187 #Use gppkg from previous test188 gppkg_file = self.alpha_spec.get_filename()189 self.install(gppkg_file)190 191 segment_host_list = get_host_list()[1]192 self.assertTrue(len(segment_host_list) > 0) 193 host = segment_host_list[0]194 195 self.uninstall_rpm_remotely(self.A_spec.get_filename(), host)196 self.remove(gppkg_file) 197 @skipIfSingleNode()198 def test10_install_rpm_on_segments_and_install(self):199 """200 Try to install a gppkg when an rpm has already been 201 installed on one of the segments.202 """203 gppkg_file = self.alpha_spec.get_filename()204 205 segment_host_list = get_host_list()[1]206 self.assertTrue(len(segment_host_list) > 0)207 host = segment_host_list[0]208 209 #Install the rpm 210 with closing(tarfile.open(self.alpha_spec.get_filename())) as tf:211 tf.extract(self.A_spec.get_filename())212 Scp(name = "copy rpm to segment", 213 srcFile = self.A_spec.get_filename(), 214 dstFile = self.A_spec.get_filename(), 215 srcHost = None, 216 dstHost = host).run(validateAfter = True)217 self.install_rpm_remotely(self.A_spec.get_filename(), host)218 self.install(gppkg_file) 219 @skipIfSingleNode()220 @unittest.expectedFailure221 def test11_install_rpm_on_segments_and_uninstall(self):222 """223 Try to uninstall a gppkg, when the gppkg has not been installed,224 but the main comprising rpm has been installed on one of the segments.225 The desired result is that the rpm should be uninstalled.226 """227 gppkg_file = self.alpha_spec.get_filename()228 229 segment_host_list = get_host_list()[1]230 self.assertTrue(len(segment_host_list) > 0)231 host = segment_host_list[0]232 #Install the rpm233 with closing(tarfile.open(self.alpha_spec.get_filename())) as tf:234 tf.extract(self.A_spec.get_filename())235 Scp(name = "copy rpm to segment",236 srcFile = self.A_spec.get_filename(),237 dstFile = self.A_spec.get_filename(), 238 srcHost = None,239 dstHost = host).run(validateAfter = True)240 self.install_rpm_remotely(self.A_spec.get_filename(), host)241 try:242 self.remove(gppkg_file)243 except ExecutionError, e:244 self.uninstall_rpm_remotely(self.A_spec.get_filename(), host)245 os.remove(self.A_spec.get_filename())246 RemoveRemoteFile(self.A_spec.get_filename(), host).run()247 self.fail("ExecutionError %s" % e)248if __name__ == "__main__":...

Full Screen

Full Screen

test_regress_clean_gppkg.py

Source:test_regress_clean_gppkg.py Github

copy

Full Screen

...10 cluster_host_list = [standby] + [host for host in segment_host_list] 11 def test00_build(self):12 self.build(self.alpha_spec, self.A_spec)13 def test01_install(self):14 self.install(self.alpha_spec.get_filename())15 def test02_no_packages_on_cluster(self):16 """17 This test covers the case when we run clean 18 with no packages installed on the cluster19 """20 run_command(self.clean_command) 21 standby, segment_host_list = get_host_list()22 cluster_host_list = [standby] + [host for host in segment_host_list] 23 for host in cluster_host_list:24 if host is not None:25 self.check_remote_rpm_uninstall(self.A_spec.get_package_name(), host)26 self.assertFalse(CheckRemoteFile(os.path.join(ARCHIVE_PATH, self.alpha_spec.get_filename()), host).run())27 def test03_no_package_on_master(self):28 """29 This test covers the case when there is no30 package installed on the master, but some31 package is installed on the rest of the cluster32 """33 self.install(self.alpha_spec.get_filename())34 35 os.remove(os.path.join(ARCHIVE_PATH, self.alpha_spec.get_filename()))36 37 self.uninstall_rpm(self.A_spec.get_filename())38 run_command(self.clean_command) 39 standby, segment_host_list = get_host_list()40 cluster_host_list = [standby] + [host for host in segment_host_list]41 42 for host in cluster_host_list:43 if host is not None:44 self.check_remote_rpm_uninstall(self.A_spec.get_package_name(), host)45 self.assertFalse(CheckRemoteFile(os.path.join(ARCHIVE_PATH, self.alpha_spec.get_filename()), host).run())46 @skipIfSingleNode()47 def test04_no_package_on_segment(self):48 """49 This test covers the case when there is no50 package installed on one of the segment, but51 it is installed on the master and everywhere else 52 """53 self.install(self.alpha_spec.get_filename())54 55 segment_host_list = get_host_list()[1]56 self.assertTrue(len(segment_host_list) > 0)57 host = segment_host_list[0] 58 59 RemoveRemoteFile(os.path.join(ARCHIVE_PATH, self.alpha_spec.get_filename()), host).run()60 self.uninstall_rpm_remotely(self.A_spec.get_filename(), host)61 run_command(self.clean_command)62 self.check_remote_rpm_install(self.A_spec.get_package_name(), host)63 self.assertTrue(CheckRemoteFile(os.path.join(ARCHIVE_PATH, self.alpha_spec.get_filename()), host).run())64 @unittest.expectedFailure65 def test05_no_rpm_on_master(self):66 """67 This test covers the case when the rpm has been 68 uninstalled on the master and the gppkg is in the archive, 69 and the rpms/gppkgs are intstalled on the segments. 70 JIRA - MPP-1596871 """72 self.install(self.alpha_spec.get_filename())73 74 self.uninstall_rpm(self.A_spec.get_filename())75 run_command(self.clean_command)76 self.check_rpm_install(self.A_spec.get_package_name())77 self.assertTrue(os.path.exists(os.path.join(ARCHIVE_PATH, self.alpha_spec.get_filename())))78 @skipIfSingleNode()79 @unittest.expectedFailure80 def test06_no_rpm_on_segment(self):81 """82 This test covers the case when the gppkg has been installed83 on the cluster and the rpm has not been installed properly on84 one of the segments. The gppkg however exists in the archive on85 the segment. 86 """87 self.install(self.alpha_spec.get_filename())88 89 segment_host_list = get_host_list()[1]90 self.assertTrue(len(segment_host_list) > 0)91 host = segment_host_list[0]92 self.uninstall_rpm_remotely(self.A_spec.get_filename(), host)93 run_command(self.clean_command)94 self.check_remote_rpm_install(self.A_spec.get_package_name(), host)95 self.assertTrue(CheckRemoteFile(os.path.join(ARCHIVE_PATH, self.alpha_spec.get_filename()), host).run())96 @skipIfNoStandby()97 def test07_no_package_on_standby(self):98 """99 This test covers the case when there is no package100 installed on the standby, but the package is installed101 across the other hosts in the cluster.102 JIRA - MPP-15969103 """ 104 self.install(self.alpha_spec.get_filename())105 standby = get_host_list()[0]106 107 RemoveRemoteFile(os.path.join(ARCHIVE_PATH, self.alpha_spec.get_filename()), standby).run()108 self.uninstall_rpm_remotely(self.A_spec.get_filename(), standby)109 run_command(self.clean_command)110 111 self.check_remote_rpm_install(self.A_spec.get_package_name(), standby)112 self.assertTrue(CheckRemoteFile(os.path.join(ARCHIVE_PATH, self.alpha_spec.get_filename()), standby).run())113 114 @skipIfNoStandby()115 @unittest.expectedFailure116 def test08_no_rpm_on_standby(self):117 """118 Covers the case when there is no rpm installed on the standby119 but the gppkg is present in the archive and the package has 120 been installed across other hosts in the cluster.121 JIRA - MPP-15968, MPP-15969122 """ 123 self.install(self.alpha_spec.get_filename())124 125 standby = get_host_list()[0]126 127 self.uninstall_rpm_remotely(self.A_spec.get_filename(), standby)128 run_command(self.clean_command)129 self.check_remote_rpm_install(self.A_spec.get_package_name(), standby)130 self.assertTrue(CheckRemoteFile(os.path.join(ARCHIVE_PATH, self.alpha_spec.get_filename()), standby).run())131if __name__ == "__main__":...

Full Screen

Full Screen

test_regress_muck_with_internals_on_standby.py

Source:test_regress_muck_with_internals_on_standby.py Github

copy

Full Screen

...30 def test01_delete_package_from_archive_on_standby_and_uninstall(self):31 """32 Known issue: MPP-1573733 """34 gppkg_file = self.alpha_spec.get_filename()35 archive_file = os.path.join(ARCHIVE_PATH, gppkg_file)36 self.install(gppkg_file)37 #Remove package from standby38 standby = get_host_list()[0] 39 RemoveRemoteFile(os.path.join(ARCHIVE_PATH, gppkg_file), standby).run()40 try:41 self.remove(gppkg_file)42 except ExecutionError, e:43 GpScp(source_path = gppkg_file,44 target_path = archive_file,45 host_list = get_host_list()[1]).run()46 Scp(name = "copy gppkg to standby",47 srcFile = gppkg_file,48 dstFile = archive_file, 49 srcHost = None, 50 dstHost = standby).run(validateAfter = True)51 self.fail("ExecutionError %s" % e)52 @unittest.expectedFailure53 def test02_uninstall_rpm_on_standby_and_install(self):54 #Use gppkg from previous test55 gppkg_file = self.alpha_spec.get_filename()56 self.install(gppkg_file)57 58 standby = get_host_list()[0]59 60 self.uninstall_rpm_remotely(self.A_spec.get_filename(), standby)61 try:62 self.install(gppkg_file) 63 except ExecutionError, e:64 #Install the rpm 65 with closing(tarfile.open(self.alpha_spec.get_filename())) as tf:66 tf.extract(self.A_spec.get_filename())67 Scp(name = "copy rpm to standby", 68 srcFile = self.A_spec.get_filename(), 69 dstFile = self.A_spec.get_filename(), 70 srcHost = None,71 dstHost = standby).run(validateAfter = True)72 self.install_rpm_remotely(self.A_spec.get_filename(), standby)73 os.remove(self.A_spec.get_filename())74 RemoveRemoteFile(self.A_spec.get_filename(), standby).run()75 self.fail("ExecutionError %s" % e)76 def test03_uninstall_rpm_on_standby_and_uninstall(self):77 #Use gppkg from previous test78 gppkg_file = self.alpha_spec.get_filename()79 self.install(gppkg_file)80 81 standby = get_host_list()[0]82 83 self.uninstall_rpm_remotely(self.A_spec.get_filename(), standby)84 self.remove(gppkg_file) 85 def test04_install_rpm_on_standby_and_install(self):86 gppkg_file = self.alpha_spec.get_filename()87 88 standby = get_host_list()[0]89 90 #Install the rpm 91 with closing(tarfile.open(self.alpha_spec.get_filename())) as tf:92 tf.extract(self.A_spec.get_filename())93 Scp(name = "copy the rpm to standby",94 srcFile = self.A_spec.get_filename(),95 dstFile = self.A_spec.get_filename(), 96 srcHost = None, 97 dstHost = standby).run(validateAfter = True)98 self.install_rpm_remotely(self.A_spec.get_filename(), standby)99 self.install(gppkg_file) 100 @unittest.expectedFailure101 def test05_install_rpm_on_standby_and_uninstall(self):102 gppkg_file = self.alpha_spec.get_filename()103 104 standby = get_host_list()[0]105 #Install the rpm106 with closing(tarfile.open(self.alpha_spec.get_filename())) as tf:107 tf.extract(self.A_spec.get_filename())108 Scp(name = "copy rpm to standby",109 srcFile = self.A_spec.get_filename(),110 dstFile = self.A_spec.get_filename(), 111 srcHost = None,112 dstHost = standby).run(validateAfter = True)113 self.install_rpm_remotely(self.A_spec.get_filename(), standby)114 try:115 self.remove(gppkg_file)116 except ExecutionError, e:117 self.uninstall_rpm_remotely(self.A_spec.get_filename(), standby)118 os.remove(self.A_spec.get_filename())119 RemoveRemoteFile(self.A_spec.get_filename(), standby).run()120 self.fail("ExecutionError %s" % e)121if __name__ == "__main__":...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Slash automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful