github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/cli/interactive_tests/test_notice.tcl (about) 1 #! /usr/bin/env expect -f 2 3 source [file join [file dirname $argv0] common.tcl] 4 5 # This test ensures notices are being sent as expected. 6 7 spawn $argv demo --empty 8 eexpect root@ 9 10 start_test "Test that notices always appear at the end after all results." 11 send "SELECT IF(@1=4,crdb_internal.notice('hello'),@1) AS MYRES FROM generate_series(1,10);\r" 12 eexpect myres 13 eexpect 1 14 eexpect 10 15 eexpect "10 rows" 16 eexpect "NOTICE: hello" 17 eexpect root@ 18 19 # Ditto with multiple result sets. Notices after all result sets. 20 send "SELECT crdb_internal.notice('hello') AS STAGE1;" 21 send "SELECT crdb_internal.notice('world') AS STAGE2;\r" 22 send "SELECT crdb_internal.notice('warning', 'stay indoors') AS STAGE3;\r" 23 eexpect stage1 24 eexpect stage2 25 eexpect "NOTICE: hello" 26 eexpect "NOTICE: world" 27 eexpect "WARNING: stay indoors" 28 eexpect root@ 29 interrupt 30 eexpect eof 31 end_test