diff --git a/tests/queries/0_stateless/01300_client_save_history_when_terminated.reference b/tests/queries/0_stateless/01300_client_save_history_when_terminated.reference new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/queries/0_stateless/01300_client_save_history_when_terminated.sh b/tests/queries/0_stateless/01300_client_save_history_when_terminated.sh new file mode 100755 index 00000000000..5ffcbbda883 --- /dev/null +++ b/tests/queries/0_stateless/01300_client_save_history_when_terminated.sh @@ -0,0 +1,35 @@ +#!/usr/bin/expect -f + +log_user 0 +set timeout 60 +match_max 100000 + +spawn clickhouse-client +expect ":) " + +# Make a query +send -- "SELECT 'for the history'\r" +expect "for the history" +expect ":) " + +# Kill the client to check if the history was saved +exec kill -9 [exp_pid] +close + +# Run client one more time and press "up" to see the last recorded query +spawn clickhouse-client +expect ":) " +send -- "\[A" +expect "SELECT 'for the history'" + +# Will check that Ctrl+C clears current line. +send -- "\3" +expect ":)" + +# Will check that second Ctrl+C invocation does not exit from client. +send -- "\3" +expect ":)" + +# But Ctrl+D does. +send -- "\4" +expect eof