Changeset: 73a7a5e87887 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=73a7a5e87887
Removed Files:
sql/test/Users/Tests/unknown_user.reqtests
sql/test/Users/Tests/unknown_user.stable.err
sql/test/Users/Tests/unknown_user.stable.out
Modified Files:
sql/test/Users/Tests/unknown_user.SQL.py
Branch: default
Log Message:
Cleaned up the test and extended it a bit
diffs (184 lines):
diff --git a/sql/test/Users/Tests/unknown_user.SQL.py
b/sql/test/Users/Tests/unknown_user.SQL.py
--- a/sql/test/Users/Tests/unknown_user.SQL.py
+++ b/sql/test/Users/Tests/unknown_user.SQL.py
@@ -1,5 +1,7 @@
###
-# Authenticate unknown USER (not possible).
+# Check that a non-existing user cannot log in.
+# Check that granting schema, role and privileges to a non-existing user is not
+# possible.
###
from MonetDBtesting.sqltest import SQLTestCase
@@ -7,30 +9,20 @@ import logging
logging.basicConfig(level=logging.FATAL)
-err_msg = "InvalidCredentialsException:checkCredentials:invalid credentials
for user 'this_user_does_not_exist'".strip()
+usr = "this_user_does_not_exist"
with SQLTestCase() as tc:
- tc.connect(username="this_user_does_not_exist",
password="this_password_does_not_exist")
- tc.execute("SELECT * FROM sys;").assertFailed(err_message=err_msg)
-
-
-# import sys,os
-# import pymonetdb
-
-# import logging
-
-# logging.basicConfig(level=logging.FATAL)
+ tc.connect(username=usr, password=usr)
+ tc.execute("select 1;").assertFailed(err_code=None,
err_message="InvalidCredentialsException:checkCredentials:invalid credentials
for user '"+usr+"'")
-# error = False
-# db=os.getenv("TSTDB")
-# port=int(os.getenv("MAPIPORT"))
-# try:
-# client = pymonetdb.connect(database=db, port=port, autocommit=True,
-# user='this_user_does_not_exist',
password='this_password_does_not_exist')
-# except pymonetdb.exceptions.DatabaseError:
-# error = True
-# pass
+ tc.connect(username="monetdb", password="monetdb")
+ tc.execute("""
+ CREATE ROLE r1;
+ CREATE TABLE t (i INT);
+ """).assertSucceeded()
-# if not error:
-# print("Logged in with invalid credentials")
-# sys.exit(-1)
+ tc.execute("GRANT r1 TO "+usr).assertFailed(err_code="M1M05",
err_message="GRANT: Cannot grant ROLE 'r1' to user '"+usr+"'")
+ tc.execute("GRANT ALL ON t TO "+usr).assertFailed(err_code="01007",
err_message="GRANT: User/role '"+usr+"' unknown")
+ tc.execute("GRANT COPY INTO TO "+usr).assertFailed(err_code="01007",
err_message="GRANT: User/role '"+usr+"' unknown")
+ tc.execute("GRANT COPY FROM TO "+usr).assertFailed(err_code="01007",
err_message="GRANT: User/role '"+usr+"' unknown")
+
diff --git a/sql/test/Users/Tests/unknown_user.reqtests
b/sql/test/Users/Tests/unknown_user.reqtests
deleted file mode 100644
--- a/sql/test/Users/Tests/unknown_user.reqtests
+++ /dev/null
@@ -1,1 +0,0 @@
-schema
diff --git a/sql/test/Users/Tests/unknown_user.stable.err
b/sql/test/Users/Tests/unknown_user.stable.err
deleted file mode 100644
--- a/sql/test/Users/Tests/unknown_user.stable.err
+++ /dev/null
@@ -1,88 +0,0 @@
-stderr of test 'unknown_user` in directory 'sql/test/Users` itself:
-
-
-# 20:38:25 >
-# 20:38:25 > mserver5
"--config=/ufs/niels/scratch/monetdb/Linux-x86_64/etc/monetdb5.conf" --debug=10
--set gdk_nr_threads=4 --set
"monet_mod_path=/ufs/niels/scratch/monetdb/Linux-x86_64/lib/MonetDB5:/ufs/niels/scratch/monetdb/Linux-x86_64/lib/MonetDB5/lib:/ufs/niels/scratch/monetdb/Linux-x86_64/lib/MonetDB5/bin"
--set "gdk_dbfarm=/ufs/niels/scratch/monetdb/Linux-x86_64/var/MonetDB5/dbfarm"
--set
"sql_logdir=/ufs/niels/scratch/monetdb/Linux-x86_64/var/MonetDB5/sql_logs"
--set mapi_open=true --set xrpc_open=true --set mapi_port=31333 --set
xrpc_port=43851 --set monet_prompt= --trace "--dbname=mTests_src_test_Users"
--set mal_listing=0 "--dbinit= include sql;" ; echo ; echo Over..
-# 20:38:25 >
-
-# builtin opt gdk_arch = 64bitx86_64-unknown-linux-gnu
-# builtin opt gdk_version = 1.27.0
-# builtin opt monet_pid = 9952
-# builtin opt prefix = /ufs/niels/scratch/monetdb/Linux-x86_64
-# builtin opt exec_prefix = ${prefix}
-# builtin opt gdk_dbname = tst
-# builtin opt gdk_dbfarm = ${prefix}/var/MonetDB
-# builtin opt gdk_debug = 8
-# builtin opt gdk_mem_bigsize = 262144
-# builtin opt gdk_alloc_map = yes
-# builtin opt gdk_mem_pagebits = 14
-# builtin opt gdk_vmtrim = yes
-# builtin opt monet_admin = adm
-# builtin opt monet_prompt = >
-# builtin opt monet_welcome = yes
-# builtin opt monet_mod_path =
${exec_prefix}/lib/MonetDB:${exec_prefix}/lib/bin
-# builtin opt monet_daemon = yes
-# builtin opt host = localhost
-# builtin opt mapi_port = 50000
-# builtin opt mapi_noheaders = no
-# builtin opt mapi_debug = 0
-# builtin opt mapi_clients = 2
-# builtin opt sql_debug = 0
-# builtin opt sql_logdir = ${prefix}/var/MonetDB
-# builtin opt xquery_logdir = ${prefix}/var/MonetDB
-# builtin opt standoff_ns = http://monetdb.cwi.nl/standoff
-# builtin opt standoff_start = start
-# builtin opt standoff_end = end
-# config opt prefix = /ufs/niels/scratch/monetdb/Linux-x86_64
-# config opt config = ${prefix}/etc/monetdb5.conf
-# config opt prefix = /ufs/niels/scratch/monetdb/Linux-x86_64
-# config opt exec_prefix = ${prefix}
-# config opt gdk_dbfarm = ${prefix}/var/MonetDB5/dbfarm
-# config opt gdk_dbname = demo
-# config opt gdk_alloc_map = no
-# config opt gdk_embedded = no
-# config opt gdk_debug = 0
-# config opt monet_mod_path =
${exec_prefix}/lib/MonetDB5:${exec_prefix}/lib/MonetDB5/lib:${exec_prefix}/lib/MonetDB5/bin
-# config opt monet_daemon = no
-# config opt monet_welcome = yes
-# config opt mero_msglog = ${prefix}/var/log/merovingian.log
-# config opt mero_errlog = ${prefix}/var/log/merovingian.log
-# config opt mero_timeinterval = 600
-# config opt mero_pidfile = ${prefix}/var/run/merovingian.pid
-# config opt mero_exittimeout = 7
-# config opt mero_doproxy = yes
-# config opt mero_discoveryttl = 600
-# config opt mal_init = ${exec_prefix}/lib/MonetDB5/mal_init.mal
-# config opt mal_listing = 2
-# config opt checkpoint_dir = ${prefix}/var/MonetDB5/chkpnt
-# config opt mapi_port = 50000
-# config opt mapi_open = false
-# config opt sql_logdir = ${prefix}/var/MonetDB5/sql_logs
-# config opt sql_init = ${exec_prefix}/lib/MonetDB5/sql_init.sql
-# cmdline opt config =
/ufs/niels/scratch/monetdb/Linux-x86_64/etc/monetdb5.conf
-# cmdline opt gdk_nr_threads = 4
-# cmdline opt monet_mod_path =
/ufs/niels/scratch/monetdb/Linux-x86_64/lib/MonetDB5:/ufs/niels/scratch/monetdb/Linux-x86_64/lib/MonetDB5/lib:/ufs/niels/scratch/monetdb/Linux-x86_64/lib/MonetDB5/bin
-# cmdline opt gdk_dbfarm =
/ufs/niels/scratch/monetdb/Linux-x86_64/var/MonetDB5/dbfarm
-# cmdline opt sql_logdir =
/ufs/niels/scratch/monetdb/Linux-x86_64/var/MonetDB5/sql_logs
-# cmdline opt mapi_open = true
-# cmdline opt xrpc_open = true
-# cmdline opt mapi_port = 31333
-# cmdline opt xrpc_port = 43851
-# cmdline opt monet_prompt =
-# cmdline opt gdk_dbname = mTests_src_test_Users
-# cmdline opt mal_listing = 0
-# cmdline opt gdk_debug = 10
-#warning: please don't forget to set your vault key!
-#(see /ufs/niels/scratch/monetdb/Linux-x86_64/etc/monetdb5.conf)
-
-# 20:38:25 >
-# 20:38:25 > /usr/bin/python unknown_user.SQL.py unknown_user
-# 20:38:25 >
-
-InvalidCredentialsException:checkCredentials:invalid credentials for user
'this_user_does_not_exist'
-
-
-# 20:38:25 >
-# 20:38:25 > Done.
-# 20:38:25 >
-
diff --git a/sql/test/Users/Tests/unknown_user.stable.out
b/sql/test/Users/Tests/unknown_user.stable.out
deleted file mode 100644
--- a/sql/test/Users/Tests/unknown_user.stable.out
+++ /dev/null
@@ -1,24 +0,0 @@
-stdout of test 'unknown_user` in directory 'sql/test/Users` itself:
-
-
-# 14:12:50 >
-# 14:12:50 > Mtimeout -timeout 240 Mserver
"--config=/ufs/niels/scratch/monetdb/Linux-x86_64/etc/MonetDB.conf" --debug=10
--set
"monet_mod_path=/ufs/niels/scratch/monetdb/Linux-x86_64/lib/MonetDB4:/ufs/niels/scratch/monetdb/Linux-x86_64/lib/MonetDB4/lib:/ufs/niels/scratch/monetdb/Linux-x86_64/lib/MonetDB4/bin"
--set "gdk_dbfarm=/ufs/niels/scratch/monetdb/Linux-x86_64/var/MonetDB4/dbfarm"
--set
"sql_logdir=/ufs/niels/scratch/monetdb/Linux-x86_64/var/MonetDB4/sql_logs"
--set
"xquery_logdir=/ufs/niels/scratch/monetdb/Linux-x86_64/var/MonetDB4/xquery_logs"
--set mapi_port=31117 --set xrpc_port=42399 --set monet_prompt= --trace
"--dbname=mTests_src_test_Users" --dbinit=" module(sql_server);" ; echo ; echo
Over..
-# 14:12:50 >
-
-# Monet Database Server V4.17.1
-# Copyright (c) 1993-2007, CWI. All rights reserved.
-# Compiled for x86_64-redhat-linux-gnu/64bit with 64bit OIDs; dynamically
linked.
-# Visit http://monetdb.cwi.nl/ for further information.
-
-
-
-
-# 14:12:51 >
-# 14:12:51 > Mtimeout -timeout 120 /usr/bin/python unknown_user.SQL.py
unknown_user
-# 14:12:51 >
-
-
-# 14:12:51 >
-# 14:12:51 > Done.
-# 14:12:51 >
-
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list