File: x_network_namespace.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (39 lines) | stat: -rw-r--r-- 1,631 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Network namespaces is a feature of Linux.
# So, ignore this test on any platform except Linux.
--source include/linux.inc
--source ../include/have_network_namespaces.inc

--let $restart_parameters = restart: --skip-name-resolve --mysqlx-bind-address=10.0.2.1/red
--source include/restart_mysqld.inc

--source include/xplugin_wait_for_interfaces.inc
--source include/xplugin_preamble.inc

CREATE USER 'x_root' @'10.0.2.1' IDENTIFIED WITH 'mysql_native_password';
GRANT ALL ON *.*TO 'x_root' @'10.0.2.1' WITH GRANT OPTION;

--echo # Check that X-protocol client can establish connection to the address 10.0.2.1 from the network namespace 'red'

--write_file $MYSQL_TMP_DIR/mysqlx-connected-user-info.tmp
-->sql
SELECT USER();
-->endsql
EOF

--exec $MYSQLXTEST -h 10.0.2.1 --network-namespace=red -u x_root --password='' --file=$MYSQL_TMP_DIR/mysqlx-connected-user-info.tmp 2>&1

--echo # Non existing namespace
--exec $MYSQLXTEST --expect-error 2001 -h 10.0.2.1 --network-namespace=green -u x_root --password='' --file=$MYSQL_TMP_DIR/mysqlx-connected-user-info.tmp 2>&1

--echo # Simulate case where cap_sys_nice is not granted to mysqlxtest
--copy_file $exe_mysqlxtest $MYSQLTEST_VARDIR/tmp/mysqlxtest
--exec $MYSQLTEST_VARDIR/tmp/mysqlxtest --expect-error 2001 -h 10.0.2.1 --network-namespace=red -u x_root --password='' --file=$MYSQL_TMP_DIR/mysqlx-connected-user-info.tmp 2>&1

REVOKE ALL ON *.* FROM 'x_root' @'10.0.2.1';
DROP USER 'x_root' @'10.0.2.1';

--remove_file $MYSQL_TMP_DIR/mysqlx-connected-user-info.tmp
--remove_file $MYSQLTEST_VARDIR/tmp/mysqlxtest

--let $restart_parameters=
--source include/restart_mysqld.inc