Debian Codegraph @

mysql-test/suite/network_namespace/t/x_network_namespace.test

raw
1 # Network namespaces is a feature of Linux.
2 # So, ignore this test on any platform except Linux.
3 --source include/linux.inc
4 --source ../include/have_network_namespaces.inc
5
6 --let $restart_parameters = restart: --skip-name-resolve --mysqlx-bind-address=10.0.2.1/red
7 --source include/restart_mysqld.inc
8
9 --source include/xplugin_wait_for_interfaces.inc
10 --source include/xplugin_preamble.inc
11
12 CREATE USER 'x_root' @'10.0.2.1' IDENTIFIED WITH 'mysql_native_password';
13 GRANT ALL ON *.*TO 'x_root' @'10.0.2.1' WITH GRANT OPTION;
14
15 --echo # Check that X-protocol client can establish connection to the address 10.0.2.1 from the network namespace 'red'
16
17 --write_file $MYSQL_TMP_DIR/mysqlx-connected-user-info.tmp
18 -->sql
19 SELECT USER();
20 -->endsql
21 EOF
22
23 --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
24
25 --echo # Non existing namespace
26 --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
27
28 --echo # Simulate case where cap_sys_nice is not granted to mysqlxtest
29 --copy_file $exe_mysqlxtest $MYSQLTEST_VARDIR/tmp/mysqlxtest
30 --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
31
32 REVOKE ALL ON *.* FROM 'x_root' @'10.0.2.1';
33 DROP USER 'x_root' @'10.0.2.1';
34
35 --remove_file $MYSQL_TMP_DIR/mysqlx-connected-user-info.tmp
36 --remove_file $MYSQLTEST_VARDIR/tmp/mysqlxtest
37
38 --let $restart_parameters=
39 --source include/restart_mysqld.inc