~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/simple_user_policy/tests/t/basic.test

  • Committer: Andrew Hutchings
  • Date: 2010-12-06 19:36:53 UTC
  • mfrom: (1976 staging)
  • mto: This revision was merged to the branch mainline in revision 1991.
  • Revision ID: andrew@linuxjedi.co.uk-20101206193653-l85vryv18jb0yxx8
Merge with trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# Check for error if no parameter provided
2
 
create database user1;
3
 
create database user2;
4
 
show databases;
 
2
create schema user1;
 
3
create schema user2;
 
4
SELECT SCHEMA_NAME FROM DATA_DICTIONARY.SCHEMAS ORDER BY SCHEMA_NAME;
5
5
 
6
6
# Set up a table to be able to test not being able to kill other people
7
7
use user2;
19
19
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
20
20
connect (should_succeed,localhost,user1,,user1,,);
21
21
connection should_succeed;
22
 
show databases;
 
22
SELECT SCHEMA_NAME FROM DATA_DICTIONARY.SCHEMAS ORDER BY SCHEMA_NAME;
23
23
 
24
24
# Test that we get blocked on not being allowed to see user2 at all before
25
25
# we get blocked on the table not existing
32
32
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
33
33
--replace_regex /@'.*?'/@'LOCALHOST'/
34
34
--error ER_DBACCESS_DENIED_ERROR
35
 
create database authorize_fail;
 
35
create schema authorize_fail;
36
36
 
37
37
# Test that we can't drop a schema that isn't named the same as we are
38
38
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
39
39
--replace_regex /@'.*?'/@'LOCALHOST'/
40
40
--error ER_DBACCESS_DENIED_ERROR
41
 
drop database user2;
 
41
drop schema user2;
42
42
 
43
43
# Set up a table to test that we can kill other versions of us
44
44
create table t1 (kill_id int);
51
51
connection con1;
52
52
 
53
53
# Check that we don't see other people's connections
54
 
--replace_column 3 # 5 # 6 # 7 # 8 #
55
 
show processlist;
 
54
SELECT USER, DB FROM DATA_DICTIONARY.PROCESSLIST ORDER BY USER, DB;
56
55
 
57
56
# Check that we can kill a process that is owned by our user
58
57
--disable_reconnect
59
 
select ((@id := kill_id) - kill_id) from t1;
 
58
select IF(((@id := kill_id) - kill_id), "NO", "YES") from t1;
60
59
kill @id;
61
60
 
62
61
connection should_succeed;
73
72
--enable_result_log
74
73
--enable_reconnect
75
74
 
76
 
select ((@id := kill_id) - kill_id) from t1;
 
75
select IF(((@id := kill_id) - kill_id), "NO", "YES") from t1;
77
76
select @id != connection_id();
78
77
 
79
78
# Set the table to our current id now
81
80
 
82
81
# Test that we cannot kill a process owned by someone else
83
82
connection con2;
84
 
--replace_column 3 # 5 # 6 # 7 # 8 #
85
 
show processlist;
86
 
select ((@id := kill_id) - kill_id) from t1;
 
83
SELECT USER, DB FROM DATA_DICTIONARY.PROCESSLIST ORDER BY USER, DB;
 
84
select IF(((@id := kill_id) - kill_id), "NO", "YES") from t1;
87
85
 
88
86
--error ER_NO_SUCH_THREAD
89
87
kill @id;
90
88
 
91
89
# Test that root can see everybody
92
90
connection default;
93
 
--replace_column 3 # 5 # 6 # 7 # 8 #
94
 
show processlist;
 
91
SELECT USER, DB FROM DATA_DICTIONARY.PROCESSLIST ORDER BY USER, DB;
95
92
 
96
93
# Test that root can kill someone else
97
94
use user1;
98
95
--disable_reconnect
99
 
select ((@id := kill_id) - kill_id) from t1;
 
96
select IF(((@id := kill_id) - kill_id), "NO", "YES") from t1;
100
97
kill @id;
101
98
 
102
99
connection should_succeed;
113
110
--enable_result_log
114
111
--enable_reconnect
115
112
 
116
 
select ((@id := kill_id) - kill_id) from t1;
 
113
select IF(((@id := kill_id) - kill_id), "NO", "YES") from t1;
117
114
select @id != connection_id();
118
115
 
119
116