<s> """<STR_LIT>""" <EOL> import certifi <EOL> import os <EOL> from nose . plugins . attrib import attr <EOL> from tests . no_hadoop_bare_image_provider import NoHadoopBareImageProvider <EOL> from tests . product . base_product_case import BaseProductTestCase , docker_only <EOL> from tests . product . prestoadmin_installer import PrestoadminInstaller <EOL> from tests . docker_cluster import DockerCluster <EOL> from tests . product . constants import DEFAULT_DOCKER_MOUNT_POINT , DEFAULT_LOCAL_MOUNT_POINT <EOL> install_py26_script = """<STR_LIT>""" <EOL> class TestInstallation ( BaseProductTestCase ) : <EOL> def setUp ( self ) : <EOL> super ( TestInstallation , self ) . setUp ( ) <EOL> self . pa_installer = PrestoadminInstaller ( self ) <EOL> self . setup_cluster ( NoHadoopBareImageProvider ( ) , self . BARE_CLUSTER ) <EOL> dist_dir = self . pa_installer . _build_dist_if_necessary ( self . cluster ) <EOL> self . pa_installer . _copy_dist_to_host ( self . cluster , dist_dir , <EOL> self . cluster . master ) <EOL> @ attr ( '<STR_LIT>' ) <EOL> @ docker_only <EOL> def test_install_non_root ( self ) : <EOL> install_dir = '<STR_LIT>' <EOL> script = """<STR_LIT>""" . format ( mount_dir = self . cluster . mount_dir , <EOL> install_dir = install_dir ) <EOL> self . assertRaisesRegexp ( OSError , '<STR_LIT>' <EOL> '<STR_LIT>' , <EOL> self . cluster . run_script_on_host , script , <EOL> self . cluster . master ) <EOL> @ attr ( '<STR_LIT>' ) <EOL> def test_install_from_different_dir ( self ) : <EOL> install_dir = '<STR_LIT>' <EOL> script = """<STR_LIT>""" . format ( mount_dir = self . cluster . mount_dir , <EOL> install_dir = install_dir ) <EOL> self . assertRaisesRegexp ( <EOL> OSError , <EOL> r'<STR_LIT>' <EOL> r'<STR_LIT>' , <EOL> self . cluster . run_script_on_host , <EOL> script , <EOL> self . cluster . master <EOL> ) <EOL> @ attr ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> @ docker_only <EOL> def test_install_on_wrong_os_offline_installer ( self ) : <EOL> image = '<STR_LIT>' <EOL> tag = '<STR_LIT>' <EOL> host = image + '<STR_LIT>' <EOL> ubuntu_container = DockerCluster ( host , [ ] , DEFAULT_LOCAL_MOUNT_POINT , <EOL> DEFAULT_DOCKER_MOUNT_POINT ) <EOL> try : <EOL> ubuntu_container . fetch_image_if_not_present ( image , tag ) <EOL> ubuntu_container . start_containers ( <EOL> image + '<STR_LIT::>' + tag , cmd = '<STR_LIT>' ) <EOL> self . retry ( lambda : ubuntu_container . run_script_on_host ( <EOL> install_py26_script , ubuntu_container . master ) ) <EOL> ubuntu_container . exec_cmd_on_host ( <EOL> ubuntu_container . master , '<STR_LIT>' ) <EOL> self . assertRaisesRegexp ( <EOL> OSError , <EOL> r'<STR_LIT>' <EOL> r'<STR_LIT>' , <EOL> self . pa_installer . install , <EOL> cluster = ubuntu_container <EOL> ) <EOL> finally : <EOL> ubuntu_container . tear_down ( ) <EOL> @ attr ( '<STR_LIT>' ) <EOL> def test_cert_arg_to_installation_nonexistent_file ( self ) : <EOL> install_dir = '<STR_LIT>' <EOL> script = """<STR_LIT>""" . format ( mount_dir = self . cluster . mount_dir , <EOL> install_dir = install_dir ) <EOL> output = self . cluster . run_script_on_host ( script , self . cluster . master ) <EOL> self . assertRegexpMatches ( output , r'<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> @ attr ( '<STR_LIT>' ) <EOL> def test_cert_arg_to_installation_real_cert ( self ) : <EOL> self . cluster . copy_to_host ( certifi . where ( ) , self . cluster . master ) <EOL> install_dir = '<STR_LIT>' <EOL> cert_file = os . path . basename ( certifi . where ( ) ) <EOL> script = """<STR_LIT>""" . format ( mount_dir = self . cluster . mount_dir , <EOL> install_dir = install_dir , <EOL> cacert = cert_file ) <EOL> output = self . cluster . run_script_on_host ( script , self . cluster . master ) <EOL> self . assertTrue ( '<STR_LIT>' <EOL> '<STR_LIT>' % cert_file not in output , <EOL> '<STR_LIT>' % output ) <EOL> def test_additional_dirs_created ( self ) : <EOL> install_dir = '<STR_LIT>' <EOL> script = """<STR_LIT>""" . format ( mount_dir = self . cluster . mount_dir , <EOL> install_dir = install_dir ) <EOL> self . cluster . run_script_on_host ( script , self . cluster . master ) <EOL> pa_etc_dir = '<STR_LIT>' <EOL> connectors_dir = pa_etc_dir + '<STR_LIT>' <EOL> self . assert_path_exists ( self . cluster . master , connectors_dir ) <EOL> coordinator_dir = pa_etc_dir + '<STR_LIT>' <EOL> self . assert_path_exists ( self . cluster . master , coordinator_dir ) <EOL> workers_dir = pa_etc_dir + '<STR_LIT>' <EOL> self . assert_path_exists ( self . cluster . master , workers_dir ) </s>
