本文整理汇总了Python中tests.product.standalone.presto_installer.StandalonePrestoInstaller.assert_uninstalled方法的典型用法代码示例。如果您正苦于以下问题:Python StandalonePrestoInstaller.assert_uninstalled方法的具体用法?Python StandalonePrestoInstaller.assert_uninstalled怎么用?Python StandalonePrestoInstaller.assert_uninstalled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tests.product.standalone.presto_installer.StandalonePrestoInstaller
的用法示例。
在下文中一共展示了StandalonePrestoInstaller.assert_uninstalled方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestServerUninstall
# 需要导入模块: from tests.product.standalone.presto_installer import StandalonePrestoInstaller [as 别名]
# 或者: from tests.product.standalone.presto_installer.StandalonePrestoInstaller import assert_uninstalled [as 别名]
class TestServerUninstall(BaseProductTestCase):
def setUp(self):
super(TestServerUninstall, self).setUp()
self.installer = StandalonePrestoInstaller(self)
@attr('smoketest')
def test_uninstall(self):
self.setup_cluster(NoHadoopBareImageProvider(), STANDALONE_PRESTO_CLUSTER)
start_output = self.run_prestoadmin('server start')
process_per_host = self.get_process_per_host(start_output.splitlines())
self.assert_started(process_per_host)
cmd_output = self.run_prestoadmin(
'server uninstall', raise_error=False).splitlines()
self.assert_stopped(process_per_host)
expected = uninstall_output + self.expected_stop()[:]
self.assertRegexpMatchesLineByLine(cmd_output, expected)
for container in self.cluster.all_hosts():
self.assert_uninstalled_dirs_removed(container)
def assert_uninstalled_dirs_removed(self, container):
self.installer.assert_uninstalled(container)
self.assert_path_removed(container, '/etc/presto')
self.assert_path_removed(container, '/usr/lib/presto')
self.assert_path_removed(container, '/var/lib/presto')
self.assert_path_removed(container, '/usr/shared/doc/presto')
self.assert_path_removed(container, '/etc/init.d/presto')
def test_uninstall_twice(self):
self.test_uninstall()
output = self.run_prestoadmin('server uninstall', raise_error=False)
with open(os.path.join(LOCAL_RESOURCES_DIR, 'uninstall_twice.txt'),
'r') as f:
expected = f.read()
self.assertEqualIgnoringOrder(expected, output)
def test_uninstall_lost_host(self):
self.setup_cluster(NoHadoopBareImageProvider(), STANDALONE_PRESTO_CLUSTER)
self.cluster.stop_host(
self.cluster.slaves[0])
expected = self.down_node_connection_error(
self.cluster.internal_slaves[0])
cmd_output = self.run_prestoadmin('server uninstall',
raise_error=False)
self.assertRegexpMatches(cmd_output, expected)
for container in [self.cluster.internal_master,
self.cluster.internal_slaves[1],
self.cluster.internal_slaves[2]]:
self.assert_uninstalled_dirs_removed(container)
示例2: test_install_fails_java8_not_found
# 需要导入模块: from tests.product.standalone.presto_installer import StandalonePrestoInstaller [as 别名]
# 或者: from tests.product.standalone.presto_installer.StandalonePrestoInstaller import assert_uninstalled [as 别名]
def test_install_fails_java8_not_found(self):
installer = StandalonePrestoInstaller(self)
with relocate_jdk_directory(self.cluster, '/usr'):
self.upload_topology()
cmd_output = installer.install(pa_raise_error=False)
actual = cmd_output.splitlines()
num_failures = 0
for line in enumerate(actual):
if str(line).find('Error: Required Java version'
' could not be found') != -1:
num_failures += 1
self.assertEqual(4, num_failures)
for container in self.cluster.all_hosts():
installer.assert_uninstalled(container)
示例3: test_install_failure_without_java8_home
# 需要导入模块: from tests.product.standalone.presto_installer import StandalonePrestoInstaller [as 别名]
# 或者: from tests.product.standalone.presto_installer.StandalonePrestoInstaller import assert_uninstalled [as 别名]
def test_install_failure_without_java8_home(self):
installer = StandalonePrestoInstaller(self, dummy=True)
for container in self.cluster.all_hosts():
self.cluster.exec_cmd_on_host(container,
"mv /usr/java/jdk1.8.0_40 /usr/")
self.upload_topology()
cmd_output = installer.install(pa_raise_error=False)
actual = cmd_output.splitlines()
num_failures = 0
for line in enumerate(actual):
if str(line).find("Error: Required Java version"
" could not be found") != -1:
num_failures += 1
self.assertEqual(4, num_failures)
for container in self.cluster.all_hosts():
installer.assert_uninstalled(container, dummy=True)
示例4: TestPackageInstall
# 需要导入模块: from tests.product.standalone.presto_installer import StandalonePrestoInstaller [as 别名]
# 或者: from tests.product.standalone.presto_installer.StandalonePrestoInstaller import assert_uninstalled [as 别名]
class TestPackageInstall(BaseProductTestCase):
def setUp(self):
super(TestPackageInstall, self).setUp()
self.setup_cluster(NoHadoopBareImageProvider(), self.PA_ONLY_CLUSTER)
self.upload_topology()
self.installer = StandalonePrestoInstaller(self)
@attr('smoketest')
def test_package_install(self):
rpm_name = self.installer.copy_presto_rpm_to_master()
output = self.run_prestoadmin('package install '
'/mnt/presto-admin/%(rpm)s',
rpm=rpm_name)
for container in self.cluster.all_hosts():
self.installer.assert_installed(self, container,
msg=output)
def test_install_coord_using_dash_h(self):
rpm_name = self.installer.copy_presto_rpm_to_master()
output = self.run_prestoadmin(
'package install /mnt/presto-admin/%(rpm)s -H %(master)s',
rpm=rpm_name)
self.installer.assert_installed(self, self.cluster.master)
for slave in self.cluster.slaves:
self.installer.assert_uninstalled(slave, msg=output)
def test_install_worker_using_dash_h(self):
rpm_name = self.installer.copy_presto_rpm_to_master()
output = self.run_prestoadmin(
'package install /mnt/presto-admin/%(rpm)s -H %(slave1)s',
rpm=rpm_name)
self.installer.assert_installed(self, self.cluster.slaves[0],
msg=output)
self.installer.assert_uninstalled(self.cluster.master, msg=output)
self.installer.assert_uninstalled(self.cluster.slaves[1], msg=output)
self.installer.assert_uninstalled(self.cluster.slaves[2], msg=output)
def test_install_workers_using_dash_h(self):
rpm_name = self.installer.copy_presto_rpm_to_master()
output = self.run_prestoadmin('package install /mnt/presto-admin/'
'%(rpm)s -H %(slave1)s,%(slave2)s',
rpm=rpm_name)
self.installer.assert_installed(self, self.cluster.slaves[0],
msg=output)
self.installer.assert_installed(self, self.cluster.slaves[1],
msg=output)
self.installer.assert_uninstalled(self.cluster.master, msg=output)
self.installer.assert_uninstalled(self.cluster.slaves[2], msg=output)
def test_install_exclude_coord(self):
rpm_name = self.installer.copy_presto_rpm_to_master()
output = self.run_prestoadmin('package install /mnt/presto-admin/'
'%(rpm)s -x %(master)s', rpm=rpm_name)
self.installer.assert_uninstalled(self.cluster.master, msg=output)
for slave in self.cluster.slaves:
self.installer.assert_installed(self, slave, msg=output)
def test_install_exclude_worker(self):
rpm_name = self.installer.copy_presto_rpm_to_master()
output = self.run_prestoadmin('package install /mnt/presto-admin/'
'%(rpm)s -x %(slave1)s', rpm=rpm_name)
self.installer.assert_uninstalled(self.cluster.slaves[0], msg=output)
self.installer.assert_installed(self, self.cluster.slaves[1],
msg=output)
self.installer.assert_installed(self, self.cluster.master, msg=output)
self.installer.assert_installed(self, self.cluster.slaves[2],
msg=output)
def test_install_exclude_workers(self):
rpm_name = self.installer.copy_presto_rpm_to_master()
output = self.run_prestoadmin('package install /mnt/presto-admin/'
'%(rpm)s -x %(slave1)s,%(slave2)s',
rpm=rpm_name)
self.installer.assert_uninstalled(self.cluster.slaves[0], msg=output)
self.installer.assert_uninstalled(self.cluster.slaves[1], msg=output)
self.installer.assert_installed(self, self.cluster.master, msg=output)
self.installer.assert_installed(self, self.cluster.slaves[2],
msg=output)
def test_install_invalid_path(self):
rpm_name = self.installer.copy_presto_rpm_to_master()
cmd_output = self.run_prestoadmin('package install /mnt/presto-admin'
'/invalid-path/presto.rpm',
rpm=rpm_name, raise_error=False)
error = '\nFatal error: [%s] error: ' \
'/mnt/presto-admin/invalid-path/presto.rpm: open failed: ' \
'No such file or directory\n\nAborting.\n'
expected = ''
for host in self.cluster.all_internal_hosts():
expected += error % host
self.assertEqualIgnoringOrder(cmd_output, expected)
def test_install_no_path_arg(self):
self.installer.copy_presto_rpm_to_master()
output = self.run_prestoadmin('package install', raise_error=False)
#.........这里部分代码省略.........
示例5: TestPackageInstall
# 需要导入模块: from tests.product.standalone.presto_installer import StandalonePrestoInstaller [as 别名]
# 或者: from tests.product.standalone.presto_installer.StandalonePrestoInstaller import assert_uninstalled [as 别名]
class TestPackageInstall(BaseProductTestCase):
def setUp(self):
super(TestPackageInstall, self).setUp()
self.setup_cluster(NoHadoopBareImageProvider(), STANDALONE_PA_CLUSTER)
self.upload_topology()
self.installer = StandalonePrestoInstaller(self)
def tearDown(self):
self._assert_uninstall()
super(TestPackageInstall, self).tearDown()
def _assert_uninstall(self):
output = self.run_prestoadmin('package uninstall presto-server-rpm --force')
for container in self.cluster.all_hosts():
self.installer.assert_uninstalled(container, msg=output)
@attr('smoketest')
def test_package_installer(self):
rpm_name = self.installer.copy_presto_rpm_to_master()
# install
output = self.run_prestoadmin('package install %(rpm)s',
rpm=os.path.join(self.cluster.rpm_cache_dir, rpm_name))
for container in self.cluster.all_hosts():
self.installer.assert_installed(self, container, msg=output)
# uninstall
output = self.run_prestoadmin('package uninstall presto-server-rpm')
for container in self.cluster.all_hosts():
self.installer.assert_uninstalled(container, msg=output)
def test_install_using_dash_h(self):
rpm_name = self.installer.copy_presto_rpm_to_master()
# install onto master and slave2
output = self.run_prestoadmin('package install %(rpm)s -H %(master)s,%(slave2)s',
rpm=os.path.join(self.cluster.rpm_cache_dir, rpm_name))
self.installer.assert_installed(self, self.cluster.master, msg=output)
self.installer.assert_installed(self, self.cluster.slaves[1], msg=output)
self.installer.assert_uninstalled(self.cluster.slaves[0], msg=output)
self.installer.assert_uninstalled(self.cluster.slaves[2], msg=output)
# uninstall on slave2
output = self.run_prestoadmin('package uninstall presto-server-rpm -H %(slave2)s')
self.installer.assert_installed(self, self.cluster.master, msg=output)
for container in self.cluster.slaves:
self.installer.assert_uninstalled(container, msg=output)
# uninstall on rest
output = self.run_prestoadmin('package uninstall presto-server-rpm --force')
for container in self.cluster.all_hosts():
self.installer.assert_uninstalled(container, msg=output)
def test_install_exclude_nodes(self):
rpm_name = self.installer.copy_presto_rpm_to_master()
output = self.run_prestoadmin('package install %(rpm)s -x %(master)s,%(slave2)s',
rpm=os.path.join(self.cluster.rpm_cache_dir, rpm_name))
# install
self.installer.assert_uninstalled(self.cluster.master, msg=output)
self.installer.assert_uninstalled(self.cluster.slaves[1], msg=output)
self.installer.assert_installed(self, self.cluster.slaves[0], msg=output)
self.installer.assert_installed(self, self.cluster.slaves[2], msg=output)
# uninstall
output = self.run_prestoadmin('package uninstall presto-server-rpm -x %(master)s,%(slave2)s')
for container in self.cluster.all_hosts():
self.installer.assert_uninstalled(container, msg=output)
# skip this tests as it depends on OS package names
@attr('quarantine')
@docker_only
def test_install_rpm_missing_dependency(self):
rpm_name = self.installer.copy_presto_rpm_to_master()
self.cluster.exec_cmd_on_host(
self.cluster.master, 'rpm -e --nodeps python-2.6.6')
self.assertRaisesRegexp(OSError,
'package python-2.6.6 is not installed',
self.cluster.exec_cmd_on_host,
self.cluster.master,
'rpm -q python-2.6.6')
cmd_output = self.run_prestoadmin(
'package install %(rpm)s -H %(master)s',
rpm=os.path.join(self.cluster.rpm_cache_dir, rpm_name),
raise_error=False)
expected = self.replace_keywords("""
Fatal error: [%(master)s] sudo() received nonzero return code 1 while \
executing!
Requested: rpm -i /opt/prestoadmin/packages/%(rpm)s
Executed: sudo -S -p 'sudo password:' /bin/bash -l -c "rpm -i \
/opt/prestoadmin/packages/%(rpm)s"
Aborting.
Deploying rpm on %(master)s...
Package deployed successfully on: %(master)s
[%(master)s] out: error: Failed dependencies:
[%(master)s] out: python >= 2.4 is needed by %(rpm_basename)s
#.........这里部分代码省略.........
示例6: TestServerUninstall
# 需要导入模块: from tests.product.standalone.presto_installer import StandalonePrestoInstaller [as 别名]
# 或者: from tests.product.standalone.presto_installer.StandalonePrestoInstaller import assert_uninstalled [as 别名]
class TestServerUninstall(BaseProductTestCase):
def setUp(self):
super(TestServerUninstall, self).setUp()
self.installer = StandalonePrestoInstaller(self)
@attr('smoketest')
def test_uninstall(self):
self.setup_cluster(NoHadoopBareImageProvider(),
self.STANDALONE_PRESTO_CLUSTER)
start_output = self.run_prestoadmin('server start')
process_per_host = self.get_process_per_host(start_output.splitlines())
self.assert_started(process_per_host)
cmd_output = self.run_prestoadmin(
'server uninstall', raise_error=False).splitlines()
self.assert_stopped(process_per_host)
expected = uninstall_output + self.expected_stop()[:]
self.assertRegexpMatchesLineByLine(cmd_output, expected)
for container in self.cluster.all_hosts():
self.assert_uninstalled_dirs_removed(container)
def assert_uninstalled_dirs_removed(self, container):
self.installer.assert_uninstalled(container)
self.assert_path_removed(container, '/etc/presto')
self.assert_path_removed(container, '/usr/lib/presto')
self.assert_path_removed(container, '/var/lib/presto')
self.assert_path_removed(container, '/usr/shared/doc/presto')
self.assert_path_removed(container, '/etc/init.d/presto')
def test_uninstall_when_server_down(self):
self.setup_cluster(NoHadoopBareImageProvider(),
self.STANDALONE_PRESTO_CLUSTER)
start_output = self.run_prestoadmin('server start')
process_per_host = self.get_process_per_host(start_output.splitlines())
self.run_prestoadmin('server stop -H %s' %
self.cluster.internal_slaves[0])
cmd_output = self.run_prestoadmin('server uninstall').splitlines()
self.assert_stopped(process_per_host)
expected = uninstall_output + self.expected_stop(
not_running=[self.cluster.internal_slaves[0]])[:]
self.assertRegexpMatchesLineByLine(cmd_output, expected)
for container in self.cluster.all_hosts():
self.assert_uninstalled_dirs_removed(container)
def test_uninstall_twice(self):
self.test_uninstall()
output = self.run_prestoadmin('server uninstall', raise_error=False)
with open(os.path.join(LOCAL_RESOURCES_DIR, 'uninstall_twice.txt'),
'r') as f:
expected = f.read()
self.assertEqualIgnoringOrder(expected, output)
def test_uninstall_lost_host(self):
self.setup_cluster(NoHadoopBareImageProvider(), self.PA_ONLY_CLUSTER)
pa_installer = PrestoadminInstaller(self)
pa_installer.install()
topology = {"coordinator": self.cluster.internal_slaves[0],
"workers": [self.cluster.internal_master,
self.cluster.internal_slaves[1],
self.cluster.internal_slaves[2]]}
self.upload_topology(topology)
self.installer.install()
start_output = self.run_prestoadmin('server start')
process_per_host = self.get_process_per_host(start_output.splitlines())
self.assert_started(process_per_host)
down_node = self.cluster.internal_slaves[0]
self.cluster.stop_host(
self.cluster.slaves[0])
expected = self.down_node_connection_error(
self.cluster.internal_slaves[0])
cmd_output = self.run_prestoadmin('server uninstall',
raise_error=False)
self.assertRegexpMatches(cmd_output, expected)
process_per_active_host = []
for host, pid in process_per_host:
if host not in down_node:
process_per_active_host.append((host, pid))
self.assert_stopped(process_per_active_host)
for container in [self.cluster.internal_master,
self.cluster.internal_slaves[1],
self.cluster.internal_slaves[2]]:
self.assert_uninstalled_dirs_removed(container)
def test_uninstall_with_dir_readonly(self):
self.setup_cluster(NoHadoopBareImageProvider(),
self.STANDALONE_PRESTO_CLUSTER)
start_output = self.run_prestoadmin('server start')
process_per_host = self.get_process_per_host(start_output.splitlines())
self.assert_started(process_per_host)
self.run_script_from_prestoadmin_dir("chmod 500 -R /usr/lib/presto")
self.run_prestoadmin('server uninstall', raise_error=False)
#.........这里部分代码省略.........
示例7: TestPackageInstall
# 需要导入模块: from tests.product.standalone.presto_installer import StandalonePrestoInstaller [as 别名]
# 或者: from tests.product.standalone.presto_installer.StandalonePrestoInstaller import assert_uninstalled [as 别名]
class TestPackageInstall(BaseProductTestCase):
def setUp(self):
super(TestPackageInstall, self).setUp()
self.setup_cluster(self.PA_ONLY_CLUSTER)
self.upload_topology()
self.installer = StandalonePrestoInstaller(self)
@attr("smoketest")
def test_package_install(self):
rpm_name = self.installer.copy_presto_rpm_to_master()
output = self.run_prestoadmin("package install " "/mnt/presto-admin/%(rpm)s", rpm=rpm_name)
for container in self.cluster.all_hosts():
self.installer.assert_installed(self, container, msg=output)
def test_install_coord_using_dash_h(self):
rpm_name = self.installer.copy_presto_rpm_to_master()
output = self.run_prestoadmin("package install /mnt/presto-admin/%(rpm)s -H %(master)s", rpm=rpm_name)
self.installer.assert_installed(self, self.cluster.master)
for slave in self.cluster.slaves:
self.installer.assert_uninstalled(slave, msg=output)
def test_install_worker_using_dash_h(self):
rpm_name = self.installer.copy_presto_rpm_to_master()
output = self.run_prestoadmin("package install /mnt/presto-admin/%(rpm)s -H %(slave1)s", rpm=rpm_name)
self.installer.assert_installed(self, self.cluster.slaves[0], msg=output)
self.installer.assert_uninstalled(self.cluster.master, msg=output)
self.installer.assert_uninstalled(self.cluster.slaves[1], msg=output)
self.installer.assert_uninstalled(self.cluster.slaves[2], msg=output)
def test_install_workers_using_dash_h(self):
rpm_name = self.installer.copy_presto_rpm_to_master()
output = self.run_prestoadmin(
"package install /mnt/presto-admin/" "%(rpm)s -H %(slave1)s,%(slave2)s", rpm=rpm_name
)
self.installer.assert_installed(self, self.cluster.slaves[0], msg=output)
self.installer.assert_installed(self, self.cluster.slaves[1], msg=output)
self.installer.assert_uninstalled(self.cluster.master, msg=output)
self.installer.assert_uninstalled(self.cluster.slaves[2], msg=output)
def test_install_exclude_coord(self):
rpm_name = self.installer.copy_presto_rpm_to_master()
output = self.run_prestoadmin("package install /mnt/presto-admin/" "%(rpm)s -x %(master)s", rpm=rpm_name)
self.installer.assert_uninstalled(self.cluster.master, msg=output)
for slave in self.cluster.slaves:
self.installer.assert_installed(self, slave, msg=output)
def test_install_exclude_worker(self):
rpm_name = self.installer.copy_presto_rpm_to_master()
output = self.run_prestoadmin("package install /mnt/presto-admin/" "%(rpm)s -x %(slave1)s", rpm=rpm_name)
self.installer.assert_uninstalled(self.cluster.slaves[0], msg=output)
self.installer.assert_installed(self, self.cluster.slaves[1], msg=output)
self.installer.assert_installed(self, self.cluster.master, msg=output)
self.installer.assert_installed(self, self.cluster.slaves[2], msg=output)
def test_install_exclude_workers(self):
rpm_name = self.installer.copy_presto_rpm_to_master()
output = self.run_prestoadmin(
"package install /mnt/presto-admin/" "%(rpm)s -x %(slave1)s,%(slave2)s", rpm=rpm_name
)
self.installer.assert_uninstalled(self.cluster.slaves[0], msg=output)
self.installer.assert_uninstalled(self.cluster.slaves[1], msg=output)
self.installer.assert_installed(self, self.cluster.master, msg=output)
self.installer.assert_installed(self, self.cluster.slaves[2], msg=output)
def test_install_invalid_path(self):
rpm_name = self.installer.copy_presto_rpm_to_master()
cmd_output = self.run_prestoadmin("package install /mnt/presto-admin" "/invalid-path/presto.rpm", rpm=rpm_name)
error = (
"\nFatal error: [%s] error: "
"/mnt/presto-admin/invalid-path/presto.rpm: open failed: "
"No such file or directory\n\nAborting.\n"
)
expected = ""
for host in self.cluster.all_internal_hosts():
expected += error % host
self.assertEqualIgnoringOrder(cmd_output, expected)
def test_install_no_path_arg(self):
self.installer.copy_presto_rpm_to_master()
output = self.run_prestoadmin("package install", raise_error=False)
self.assertEqual(
output,
"Incorrect number of arguments to task.\n\n"
"Displaying detailed information for task "
"'package install':\n\n"
" Install the rpm package on the cluster\n"
" \n Args:\n"
" local_path: Absolute path to the rpm"
" to be installed\n "
"--nodeps (optional): Flag to indicate if "
"rpm install\n"
" should ignore c"
"hecking package dependencies. Equivalent\n"
" to adding --nodeps flag to rpm "
"-i.\n\n",
#.........这里部分代码省略.........