377 lines
5.6 KiB
Plaintext
377 lines
5.6 KiB
Plaintext
########### ../t/expect_noerror.test #########
|
|
### #
|
|
### This test runs aims to run expect.open and expect.close xmessage #
|
|
### with mysqlxtest client. #
|
|
### Test covers #
|
|
### - check condition_key (continue on error or not) #
|
|
# Do not continue on error if condition_key=1,default is #
|
|
# to continue #
|
|
### - Inherit parent's open block condition with "op" #
|
|
### - Nested open/close block #
|
|
### #
|
|
########################################################################
|
|
#
|
|
|
|
--source include/xplugin_preamble.inc
|
|
--source include/xplugin_create_user.inc
|
|
## Test starts here
|
|
--write_file $MYSQL_TMP_DIR/expect_noerror.tmp
|
|
|
|
-->echo Test 1
|
|
###### normal case, an error within an expect block
|
|
# open a no_error block from scratch
|
|
Mysqlx.Expect.Open {
|
|
cond {
|
|
condition_key: 1
|
|
}
|
|
}
|
|
-->recv
|
|
|
|
Mysqlx.Sql.StmtExecute {
|
|
namespace : "xplugin"
|
|
stmt : "ping"
|
|
}
|
|
-->recvresult
|
|
|
|
Mysqlx.Sql.StmtExecute {
|
|
namespace : "bla"
|
|
stmt : "bla"
|
|
}
|
|
# error
|
|
-->recv
|
|
|
|
Mysqlx.Sql.StmtExecute {
|
|
namespace : "xplugin"
|
|
stmt : "ping"
|
|
}
|
|
# should fail with expect error now
|
|
-->recv
|
|
|
|
Mysqlx.Expect.Close {
|
|
}
|
|
## Error expected
|
|
-->recv
|
|
|
|
Mysqlx.Sql.StmtExecute {
|
|
namespace : "xplugin"
|
|
stmt : "ping"
|
|
}
|
|
# should pass now
|
|
-->recv
|
|
|
|
|
|
-->echo Test 2
|
|
###### an error within a no-op expect block
|
|
Mysqlx.Expect.Open {
|
|
}
|
|
-->recv
|
|
|
|
Mysqlx.Sql.StmtExecute {
|
|
namespace : "xplugin"
|
|
stmt : "ping"
|
|
}
|
|
# ok
|
|
-->recv
|
|
|
|
Mysqlx.Sql.StmtExecute {
|
|
namespace : "bla"
|
|
stmt : "bla"
|
|
}
|
|
# error
|
|
-->recv
|
|
|
|
Mysqlx.Sql.StmtExecute {
|
|
namespace : "xplugin"
|
|
stmt : "ping"
|
|
}
|
|
# ok
|
|
-->recv
|
|
|
|
Mysqlx.Expect.Close {
|
|
}
|
|
# ok
|
|
-->recv
|
|
|
|
|
|
-->echo Test 3
|
|
####### a nested error block
|
|
Mysqlx.Expect.Open {
|
|
cond {
|
|
condition_key: 1
|
|
}
|
|
}
|
|
-->recv
|
|
|
|
Mysqlx.Expect.Open {
|
|
cond {
|
|
condition_key: 1
|
|
}
|
|
}
|
|
-->recv
|
|
|
|
Mysqlx.Sql.StmtExecute {
|
|
namespace : "bogus"
|
|
stmt : "ping"
|
|
}
|
|
# error
|
|
-->recv
|
|
|
|
Mysqlx.Expect.Close {
|
|
}
|
|
# error
|
|
-->recv
|
|
|
|
Mysqlx.Sql.StmtExecute {
|
|
namespace : "xplugin"
|
|
stmt : "ping"
|
|
}
|
|
# error
|
|
-->recv
|
|
|
|
Mysqlx.Expect.Close {
|
|
}
|
|
# error
|
|
-->recv
|
|
|
|
-->echo Test 4
|
|
####### a nested error block
|
|
Mysqlx.Expect.Open {
|
|
}
|
|
-->recv
|
|
|
|
Mysqlx.Expect.Open {
|
|
cond {
|
|
condition_key: 1
|
|
}
|
|
}
|
|
-->recv
|
|
|
|
Mysqlx.Sql.StmtExecute {
|
|
namespace : "bogus"
|
|
stmt : "ping"
|
|
}
|
|
# error
|
|
-->recv
|
|
|
|
Mysqlx.Sql.StmtExecute {
|
|
namespace : "xplugin"
|
|
stmt : "ping"
|
|
}
|
|
# error
|
|
-->recv
|
|
|
|
Mysqlx.Expect.Close {
|
|
}
|
|
# error
|
|
-->recv
|
|
|
|
Mysqlx.Sql.StmtExecute {
|
|
namespace : "bogus"
|
|
stmt : "ping"
|
|
}
|
|
# error
|
|
-->recv
|
|
|
|
Mysqlx.Sql.StmtExecute {
|
|
namespace : "xplugin"
|
|
stmt : "ping"
|
|
}
|
|
# no error
|
|
-->recv
|
|
|
|
Mysqlx.Expect.Close {
|
|
}
|
|
# no error
|
|
-->recv
|
|
|
|
|
|
|
|
-->echo Test 5
|
|
####### a nested error block
|
|
Mysqlx.Expect.Open {
|
|
cond {
|
|
condition_key: 1
|
|
}
|
|
}
|
|
-->recv
|
|
|
|
Mysqlx.Expect.Open {
|
|
}
|
|
-->recv
|
|
|
|
Mysqlx.Sql.StmtExecute {
|
|
namespace : "bogus"
|
|
stmt : "ping"
|
|
}
|
|
# error
|
|
-->recv
|
|
Mysqlx.Sql.StmtExecute {
|
|
namespace : "xplugin"
|
|
stmt : "ping"
|
|
}
|
|
# no error
|
|
-->recv
|
|
|
|
Mysqlx.Expect.Close {
|
|
}
|
|
# no error
|
|
-->recv
|
|
|
|
Mysqlx.Sql.StmtExecute {
|
|
namespace : "xplugin"
|
|
stmt : "ping"
|
|
}
|
|
# no error
|
|
-->recv
|
|
Mysqlx.Sql.StmtExecute {
|
|
namespace : "bogus"
|
|
stmt : "ping"
|
|
}
|
|
# error
|
|
-->recv
|
|
Mysqlx.Sql.StmtExecute {
|
|
namespace : "xplugin"
|
|
stmt : "ping"
|
|
}
|
|
# error
|
|
-->recv
|
|
|
|
|
|
Mysqlx.Expect.Close {
|
|
}
|
|
# no error
|
|
-->recv
|
|
|
|
-->echo Test 6 : Do not inherit parent condition by default
|
|
Mysqlx.Expect.Open {
|
|
cond {
|
|
condition_key: 1
|
|
}
|
|
}
|
|
-->recv
|
|
|
|
# Do not inherit parent's condition
|
|
# if "op" is not given then by default it inherit's parent's condition
|
|
Mysqlx.Expect.Open {
|
|
op: EXPECT_CTX_EMPTY
|
|
}
|
|
-->recv
|
|
|
|
Mysqlx.Sql.StmtExecute {
|
|
namespace : "bogus"
|
|
stmt : "ping"
|
|
}
|
|
# error
|
|
-->recv
|
|
Mysqlx.Sql.StmtExecute {
|
|
namespace : "xplugin"
|
|
stmt : "ping"
|
|
}
|
|
# no error
|
|
-->recv
|
|
|
|
Mysqlx.Expect.Close {
|
|
}
|
|
# no error
|
|
-->recv
|
|
|
|
Mysqlx.Sql.StmtExecute {
|
|
namespace : "xplugin"
|
|
stmt : "ping"
|
|
}
|
|
# no error
|
|
-->recv
|
|
Mysqlx.Sql.StmtExecute {
|
|
namespace : "bogus"
|
|
stmt : "ping"
|
|
}
|
|
#error
|
|
-->recv
|
|
Mysqlx.Sql.StmtExecute {
|
|
namespace : "xplugin"
|
|
stmt : "ping"
|
|
}
|
|
#error
|
|
-->recv
|
|
|
|
|
|
Mysqlx.Expect.Close {
|
|
}
|
|
#no error
|
|
-->recv
|
|
|
|
-->echo Test 7 : Inherit condition
|
|
# Do not inherit parent's condition when there is no parent
|
|
Mysqlx.Expect.Open {
|
|
op: EXPECT_CTX_EMPTY
|
|
}
|
|
-->recv
|
|
Mysqlx.Expect.Close {
|
|
}
|
|
#no error
|
|
-->recv
|
|
|
|
-->echo Test 8 : Inherit condition
|
|
# inherit parent's condition when there is no parent
|
|
Mysqlx.Expect.Open {
|
|
op: EXPECT_CTX_COPY_PREV
|
|
cond {
|
|
condition_key: 1
|
|
}
|
|
}
|
|
-->recv
|
|
|
|
Mysqlx.Sql.StmtExecute {
|
|
namespace : "xplugin"
|
|
stmt : "ping"
|
|
}
|
|
# no error
|
|
-->recv
|
|
Mysqlx.Sql.StmtExecute {
|
|
namespace : "bogus"
|
|
stmt : "ping"
|
|
}
|
|
#error
|
|
-->recv
|
|
Mysqlx.Sql.StmtExecute {
|
|
namespace : "xplugin"
|
|
stmt : "ping"
|
|
}
|
|
#error
|
|
-->recv
|
|
#
|
|
|
|
Mysqlx.Expect.Close {
|
|
}
|
|
#no error
|
|
-->recv
|
|
|
|
|
|
-->echo Test 9 : condition_key can take only value 1
|
|
Mysqlx.Expect.Open {
|
|
cond {
|
|
condition_key: 0
|
|
}
|
|
}
|
|
-->recv
|
|
|
|
Mysqlx.Expect.Open {
|
|
cond {
|
|
condition_key: 1200
|
|
}
|
|
}
|
|
-->recv
|
|
|
|
# try to close un-opened block
|
|
Mysqlx.Expect.Close {
|
|
}
|
|
-->recv
|
|
|
|
EOF
|
|
|
|
--exec $MYSQLXTEST -ux_root --password='' --file=$MYSQL_TMP_DIR/expect_noerror.tmp 2>&1
|
|
|
|
## Cleanup
|
|
--remove_file $MYSQL_TMP_DIR/expect_noerror.tmp
|
|
--source include/xplugin_drop_user.inc
|