| 1 |
## Test of session_connect_attrs capability in conjunction with Session.Reset |
| 2 |
|
| 3 |
## Preamble |
| 4 |
--source ../include/have_performance_schema_statements.inc |
| 5 |
--source include/xplugin_preamble.inc |
| 6 |
--source include/xplugin_create_user.inc |
| 7 |
## Test starts here |
| 8 |
|
| 9 |
CREATE USER xtest_client@localhost; |
| 10 |
GRANT ALL ON *.* TO xtest_client@localhost; |
| 11 |
|
| 12 |
--write_file $MYSQL_TMP_DIR/session_connect_attrs_with_session_reset.xpl |
| 13 |
-->varlet %TEST_KEY% custom_test_key |
| 14 |
-->import assert_status_variable.macro |
| 15 |
-->import connection_attributes.macro |
| 16 |
-->import connection.macro |
| 17 |
-->import mysqlx_session.macro |
| 18 |
|
| 19 |
-->echo |
| 20 |
-->echo |
| 21 |
-->echo ## I. Check the session_connect_attrs capability with Session.Reset with keep_open=false. |
| 22 |
-->echo # |
| 23 |
-->echo # 1. Set session_connect_attrs capability, then reset session and verify that the connection attributes are not present in the PFS. |
| 24 |
-->echo # 2. Set session_connect_attrs capability, then reset session and set new session_connect_attrs, after that verify that only the later connection attributes are present in the PFS. |
| 25 |
-->echo |
| 26 |
-->echo ## II. Check Session.Reset with different capabilities. |
| 27 |
-->echo # |
| 28 |
-->echo # 1. Set session_connect_attrs capability, then reset session, after that try to set capability of a type different than session_connect_attrs and verify that it fails. |
| 29 |
-->echo # 2. Set session_connect_attrs capability, then reset session, after that try to set session_connect_attrs and other valid capability and verify that it fails and no connection attributes are added to the PFS. |
| 30 |
-->echo # 3. Set session_connect_attrs capability, then reset session, after that try to set capability of a type different than session_connect_attrs and verify that it fails. After that send a session_connect_attrs cabapibility and verify if it succeeded. |
| 31 |
-->echo |
| 32 |
-->echo |
| 33 |
-->echo ## III. Check the session_connect_attrs capability with Session.Reset with keep_open=true. |
| 34 |
-->echo # |
| 35 |
-->echo # 1. Set session_connect_attr capability, then reset session with keep_open=true, verify that session connection attributes are still visible in the PFS. |
| 36 |
|
| 37 |
|
| 38 |
-->echo |
| 39 |
-->echo # |
| 40 |
-->echo # I.1 |
| 41 |
-->newsession test_session.I.1 - |
| 42 |
-->callmacro Verify_its_xprotocol_connection |
| 43 |
-->callmacro Send_session_connect_attrs_1 "%TEST_KEY%" "someValue" |
| 44 |
-->recvok |
| 45 |
-->login xtest_client |
| 46 |
-->callmacro Check_connect_attributes "%TEST_KEY%" "someValue" |
| 47 |
-->callmacro Session_reset |
| 48 |
-->recvok |
| 49 |
-->login xtest_client |
| 50 |
-->callmacro Check_connect_attributes_not_exist "%TEST_KEY%" "someValue" |
| 51 |
-->closesession |
| 52 |
|
| 53 |
-->echo |
| 54 |
-->echo # |
| 55 |
-->echo # I.2 |
| 56 |
-->newsession test_session.I.2 - |
| 57 |
-->callmacro Verify_its_xprotocol_connection |
| 58 |
-->callmacro Send_session_connect_attrs_1 "%TEST_KEY%" "someValue" |
| 59 |
-->recvok |
| 60 |
-->login xtest_client |
| 61 |
-->callmacro Check_connect_attributes "%TEST_KEY%" "someValue" |
| 62 |
-->callmacro Session_reset |
| 63 |
-->recvok |
| 64 |
-->callmacro Send_session_connect_attrs_1 "%TEST_KEY%" "nextValue" |
| 65 |
-->recvok |
| 66 |
-->login xtest_client |
| 67 |
-->callmacro Check_connect_attributes "%TEST_KEY%" "nextValue" |
| 68 |
-->callmacro Check_connect_attributes_not_exist "%TEST_KEY%" "someValue" |
| 69 |
-->closesession |
| 70 |
|
| 71 |
-->callmacro Wait_for_global_status_variable Mysqlx_sessions 1 |
| 72 |
|
| 73 |
-->echo |
| 74 |
-->echo # |
| 75 |
-->echo # II.1 |
| 76 |
-->newsession test_session.II.1 - |
| 77 |
-->callmacro Verify_its_xprotocol_connection |
| 78 |
-->callmacro Send_session_connect_attrs_1 "%TEST_KEY%" "someValue" |
| 79 |
-->recvok |
| 80 |
-->login xtest_client |
| 81 |
-->callmacro Check_connect_attributes "%TEST_KEY%" "someValue" |
| 82 |
-->callmacro Session_reset |
| 83 |
-->recvok |
| 84 |
Mysqlx.Connection.CapabilitiesSet { |
| 85 |
capabilities { |
| 86 |
capabilities { |
| 87 |
name: "tls" |
| 88 |
value { |
| 89 |
type: SCALAR |
| 90 |
scalar { |
| 91 |
type: V_BOOL |
| 92 |
v_bool: 0 |
| 93 |
} |
| 94 |
} |
| 95 |
} |
| 96 |
} |
| 97 |
} |
| 98 |
-->recverror ER_X_CAPABILITY_SET_NOT_ALLOWED |
| 99 |
|
| 100 |
-->echo |
| 101 |
-->echo # |
| 102 |
-->echo # II.2 |
| 103 |
-->newsession test_session.II.2 - |
| 104 |
-->callmacro Verify_its_xprotocol_connection |
| 105 |
-->callmacro Send_session_connect_attrs_1 "%TEST_KEY%" "someValue" |
| 106 |
-->recvok |
| 107 |
-->login xtest_client |
| 108 |
-->callmacro Check_connect_attributes "%TEST_KEY%" "someValue" |
| 109 |
-->callmacro Session_reset |
| 110 |
-->recvok |
| 111 |
-->varlet %SCALAR1% type: V_STRING v_string { value: "nextValue" } |
| 112 |
-->varlet %SCALAR2% type: V_BOOL v_bool: 1 |
| 113 |
-->callmacro Send_two_different_capabilities %SCALAR1% %SCALAR2% |
| 114 |
-->recverror ER_X_CAPABILITY_SET_NOT_ALLOWED |
| 115 |
-->login xtest_client |
| 116 |
-->callmacro Check_connect_attributes_not_exist "%TEST_KEY%" "someValue" |
| 117 |
-->callmacro Check_connect_attributes_not_exist "%TEST_KEY%" "nextValue" |
| 118 |
-->closesession |
| 119 |
|
| 120 |
-->echo |
| 121 |
-->echo # |
| 122 |
-->echo # II.3 |
| 123 |
-->newsession test_session.II.3 - |
| 124 |
-->callmacro Verify_its_xprotocol_connection |
| 125 |
-->callmacro Send_session_connect_attrs_1 "%TEST_KEY%" "someValue" |
| 126 |
-->recvok |
| 127 |
-->login xtest_client |
| 128 |
-->callmacro Check_connect_attributes "%TEST_KEY%" "someValue" |
| 129 |
-->callmacro Session_reset |
| 130 |
-->recvok |
| 131 |
Mysqlx.Connection.CapabilitiesSet { |
| 132 |
capabilities { |
| 133 |
capabilities { |
| 134 |
name: "tls" |
| 135 |
value { |
| 136 |
type: SCALAR |
| 137 |
scalar { |
| 138 |
type: V_BOOL |
| 139 |
v_bool: 0 |
| 140 |
} |
| 141 |
} |
| 142 |
} |
| 143 |
} |
| 144 |
} |
| 145 |
-->recverror ER_X_CAPABILITY_SET_NOT_ALLOWED |
| 146 |
-->callmacro Send_session_connect_attrs_1 "%TEST_KEY%" "nextValue" |
| 147 |
-->recvok |
| 148 |
-->login xtest_client |
| 149 |
-->callmacro Check_connect_attributes "%TEST_KEY%" "nextValue" |
| 150 |
-->closesession |
| 151 |
|
| 152 |
-->echo |
| 153 |
-->echo # |
| 154 |
-->echo # III.1 |
| 155 |
-->newsession test_session.III.1 - |
| 156 |
-->callmacro Verify_its_xprotocol_connection |
| 157 |
-->callmacro Send_session_connect_attrs_1 "%TEST_KEY%" "someValue" |
| 158 |
-->recvok |
| 159 |
-->login xtest_client |
| 160 |
-->callmacro Check_connect_attributes "%TEST_KEY%" "someValue" |
| 161 |
-->callmacro Session_reset_keep_open |
| 162 |
-->recvok |
| 163 |
-->callmacro Check_connect_attributes "%TEST_KEY%" "someValue" |
| 164 |
|
| 165 |
EOF |
| 166 |
|
| 167 |
exec $MYSQLXTEST |
| 168 |
-ux_root --password='' |
| 169 |
--file=$MYSQL_TMP_DIR/session_connect_attrs_with_session_reset.xpl 2>&1; |
| 170 |
|
| 171 |
## Cleanup |
| 172 |
DROP USER xtest_client@localhost; |
| 173 |
--source ../include/xplugin_cleanup.inc |