当前位置: 首页>>代码示例>>Python>>正文


Python StandalonePrestoInstaller.get_keywords方法代码示例

本文整理汇总了Python中tests.product.standalone.presto_installer.StandalonePrestoInstaller.get_keywords方法的典型用法代码示例。如果您正苦于以下问题:Python StandalonePrestoInstaller.get_keywords方法的具体用法?Python StandalonePrestoInstaller.get_keywords怎么用?Python StandalonePrestoInstaller.get_keywords使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tests.product.standalone.presto_installer.StandalonePrestoInstaller的用法示例。


在下文中一共展示了StandalonePrestoInstaller.get_keywords方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_install_twice

# 需要导入模块: from tests.product.standalone.presto_installer import StandalonePrestoInstaller [as 别名]
# 或者: from tests.product.standalone.presto_installer.StandalonePrestoInstaller import get_keywords [as 别名]
    def test_install_twice(self):
        installer = StandalonePrestoInstaller(self)
        self.upload_topology()
        cmd_output = installer.install()
        expected = self.format_err_msgs_with_internal_hosts(installed_all_hosts_output)

        actual = cmd_output.splitlines()
        self.assertRegexpMatchesLineByLine(actual, expected)

        for container in self.cluster.all_hosts():
            installer.assert_installed(self, container)
            self.assert_has_default_config(container)
            self.assert_has_default_connector(container)

        output = installer.install(pa_raise_error=False)

        self.default_keywords.update(installer.get_keywords())

        with open(os.path.join(LOCAL_RESOURCES_DIR, 'install_twice.txt'),
                  'r') as f:
            expected = f.read()
        expected = self.escape_for_regex(
            self.replace_keywords(expected))

        self.assertRegexpMatchesLineByLine(output.splitlines(),
                                           expected.splitlines())
        for container in self.cluster.all_hosts():
            installer.assert_installed(self, container)
            self.assert_has_default_config(container)
            self.assert_has_default_connector(container)
开发者ID:Teradata,项目名称:presto-admin,代码行数:32,代码来源:test_server_install.py

示例2: test_install_twice

# 需要导入模块: from tests.product.standalone.presto_installer import StandalonePrestoInstaller [as 别名]
# 或者: from tests.product.standalone.presto_installer.StandalonePrestoInstaller import get_keywords [as 别名]
    def test_install_twice(self):
        installer = StandalonePrestoInstaller(self, dummy=True)
        self.test_install(installer=installer)
        output = installer.install(pa_raise_error=False)

        self.default_keywords.update(installer.get_keywords())

        with open(os.path.join(LOCAL_RESOURCES_DIR, 'install_twice.txt'), 'r') \
                as f:
            expected = f.read()
        expected = self.escape_for_regex(
            self.replace_keywords(expected))

        self.assertRegexpMatchesLineByLine(output.splitlines(),
                                           expected.splitlines())
        for container in self.cluster.all_hosts():
            installer.assert_installed(self, container)
            self.assert_has_default_config(container)
            self.assert_has_default_connector(container)
开发者ID:nanaessuman,项目名称:presto-admin,代码行数:21,代码来源:test_server_install.py

示例3: TestPackageInstall

# 需要导入模块: from tests.product.standalone.presto_installer import StandalonePrestoInstaller [as 别名]
# 或者: from tests.product.standalone.presto_installer.StandalonePrestoInstaller import get_keywords [as 别名]

#.........这里部分代码省略.........
            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
