def assert_installed(testcase, package_filename=None): # Verify that the package file exists if package_filename is None: _, package_filename = \ SliderPrestoInstaller._detect_presto_package(testcase) si = SliderInstaller(testcase) keywords = si.get_keywords() hdfs_cmd = 'hdfs dfs -ls %s' % ( os.path.join('/', 'user', keywords[SLIDER_USER], '.slider', 'package', keywords[APPNAME], os.path.basename(package_filename)) ) testcase.cluster.exec_cmd_on_host( SliderPrestoInstaller._get_slider_master(testcase), hdfs_cmd, SliderPrestoInstaller._get_slider_user(testcase)) # Verify that slider thinks the package is installed conf = TestSliderInstallation.get_config() slider_cmd = \ "bash -c 'export HADOOP_CONF_DIR=%s ; %s package --list'" % ( conf[HADOOP_CONF], get_slider_bin(conf)) output = testcase.cluster.exec_cmd_on_host( SliderPrestoInstaller._get_slider_master(testcase), slider_cmd, user=SliderPrestoInstaller._get_slider_user(testcase)) testcase.assertRegexpMatches(output, r'\b%s\b' % (conf[APPNAME]))
def assert_installed(testcase, package_filename=None): # Verify that the package file exists if package_filename is None: _, package_filename = \ SliderPrestoInstaller._detect_presto_package(testcase) si = SliderInstaller(testcase) keywords = si.get_keywords() hdfs_cmd = 'hdfs dfs -ls %s' % (os.path.join( '/', 'user', keywords[SLIDER_USER], '.slider', 'package', keywords[APPNAME], os.path.basename(package_filename))) testcase.cluster.exec_cmd_on_host( SliderPrestoInstaller._get_slider_master(testcase), hdfs_cmd, SliderPrestoInstaller._get_slider_user(testcase)) # Verify that slider thinks the package is installed conf = get_config() slider_cmd = \ "bash -c 'export HADOOP_CONF_DIR=%s ; %s package --list'" % ( conf[HADOOP_CONF], get_slider_bin(conf)) output = testcase.cluster.exec_cmd_on_host( SliderPrestoInstaller._get_slider_master(testcase), slider_cmd, user=SliderPrestoInstaller._get_slider_user(testcase)) testcase.assertRegexpMatches(output, r'\b%s\b' % (conf[APPNAME]))
def run_with_config(self, conf): conf = upload_config(self.cluster, conf) self.assert_slider_not_installed(conf) slider_path = SliderInstaller.copy_slider_dist_to_cluster(self) SliderInstaller.install_slider_package(self, slider_path) SliderInstaller.assert_installed(self, conf)
def run_interactive(self, conf): expect = self._get_interactive_config(conf) self.assert_slider_not_installed(conf) self.ensure_slider_user_exists(conf) slider_path = SliderInstaller.copy_slider_dist_to_cluster(self) self.run_prestoadmin_expect('slider install %s' % (slider_path,), expect) SliderInstaller.assert_installed(self, conf)
def run_interactive(self, conf): expect = self._get_interactive_config(conf) self.assert_slider_not_installed(conf) self.ensure_slider_user_exists(conf) slider_path = SliderInstaller.copy_slider_dist_to_cluster(self) self.run_prestoadmin_expect('slider install %s' % (slider_path, ), expect) SliderInstaller.assert_installed(self, conf)