summaryrefslogtreecommitdiffstats
path: root/plugin/disks/mysql-test
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:04:16 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:04:16 +0000
commita68fb2d8219f6bccc573009600e9f23e89226a5e (patch)
treed742d35d14ae816e99293d2b01face30e9f3a46b /plugin/disks/mysql-test
parentInitial commit. (diff)
downloadmariadb-10.6-a68fb2d8219f6bccc573009600e9f23e89226a5e.tar.xz
mariadb-10.6-a68fb2d8219f6bccc573009600e9f23e89226a5e.zip
Adding upstream version 1:10.6.11.upstream/1%10.6.11upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'plugin/disks/mysql-test')
-rw-r--r--plugin/disks/mysql-test/disks/disks.result12
-rw-r--r--plugin/disks/mysql-test/disks/disks.test3
-rw-r--r--plugin/disks/mysql-test/disks/disks_notembedded.result22
-rw-r--r--plugin/disks/mysql-test/disks/disks_notembedded.test25
-rw-r--r--plugin/disks/mysql-test/disks/suite.opt1
-rw-r--r--plugin/disks/mysql-test/disks/suite.pm10
6 files changed, 73 insertions, 0 deletions
diff --git a/plugin/disks/mysql-test/disks/disks.result b/plugin/disks/mysql-test/disks/disks.result
new file mode 100644
index 00000000..888f2df6
--- /dev/null
+++ b/plugin/disks/mysql-test/disks/disks.result
@@ -0,0 +1,12 @@
+show create table information_schema.disks;
+Table Create Table
+DISKS CREATE TEMPORARY TABLE `DISKS` (
+ `Disk` varchar(pathlen) NOT NULL,
+ `Path` varchar(pathlen) NOT NULL,
+ `Total` bigint(32) NOT NULL,
+ `Used` bigint(32) NOT NULL,
+ `Available` bigint(32) NOT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+select sum(Total) > sum(Available), sum(Total)>sum(Used) from information_schema.disks;
+sum(Total) > sum(Available) sum(Total)>sum(Used)
+1 1
diff --git a/plugin/disks/mysql-test/disks/disks.test b/plugin/disks/mysql-test/disks/disks.test
new file mode 100644
index 00000000..7189c548
--- /dev/null
+++ b/plugin/disks/mysql-test/disks/disks.test
@@ -0,0 +1,3 @@
+--replace_regex /varchar\([0-9]+\)/varchar(pathlen)/
+show create table information_schema.disks;
+select sum(Total) > sum(Available), sum(Total)>sum(Used) from information_schema.disks;
diff --git a/plugin/disks/mysql-test/disks/disks_notembedded.result b/plugin/disks/mysql-test/disks/disks_notembedded.result
new file mode 100644
index 00000000..97429474
--- /dev/null
+++ b/plugin/disks/mysql-test/disks/disks_notembedded.result
@@ -0,0 +1,22 @@
+#
+# MDEV-18328: Make DISKS plugin check some privilege to access
+# information_schema.DISKS table
+#
+CREATE USER user1@localhost;
+GRANT SELECT ON *.* TO user1@localhost;
+connect con1,localhost,user1,,;
+connection con1;
+select sum(Total) > sum(Available), sum(Total)>sum(Used) from information_schema.disks;
+sum(Total) > sum(Available) sum(Total)>sum(Used)
+NULL NULL
+disconnect con1;
+connection default;
+GRANT FILE ON *.* TO user1@localhost;
+connect con1,localhost,user1,,;
+connection con1;
+select sum(Total) > sum(Available), sum(Total)>sum(Used) from information_schema.disks;
+sum(Total) > sum(Available) sum(Total)>sum(Used)
+1 1
+connection default;
+DROP USER user1@localhost;
+# End of 10.1 tests
diff --git a/plugin/disks/mysql-test/disks/disks_notembedded.test b/plugin/disks/mysql-test/disks/disks_notembedded.test
new file mode 100644
index 00000000..a0f6c2e5
--- /dev/null
+++ b/plugin/disks/mysql-test/disks/disks_notembedded.test
@@ -0,0 +1,25 @@
+source include/not_embedded.inc;
+
+--echo #
+--echo # MDEV-18328: Make DISKS plugin check some privilege to access
+--echo # information_schema.DISKS table
+--echo #
+
+CREATE USER user1@localhost;
+GRANT SELECT ON *.* TO user1@localhost;
+
+connect (con1,localhost,user1,,);
+connection con1;
+select sum(Total) > sum(Available), sum(Total)>sum(Used) from information_schema.disks;
+disconnect con1;
+
+connection default;
+GRANT FILE ON *.* TO user1@localhost;
+
+connect (con1,localhost,user1,,);
+connection con1;
+select sum(Total) > sum(Available), sum(Total)>sum(Used) from information_schema.disks;
+connection default;
+DROP USER user1@localhost;
+
+--echo # End of 10.1 tests
diff --git a/plugin/disks/mysql-test/disks/suite.opt b/plugin/disks/mysql-test/disks/suite.opt
new file mode 100644
index 00000000..afbbe2b0
--- /dev/null
+++ b/plugin/disks/mysql-test/disks/suite.opt
@@ -0,0 +1 @@
+--plugin-load-add=$DISKS_SO
diff --git a/plugin/disks/mysql-test/disks/suite.pm b/plugin/disks/mysql-test/disks/suite.pm
new file mode 100644
index 00000000..c64ef3b3
--- /dev/null
+++ b/plugin/disks/mysql-test/disks/suite.pm
@@ -0,0 +1,10 @@
+package My::Suite::Disks;
+
+@ISA = qw(My::Suite);
+
+return "No Disks plugin" unless $ENV{DISKS_SO};
+
+sub is_default { 1 }
+
+bless { };
+