[%(master)s] out: """, **self.installer.get_keywords())
        self.assertRegexpMatchesLineByLine(
            cmd_output.splitlines(),
            self.escape_for_regex(expected).splitlines()
        )

    # skip this tests as it depends on OS package names
    @attr('quarantine')
    @docker_only
    def test_install_rpm_with_nodeps(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 --nodeps',
            rpm=os.path.join(self.cluster.rpm_cache_dir, rpm_name)
        )
        expected = 'Deploying rpm on %(host)s...\n' \
                   'Package deployed successfully on: %(host)s\n' \
                   'Package installed successfully on: %(host)s' \
                   % {'host': self.cluster.internal_master}

        self.assertEqualIgnoringOrder(expected, cmd_output)
开发者ID:prestodb,项目名称:presto-admin,代码行数:104,代码来源:test_package_install.py

示例4: TestPackageInstall

# 需要导入模块: from tests.product.standalone.presto_installer import StandalonePrestoInstaller [as 别名]
# 或者: from tests.product.standalone.presto_installer.StandalonePrestoInstaller import get_keywords [as 别名]

#.........这里部分代码省略.........
                                 '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')

    def test_install_already_installed(self):
        rpm_name = self.installer.copy_presto_rpm_to_master()
        self.run_prestoadmin('package install /mnt/presto-admin/%(rpm)s -H '
                             '%(master)s', rpm=rpm_name)
        self.installer.assert_installed(self, self.cluster.master)
        cmd_output = self.run_prestoadmin(
            'package install /mnt/presto-admin/%(rpm)s -H %(master)s',
            rpm=rpm_name, raise_error=False)
        expected = self.escape_for_regex(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: 	package %(rpm_basename)s is already installed
[%(master)s] out: """, **self.installer.get_keywords()))
        self.assertRegexpMatchesLineByLine(
            cmd_output.splitlines(),
            expected.splitlines()
        )

    def test_install_not_an_rpm(self):
        cmd_output = self.run_prestoadmin('package install '
                                          '/etc/opt/prestoadmin/config.json',
                                          raise_error=False)

        error = """
Fatal error: \[%s\] error: (/etc/opt/prestoadmin/config.json: )?not an rpm \
package

Aborting.
"""
        expected = ''
        for host in self.cluster.all_internal_hosts():
            expected += error % host

        self.assertRegexpMatchesLineByLine(cmd_output.splitlines(),
                                           expected.splitlines())

    @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,
开发者ID:mango77881,项目名称:presto-admin,代码行数:70,代码来源:test_package_install.py

示例5: TestPackageInstall

# 需要导入模块: from tests.product.standalone.presto_installer import StandalonePrestoInstaller [as 别名]
# 或者: from tests.product.standalone.presto_installer.StandalonePrestoInstaller import get_keywords [as 别名]

#.........这里部分代码省略.........
                **self.installer.get_keywords(rpm_name)
            )
        )
        self.assertRegexpMatchesLineByLine(cmd_output.splitlines(), expected.splitlines())

    def test_install_not_an_rpm(self):
        cmd_output = self.run_prestoadmin("package install " "/etc/opt/prestoadmin/config.json")

        error = """
Fatal error: \[%s\] error: (/etc/opt/prestoadmin/config.json: )?not an rpm \
package

Aborting.
"""
        expected = ""
        for host in self.cluster.all_internal_hosts():
            expected += error % host

        self.assertRegexpMatchesLineByLine(cmd_output.splitlines(), expected.splitlines())

    @docker_only
    def test_install_rpm_with_missing_jdk(self):
        rpm_name = self.installer.copy_presto_rpm_to_master(
            rpm_dir=prestoadmin.main_dir, rpm_name=self.installer.presto_rpm_filename
        )
        self.cluster.exec_cmd_on_host(self.cluster.master, "rpm -e jdk1.8.0_40-1.8.0_40-fcs")
        self.assertRaisesRegexp(
            OSError,
            "package jdk1.8.0_40-1.8.0_40-fcs is not " "installed",
            self.cluster.exec_cmd_on_host,
            self.cluster.master,
            "rpm -q jdk1.8.0_40-1.8.0_40-fcs",
        )

        cmd_output = self.run_prestoadmin("package install /mnt/presto-admin/%(rpm)s -H %(master)s", rpm=rpm_name)
        self.assertRegexpMatchesLineByLine(
            cmd_output.splitlines(), self.jdk_not_found_error_message(rpm_name).splitlines()
        )

    def jdk_not_found_error_message(self, rpm_name):
        with open(os.path.join(LOCAL_RESOURCES_DIR, "jdk_not_found.txt")) as f:
            jdk_not_found_error = f.read()
        return self.escape_for_regex(
            self.replace_keywords(jdk_not_found_error, **self.installer.get_keywords(rpm_name))
        )

    @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 /mnt/presto-admin/%(rpm)s -H %(master)s", rpm=rpm_name)
        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
[%(master)s] out: """,
            **self.installer.get_keywords(rpm_name)
        )
        self.assertRegexpMatchesLineByLine(cmd_output.splitlines(), self.escape_for_regex(expected).splitlines())

    @docker_only
    def test_install_rpm_with_nodeps(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 /mnt/presto-admin/%(rpm)s -H %(master)s --nodeps", rpm=rpm_name
        )
        expected = (
            "Deploying rpm on %(host)s...\n"
            "Package deployed successfully on: %(host)s\n"
            "Package installed successfully on: %(host)s" % {"host": self.cluster.internal_master}
        )

        self.assertEqualIgnoringOrder(expected, cmd_output)
开发者ID:tddisser,项目名称:presto-admin,代码行数:104,代码来源:test_package_install.py


注:本文中的tests.product.standalone.presto_installer.StandalonePrestoInstaller.get_keywords方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。