# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. ############################################################################### # curl command tests for templeton # # #use Yahoo::Miners::Test::PigSetup; #PigSetup::setup(); #my $me = `whoami`; #chomp $me; $cfg = { 'driver' => 'Curl', 'groups' => [ ##============================================================================================================= { 'name' => 'DB_OPS', 'tests' => [ { #check if db created by UNAME_OTHER is visible for user UNAME 'num' => 1, 'setup' => [ { 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_a', 'user_name' => ':UNAME_OTHER:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{"comment":"Hello there", "properties":{"a":"b"}}'], } ], 'method' => 'GET', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/', 'user_name' => ':UNAME:', 'format_header' => 'Content-Type: application/json', 'json_field_substr_match' => {'databases' => 'hcatperms_a'}, 'status_code' => 200, }, { #check if group id is set as per spec 'num' => 2, 'setup' => [ { 'method' => 'DELETE', 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_b', 'user_name' => ':UNAME:', }, { 'method' => 'PUT', 'post_options' => [ '{"permissions" : "rwxrwxrwx", "group" : ":UGROUP:" }' ], 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_b', 'user_name' => ':UNAME:', }, ], 'method' => 'GET', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_b', 'user_name' => ':UNAME:', 'format_header' => 'Content-Type: application/json', 'json_field_substr_match' => {'location_perms' => 'rwxrwxrwx', 'location_group' => ':UGROUP:'}, 'status_code' => 200, }, { #check if group id is set as per spec 'num' => 3, 'setup' => [ { 'method' => 'DELETE', 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_c', 'user_name' => ':UNAME:', }, { 'method' => 'PUT', 'post_options' => [ '{"permissions" : "rwxr-x---", "group" : ":UGROUP:" }' ], 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_c', 'user_name' => ':UNAME:', }, ], 'method' => 'GET', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_c', 'user_name' => ':UNAME:', 'format_header' => 'Content-Type: application/json', 'json_field_substr_match' => {'location_perms' => 'rwxr-x---', 'location_group' => ':UGROUP:'}, 'status_code' => 200, }, { #check if user belonging to same group is able to access 'num' => 4, 'setup' => [ { 'method' => 'DELETE', 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_d', 'user_name' => ':UNAME:', }, { 'method' => 'PUT', 'post_options' => [ '{ "permissions" : "rwxr-x---", "group" : ":UGROUP:" }' ], 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_d', 'user_name' => ':UNAME:', 'format_header' => 'Content-Type: application/json', } ], 'method' => 'GET', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_d', 'user_name' => ':UNAME_GROUP:', 'format_header' => 'Content-Type: application/json', 'json_field_substr_match' => {'location_perms' => 'rwxr-x---', 'location_group' => ':UGROUP:'}, 'status_code' => 200, }, { #check db permissions #the default group is currently the group of parent dir 'num' => 5, 'setup' => [ { 'method' => 'DELETE', 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_e', 'user_name' => ':UNAME:', }, { 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_e', 'user_name' => ':UNAME:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "permissions" : "rwx------" }'] } ], 'method' => 'GET', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_e', 'user_name' => ':UNAME:', 'format_header' => 'Content-Type: application/json', 'json_field_substr_match' => {'location_perms' => 'rwx------'}, 'status_code' => 200, }, { #check if user can delete db 'num' => 6, 'setup' => [ { 'method' => 'DELETE', 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_f', 'user_name' => ':UNAME:', }, { 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_f', 'user_name' => ':UNAME:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{}'] } ], 'method' => 'DELETE', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_f', 'user_name' => ':UNAME:', 'format_header' => 'Content-Type: application/json', 'status_code' => 200, }, { #check if user belonging to group can delete table 'num' => 7, 'setup' => [ { 'method' => 'DELETE', 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:', 'user_name' => ':UNAME:', }, { 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:', 'user_name' => ':UNAME:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "permissions" : "rwxrwx---", "group" : ":UGROUP:" }'] } ], 'method' => 'DELETE', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:', 'user_name' => ':UNAME_GROUP:', 'format_header' => 'Content-Type: application/json', 'status_code' => 200, }, { #check if user belonging to group is unable to delete table 'num' => 8, 'setup' => [ { 'method' => 'DELETE', 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:', 'user_name' => ':UNAME:', }, { 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:', 'user_name' => ':UNAME:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "permissions" : "rwx------", "group" : ":UGROUP:" }'] } ], 'method' => 'DELETE', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:', 'user_name' => ':UNAME_GROUP:', 'format_header' => 'Content-Type: application/json', 'status_code' => 500, }, { #check if user belonging to 'other' is unable to delete table 'num' => 10, 'setup' => [ { 'method' => 'DELETE', 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:', 'user_name' => ':UNAME:', }, { 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:', 'user_name' => ':UNAME:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "permissions" : "rwx------", "group" : ":UGROUP:" }'] } ], 'method' => 'DELETE', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:', 'user_name' => ':UNAME_OTHER:', 'format_header' => 'Content-Type: application/json', 'status_code' => 500, }, { #check if user is able to create table 'num' => 11, 'setup' => [ { 'method' => 'DELETE', 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:?ifExists=true&option=cascade', 'user_name' => ':UNAME:', 'status_code' => 200, }, { 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:', 'user_name' => ':UNAME:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "permissions" : "rwx------" }'] }, ], 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:/table/permstable_:TNUM:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "columns": [ { "name" : "i", "type" : "int" }, { "name" : "j", "type" : "bigint", "comment" : "some comment" } ], "format" : { "storedAs" : "rcfile"} }'], 'user_name' => ':UNAME:', 'status_code' => 200, }, { #check if group user is able to create table 'num' => 12, 'setup' => [ { 'method' => 'DELETE', 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:/table/permstable_:TNUM:', 'user_name' => ':UNAME_GROUP:', 'status_code' => 200, }, { 'method' => 'DELETE', 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:?ifExists=true&option=cascade', 'user_name' => ':UNAME:', 'status_code' => 200, }, { 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:', 'user_name' => ':UNAME:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "permissions" : "rwxrwx---" , "group" : ":UGROUP:"} '] }, ], 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:/table/permstable_:TNUM:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "columns": [ { "name" : "i", "type" : "int" }, { "name" : "j", "type" : "bigint", "comment" : "some comment" } ], "format" : { "storedAs" : "rcfile"} }'], 'user_name' => ':UNAME_GROUP:', 'status_code' => 200, }, { #check if group user is unable to create table without permissions 'num' => 13, 'setup' => [ { 'method' => 'DELETE', 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:?ifExists=true&option=cascade', 'user_name' => ':UNAME:', 'status_code' => 200, }, { 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:', 'user_name' => ':UNAME:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "permissions" : "rwx------", "group" : ":UGROUP:" }'] }, ], 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:/table/permstable_:TNUM:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "columns": [ { "name" : "i", "type" : "int" }, { "name" : "j", "type" : "bigint", "comment" : "some comment" } ], "format" : { "storedAs" : "rcfile"} }'], 'user_name' => ':UNAME_GROUP:', 'status_code' => 500, }, { #check if other user is unable to create table without permissions 'num' => 14, 'setup' => [ { 'method' => 'DELETE', 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:?ifExists=true&option=cascade', 'user_name' => ':UNAME:', 'status_code' => 200, }, { 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:', 'user_name' => ':UNAME:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "permissions" : "rwxrwx---", "group" : ":UGROUP:" }'], 'status_code' => 200, }, ], 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:/table/permstable_:TNUM:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "columns": [ { "name" : "i", "type" : "int" }, { "name" : "j", "type" : "bigint", "comment" : "some comment" } ], "format" : { "storedAs" : "rcfile"} }'], 'user_name' => ':UNAME_OTHER:', 'status_code' => 500, }, { #show table allowed for user 'num' => 15, 'setup' => [ { 'method' => 'DELETE', 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:?ifExists=true&option=cascade', 'user_name' => ':UNAME:', 'status_code' => 200, }, { 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:', 'user_name' => ':UNAME:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "permissions" : "rwxrwx---", "group" : ":UGROUP:" }'], 'status_code' => 200, }, { 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:/table/permstable_:TNUM:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "columns": [ { "name" : "i", "type" : "int" } ], "format" : { "storedAs" : "rcfile"} }'], 'user_name' => ':UNAME:', 'status_code' => 200, } ], 'method' => 'GET', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:/table/', 'format_header' => 'Content-Type: application/json', 'user_name' => ':UNAME:', 'status_code' => 200, 'json_field_substr_match' => {'tables' => 'permstable_:TNUM:'}, }, { #show table allowed for group 'num' => 16, 'setup' => [ { 'method' => 'DELETE', 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:?ifExists=true&option=cascade', 'user_name' => ':UNAME:', 'status_code' => 200, }, { 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:', 'user_name' => ':UNAME:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "permissions" : "rwxrwx---", "group" : ":UGROUP:" }'], 'status_code' => 200, }, { 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:/table/permstable_:TNUM:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "columns": [ { "name" : "i", "type" : "int" } ], "format" : { "storedAs" : "rcfile"} }'], 'user_name' => ':UNAME:', 'status_code' => 200, } ], 'method' => 'GET', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:/table/', 'format_header' => 'Content-Type: application/json', 'user_name' => ':UNAME_GROUP:', 'status_code' => 200, 'json_field_substr_match' => {'tables' => 'permstable_:TNUM:'}, }, { #show table not allowed for group user without permissions 'num' => 17, 'setup' => [ { #drop db cascade 'method' => 'DELETE', 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:?ifExists=true&option=cascade', 'user_name' => ':UNAME:', 'status_code' => 200, }, { #create db 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:', 'user_name' => ':UNAME:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "permissions" : "rwx------", "group" : ":UGROUP:" }'], 'status_code' => 200, }, { #create table 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:/table/permstable_:TNUM:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "columns": [ { "name" : "i", "type" : "int" } ], "format" : { "storedAs" : "rcfile"} }'], 'user_name' => ':UNAME:', 'status_code' => 200, } ], 'method' => 'GET', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:/table/', 'format_header' => 'Content-Type: application/json', 'user_name' => ':UNAME_GROUP:', 'status_code' => 500, }, { #show table not allowed for other user without permissions 'num' => 18, 'setup' => [ { #drop db cascade 'method' => 'DELETE', 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:?ifExists=true&option=cascade', 'user_name' => ':UNAME:', 'status_code' => 200, }, { #create db 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:', 'user_name' => ':UNAME:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "permissions" : "rwx------", "group" : ":UGROUP:" }'], 'status_code' => 200, }, { #create table 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:/table/permstable_:TNUM:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "columns": [ { "name" : "i", "type" : "int" } ], "format" : { "storedAs" : "rcfile"} }'], 'user_name' => ':UNAME:', 'status_code' => 200, } ], 'method' => 'GET', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:/table/', 'format_header' => 'Content-Type: application/json', 'user_name' => ':UNAME_OTHER:', 'status_code' => 500, 'json_field_substr_match' => {'error' => 'AccessControlException: Permission denied: user=:UNAME_OTHER:, access=READ'}, }, { #describe db - by user 'num' => 19, 'setup' => [ { #drop db cascade 'method' => 'DELETE', 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:?ifExists=true&option=cascade', 'user_name' => ':UNAME:', 'status_code' => 200, }, { #create db 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:', 'user_name' => ':UNAME:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "permissions" : "rwxrwx---" }'], 'status_code' => 200, }, ], 'method' => 'GET', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:', 'format_header' => 'Content-Type: application/json', 'user_name' => ':UNAME:', 'status_code' => 200, 'json_field_substr_match' => {'database' => 'hcatperms_:TNUM:', 'location' => 'hcatperms_:TNUM:'}, }, { #describe db - by group user 'num' => 20, 'setup' => [ { #drop db cascade 'method' => 'DELETE', 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:?ifExists=true&option=cascade', 'user_name' => ':UNAME:', 'status_code' => 200, }, { #create db 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:', 'user_name' => ':UNAME:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "permissions" : "rwxrwx---", "group" : ":UGROUP:" }'], 'status_code' => 200, }, ], 'method' => 'GET', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:', 'format_header' => 'Content-Type: application/json', 'user_name' => ':UNAME_GROUP:', 'status_code' => 200, 'json_field_substr_match' => {'database' => 'hcatperms_:TNUM:', 'location' => 'hcatperms_:TNUM:'}, }, { #describe db - by group user without permissions 'num' => 21, 'setup' => [ { #drop db cascade 'method' => 'DELETE', 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:?ifExists=true&option=cascade', 'user_name' => ':UNAME:', 'status_code' => 200, }, { #create db 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:', 'user_name' => ':UNAME:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "permissions" : "rwx------", "group" : ":UGROUP:" }'], 'status_code' => 200, }, ], 'method' => 'GET', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:', 'format_header' => 'Content-Type: application/json', 'user_name' => ':UNAME_GROUP:', 'status_code' => 500, }, { #describe db - by other user without permissions 'num' => 22, 'setup' => [ { #drop db cascade 'method' => 'DELETE', 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:?ifExists=true&option=cascade', 'user_name' => ':UNAME:', 'status_code' => 200, }, { #create db 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:', 'user_name' => ':UNAME:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "permissions" : "rwx------", "group" : ":UGROUP:" }'], 'status_code' => 200, }, ], 'method' => 'GET', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/hcatperms_:TNUM:', 'format_header' => 'Content-Type: application/json', 'user_name' => ':UNAME_OTHER:', 'status_code' => 500, }, ] }, ##============================================================================================================= { 'name' => 'TABLE_OPS', 'tests' => [ { #test if the permissions and group for table are set correctly 'num' => 1, 'setup' => [ { #drop table 'method' => 'DELETE', 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/default/table/permstable_:TNUM:?ifExists=true', 'user_name' => ':UNAME:', 'status_code' => 200, }, { #create table 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/default/table/permstable_:TNUM:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "columns": [ { "name" : "i", "type" : "int" } ],"format" : { "storedAs" : "rcfile"}, "permissions" : "rwxr-xr-x", "group" : ":UGROUP:" }'], 'user_name' => ':UNAME:', 'status_code' => 200, } ], 'method' => 'GET', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/default/table/permstable_:TNUM:?format=extended', 'format_header' => 'Content-Type: application/json', 'user_name' => ':UNAME:', 'status_code' => 200, 'json_field_substr_match' => {'location_perms' => 'rwxr-xr-x', 'location_group' => ':UGROUP:'}, }, { #check permissions #the default group is currently the group of parent dir 'num' => 2, 'setup' => [ { #drop table 'method' => 'DELETE', 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/default/table/permstable_:TNUM:?ifExists=true', 'user_name' => ':UNAME:', 'status_code' => 200, }, { #create table 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/default/table/permstable_:TNUM:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "columns": [ { "name" : "i", "type" : "int" } ],"format" : { "storedAs" : "rcfile"}, "permissions" : "rwx------" }'], 'user_name' => ':UNAME:', 'status_code' => 200, } ], 'method' => 'GET', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/default/table/permstable_:TNUM:?format=extended', 'format_header' => 'Content-Type: application/json', 'user_name' => ':UNAME:', 'status_code' => 200, 'json_field_substr_match' => {'location_perms' => 'rwx------', 'location_owner' => ':UNAME:'}, }, { #alter table permissions for user 'num' => 3, 'setup' => [ { #drop table 'method' => 'DELETE', 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/default/table/permstable_:TNUM:?ifExists=true', 'user_name' => ':UNAME:', 'status_code' => 200, }, { #create table 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/default/table/permstable_:TNUM:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "columns": [ { "name" : "i", "type" : "int" } ],"format" : { "storedAs" : "rcfile"} }'], 'user_name' => ':UNAME:', 'status_code' => 200, } ], #alter table add column j 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/default/table/permstable_:TNUM:/column/j', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{"type": "string", "comment": "The 2nd col"}'], 'user_name' => ':UNAME:', 'status_code' => 200, }, { #alter table for group user - with permissions 'num' => 4, 'setup' => [ { #drop table 'method' => 'DELETE', 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/default/table/permstable_:TNUM:?ifExists=true', 'user_name' => ':UNAME:', 'status_code' => 200, }, { #create table 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/default/table/permstable_:TNUM:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "columns": [ { "name" : "i", "type" : "int" } ], "format" : { "storedAs" : "rcfile"}, "permissions" : "rwxrwxr-x", "group" : ":UGROUP:" }' ], 'user_name' => ':UNAME:', 'status_code' => 200, } ], #alter table add column j 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/default/table/permstable_:TNUM:/column/j', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{"type": "string", "comment": "The 2nd col"}'], 'user_name' => ':UNAME_GROUP:', 'status_code' => 200, }, { #alter table for group user -without permissions 'num' => 5, 'setup' => [ { #drop table 'method' => 'DELETE', 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/default/table/permstable_:TNUM:?ifExists=true', 'user_name' => ':UNAME:', 'status_code' => 200, }, { #create table 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/default/table/permstable_:TNUM:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "columns": [ { "name" : "i", "type" : "int" } ], "format" : { "storedAs" : "rcfile"}, "permissions" : "rwxr-xr-x", "group" : ":UGROUP:" }' ], 'user_name' => ':UNAME:', 'status_code' => 200, } ], #alter table add column j 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/default/table/permstable_:TNUM:/column/j', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{"type": "string", "comment": "The 2nd col"}'], 'user_name' => ':UNAME_GROUP:', 'status_code' => 500, }, { #alter table for other user -without permissions 'num' => 6, 'setup' => [ { #drop table 'method' => 'DELETE', 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/default/table/permstable_:TNUM:?ifExists=true', 'user_name' => ':UNAME:', 'status_code' => 200, }, { #create table 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/default/table/permstable_:TNUM:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "columns": [ { "name" : "i", "type" : "int" } ], "format" : { "storedAs" : "rcfile"}, "permissions" : "rwxr-xr-x", "group" : ":UGROUP:" }' ], 'user_name' => ':UNAME:', 'status_code' => 200, } ], #alter table add column j 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/default/table/permstable_:TNUM:/column/j', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{"type": "string", "comment": "The 2nd col"}'], 'user_name' => ':UNAME_OTHER:', 'status_code' => 500, }, { #drop table by user 'num' => 7, 'setup' => [ { #drop table 'method' => 'DELETE', 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/default/table/permstable_:TNUM:?ifExists=true', 'user_name' => ':UNAME:', 'status_code' => 200, }, { #create table 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/default/table/permstable_:TNUM:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "columns": [ { "name" : "i", "type" : "int" } ], "format" : { "storedAs" : "rcfile"}, "permissions" : "rwxr-xr-x", "group" : ":UGROUP:" }' ], 'user_name' => ':UNAME:', 'status_code' => 200, } ], #drop table 'method' => 'DELETE', 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/default/table/permstable_:TNUM:', 'user_name' => ':UNAME:', 'status_code' => 200, }, { #drop table by group user with permissions 'num' => 8, 'setup' => [ { #drop table 'method' => 'DELETE', 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/default/table/permstable_:TNUM:?ifExists=true', 'user_name' => ':UNAME:', 'status_code' => 200, }, { #create table 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/default/table/permstable_:TNUM:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "columns": [ { "name" : "i", "type" : "int" } ], "format" : { "storedAs" : "rcfile"}, "permissions" : "rwxrwx---", "group" : ":UGROUP:" }' ], 'user_name' => ':UNAME:', 'status_code' => 200, } ], #drop table 'method' => 'DELETE', 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/default/table/permstable_:TNUM:', 'user_name' => ':UNAME_GROUP:', 'status_code' => 200, }, { #drop table by group user without permissions 'num' => 9, 'setup' => [ { #drop table 'method' => 'DELETE', 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/default/table/permstable_:TNUM:?ifExists=true', 'user_name' => ':UNAME:', 'status_code' => 200, }, { #create table 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/default/table/permstable_:TNUM:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "columns": [ { "name" : "i", "type" : "int" } ], "format" : { "storedAs" : "rcfile"}, "permissions" : "rwx------", "group" : ":UGROUP:" }' ], 'user_name' => ':UNAME:', 'status_code' => 200, } ], #drop table 'method' => 'DELETE', 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/default/table/permstable_:TNUM:', 'user_name' => ':UNAME_GROUP:', 'status_code' => 500, }, { #drop table by other user without permissions 'num' => 10, 'setup' => [ { #drop table 'method' => 'DELETE', 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/default/table/permstable_:TNUM:?ifExists=true', 'user_name' => ':UNAME:', 'status_code' => 200, }, { #create table 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/default/table/permstable_:TNUM:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "columns": [ { "name" : "i", "type" : "int" } ], "format" : { "storedAs" : "rcfile"}, "permissions" : "rwx------", "group" : ":UGROUP:" }' ], 'user_name' => ':UNAME:', 'status_code' => 200, } ], #drop table 'method' => 'DELETE', 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/default/table/permstable_:TNUM:', 'user_name' => ':UNAME_OTHER:', 'status_code' => 500, }, { #show table allowed for user 'num' => 11, 'setup' => [ { 'method' => 'DELETE', 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/tabpermsdb:TNUM:?ifExists=true&option=cascade', 'user_name' => ':UNAME:', 'status_code' => 200, }, { 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/tabpermsdb:TNUM:', 'user_name' => ':UNAME:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "permissions" : "rwxrwx---" }'], 'status_code' => 200, }, { 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/tabpermsdb:TNUM:/table/permstable_:TNUM:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "columns": [ { "name" : "i", "type" : "int" } ], "format" : { "storedAs" : "rcfile"} }'], 'user_name' => ':UNAME:', 'status_code' => 200, } ], 'method' => 'GET', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/tabpermsdb:TNUM:/table/', 'format_header' => 'Content-Type: application/json', 'user_name' => ':UNAME:', 'status_code' => 200, 'json_field_substr_match' => {'tables' => 'permstable_:TNUM:'}, }, { #show table allowed for group user with permissions 'num' => 12, 'setup' => [ { 'method' => 'DELETE', 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/tabpermsdb:TNUM:?ifExists=true&option=cascade', 'user_name' => ':UNAME:', 'status_code' => 200, }, { 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/tabpermsdb:TNUM:', 'user_name' => ':UNAME:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "permissions" : "rwxrwx---", "group" : ":UGROUP:" }'], 'status_code' => 200, }, { 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/tabpermsdb:TNUM:/table/permstable_:TNUM:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "columns": [ { "name" : "i", "type" : "int" }], "permissions" : "rwxrwx---", "group" : ":UGROUP:" } "format" : { "storedAs" : "rcfile"} }'], 'user_name' => ':UNAME:', 'status_code' => 200, } ], 'method' => 'GET', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/tabpermsdb:TNUM:/table/', 'format_header' => 'Content-Type: application/json', 'user_name' => ':UNAME_GROUP:', 'status_code' => 200, 'json_field_substr_match' => {'tables' => 'permstable_:TNUM:'}, }, { #show table not allowed for group user without permissions 'num' => 13, 'ignore' => 'HIVE-3009', 'setup' => [ { 'method' => 'DELETE', 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/tabpermsdb:TNUM:?ifExists=true&option=cascade', 'user_name' => ':UNAME:', 'status_code' => 200, }, { 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/tabpermsdb:TNUM:', 'user_name' => ':UNAME:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "permissions" : "rwxrwx---" }'], 'status_code' => 200, }, { 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/tabpermsdb:TNUM:/table/permstable_:TNUM:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "columns": [ { "name" : "i", "type" : "int" }], "permissions" : "rwx------", "group" : ":UGROUP:" } "format" : { "storedAs" : "rcfile"} }'], 'user_name' => ':UNAME:', 'status_code' => 200, } ], 'method' => 'GET', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/tabpermsdb:TNUM:/table/', 'format_header' => 'Content-Type: application/json', 'user_name' => ':UNAME_GROUP:', 'status_code' => 500, 'json_field_substr_match' => {'error' => 'unable to show tables'}, }, { #show table not allowed for other user without permissions 'num' => 14, 'ignore' => 'HIVE-3009', 'setup' => [ { 'method' => 'DELETE', 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/tabpermsdb:TNUM:?ifExists=true&option=cascade', 'user_name' => ':UNAME:', 'status_code' => 200, }, { 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/tabpermsdb:TNUM:', 'user_name' => ':UNAME:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "permissions" : "rwxrwxrwx" }'], 'status_code' => 200, }, { 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/tabpermsdb:TNUM:/table/permstable_:TNUM:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "columns": [ { "name" : "i", "type" : "int" }], "permissions" : "rwx------", "group" : ":UGROUP:" } "format" : { "storedAs" : "rcfile"} }'], 'user_name' => ':UNAME:', 'status_code' => 200, } ], 'method' => 'GET', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/tabpermsdb:TNUM:/table/', 'format_header' => 'Content-Type: application/json', 'user_name' => ':UNAME_OTHER:', 'status_code' => 500, 'json_field_substr_match' => {'error' => 'unable to show tables'}, }, { #show table not allowed for other user without permissions 'num' => 15, 'ignore' => 'see HIVE-3009', 'setup' => [ { 'method' => 'DELETE', 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/tabpermsdb:TNUM:?ifExists=true&option=cascade', 'user_name' => ':UNAME:', 'status_code' => 200, }, { 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/tabpermsdb:TNUM:', 'user_name' => ':UNAME:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "permissions" : "rwxrwxrwx" }'], 'status_code' => 200, }, { 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/tabpermsdb:TNUM:/table/permstable_:TNUM:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "columns": [ { "name" : "i", "type" : "int" }], "permissions" : "rwx------", "group" : ":UGROUP:" } "format" : { "storedAs" : "rcfile"} }'], 'user_name' => ':UNAME:', 'status_code' => 200, } ], 'method' => 'GET', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/tabpermsdb:TNUM:/table/', 'format_header' => 'Content-Type: application/json', 'user_name' => ':UNAME_OTHER:', 'status_code' => 500, 'json_field_substr_match' => {'error' => 'unable to show tables'}, }, { #describe table test for user done as part of permissions check test #describe table by group user 'num' => 16, 'setup' => [ { #drop table 'method' => 'DELETE', 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/default/table/permstable_:TNUM:?ifExists=true', 'user_name' => ':UNAME:', 'status_code' => 200, }, { #create table 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/default/table/permstable_:TNUM:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "columns": [ { "name" : "i", "type" : "int" } ],"format" : { "storedAs" : "rcfile"}, "permissions" : "rwxr-x---", "group" : ":UGROUP:" }'], 'user_name' => ':UNAME:', 'status_code' => 200, } ], 'method' => 'GET', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/default/table/permstable_:TNUM:?format=extended', 'format_header' => 'Content-Type: application/json', 'user_name' => ':UNAME_GROUP:', 'status_code' => 200, 'json_field_substr_match' => {'location_perms' => 'rwxr-x---', 'location_group' => ':UGROUP:'}, }, { #describe extended, table by group user without permission 'num' => 17, 'ignore' => 'see HIVE-3009', 'setup' => [ { #drop table 'method' => 'DELETE', 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/default/table/permstable_:TNUM:?ifExists=true', 'user_name' => ':UNAME:', 'status_code' => 200, }, { #create table 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/default/table/permstable_:TNUM:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "columns": [ { "name" : "i", "type" : "int" } ],"format" : { "storedAs" : "rcfile"}, "permissions" : "rwx------", "group" : ":UGROUP:" }'], 'user_name' => ':UNAME:', 'status_code' => 200, } ], 'method' => 'GET', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/default/table/permstable_:TNUM:?format=extended', 'format_header' => 'Content-Type: application/json', 'user_name' => ':UNAME_GROUP:', 'status_code' => 500, }, { #describe extended, table by other user without permission 'num' => 18, 'ignore' => 'see HIVE-3009', 'setup' => [ { #drop table 'method' => 'DELETE', 'format_header' => 'Content-Type: application/json', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/default/table/permstable_:TNUM:?ifExists=true', 'user_name' => ':UNAME:', 'status_code' => 200, }, { #create table 'method' => 'PUT', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/default/table/permstable_:TNUM:', 'format_header' => 'Content-Type: application/json', 'post_options' => ['{ "columns": [ { "name" : "i", "type" : "int" } ],"format" : { "storedAs" : "rcfile"}, "permissions" : "rwx------", "group" : ":UGROUP:" }'], 'user_name' => ':UNAME:', 'status_code' => 200, } ], 'method' => 'GET', 'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/default/table/permstable_:TNUM:?format=extended', 'format_header' => 'Content-Type: application/json', 'user_name' => ':UNAME_OTHER:', 'status_code' => 500, }, ] } ] }, ;