

@docker_only
def test_connector_add_wrong_permissions(self):
    self.setup_cluster(NoHadoopBareImageProvider(), self.STANDALONE_PRESTO_CLUSTER)
    script = 'chmod 600 /etc/opt/prestoadmin/connectors/tpch.properties; su app-admin -c "./presto-admin connector add tpch"'
    output = self.run_script_from_prestoadmin_dir(script)
    with open(os.path.join(LOCAL_RESOURCES_DIR, 'connector_permissions_warning.txt'), 'r') as f:
        expected = (f.read() % {
            'master': self.cluster.internal_master,
            'slave1': self.cluster.internal_slaves[0],
            'slave2': self.cluster.internal_slaves[1],
            'slave3': self.cluster.internal_slaves[2],
        })
    self.assertEqualIgnoringOrder(expected, output)
    script = 'chmod 600 /etc/opt/prestoadmin/connectors; su app-admin -c "./presto-admin connector add"'
    output = self.run_script_from_prestoadmin_dir(script)
    permission_error = '\nWarning: [slave3] Permission denied\n\n\nWarning: [slave2] Permission denied\n\n\nWarning: [slave1] Permission denied\n\n\nWarning: [master] Permission denied\n\n'
    self.assertEqualIgnoringOrder(output, not_found_error)
    script = 'chmod 600 /etc/opt/prestoadmin/connectors; su app-admin -c "./presto-admin connector add tpch"'
    not_found_error = self.fatal_error('Configuration for connector tpch not found')
    self.assertRaisesRegexp(OSError, not_found_error, self.run_script_from_prestoadmin_dir, script)

dataset/ETHPy150Open prestodb/presto-admin/tests/product/test_connectors.py TestConnectors.test_connector_add_wrong_permissions/VarMisuse@152/373 `permission_error`->`not_found_error`