From d905969006bd0619fc319dab638167185c574fdb Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Mon, 20 Feb 2023 16:14:35 +0100 Subject: [PATCH 1/3] Fix 01565_reconnect_after_client_error test (wrong expect code for multi-line mode) Signed-off-by: Azat Khuzhin --- .../01565_reconnect_after_client_error.expect | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/queries/0_stateless/01565_reconnect_after_client_error.expect b/tests/queries/0_stateless/01565_reconnect_after_client_error.expect index 255248ba61a..4e710fa8262 100755 --- a/tests/queries/0_stateless/01565_reconnect_after_client_error.expect +++ b/tests/queries/0_stateless/01565_reconnect_after_client_error.expect @@ -24,18 +24,27 @@ spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \ expect "\n:) " send -- "DROP TABLE IF EXISTS t01565;\n" +# NOTE: this is important for -mn mode, you should send "\r" only after reading echoed command +expect "DROP" +send -- "\r" expect "\nOk." expect "\n:)" send -- "CREATE TABLE t01565 (c0 String, c1 Int32) ENGINE = Memory() ;\n" +expect "CREATE" +send -- "\r" expect "\nOk." expect "\n:) " send -- "INSERT INTO t01565(c0, c1) VALUES (\"1\",1) ;\n" +expect "INSERT" +send -- "\r" expect "\nConnected" expect "\n:) " send -- "INSERT INTO t01565(c0, c1) VALUES ('1', 1) ;\n" +expect "INSERT" +send -- "\r" expect "\nOk." expect "\n:) " From 2a0cebfc493ae521cc88c06ca235bc8a0c9b6433 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Mon, 20 Feb 2023 19:27:11 +0100 Subject: [PATCH 2/3] Fix timeouts in 01565_reconnect_after_client_error Signed-off-by: Azat Khuzhin --- .../0_stateless/01565_reconnect_after_client_error.expect | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/queries/0_stateless/01565_reconnect_after_client_error.expect b/tests/queries/0_stateless/01565_reconnect_after_client_error.expect index 4e710fa8262..143e94ae1f3 100755 --- a/tests/queries/0_stateless/01565_reconnect_after_client_error.expect +++ b/tests/queries/0_stateless/01565_reconnect_after_client_error.expect @@ -15,9 +15,9 @@ match_max 100000 expect_after { # Do not ignore eof from expect - eof { exp_continue } + -i $any_spawn_id eof { exp_continue } # A default timeout action is to do nothing, change it to fail - timeout { exit 1 } + -i $any_spawn_id timeout { exit 1 } } spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion -mn --history_file=$history_file" From e169b36b8891840595085593bd77ef8bc885bdb3 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Tue, 21 Feb 2023 08:22:23 +0100 Subject: [PATCH 3/3] Replace 01565_reconnect_after_client_error with 01565_query_loop_after_client_error There is no need in explicit reconnect in case of client errors (#19353), so just rewrite the test to ensure that everything works. Signed-off-by: Azat Khuzhin --- ...t_error.expect => 01565_query_loop_after_client_error.expect} | 1 - ...r.reference => 01565_query_loop_after_client_error.reference} | 0 2 files changed, 1 deletion(-) rename tests/queries/0_stateless/{01565_reconnect_after_client_error.expect => 01565_query_loop_after_client_error.expect} (98%) rename tests/queries/0_stateless/{01565_reconnect_after_client_error.reference => 01565_query_loop_after_client_error.reference} (100%) diff --git a/tests/queries/0_stateless/01565_reconnect_after_client_error.expect b/tests/queries/0_stateless/01565_query_loop_after_client_error.expect similarity index 98% rename from tests/queries/0_stateless/01565_reconnect_after_client_error.expect rename to tests/queries/0_stateless/01565_query_loop_after_client_error.expect index 143e94ae1f3..bf701225605 100755 --- a/tests/queries/0_stateless/01565_reconnect_after_client_error.expect +++ b/tests/queries/0_stateless/01565_query_loop_after_client_error.expect @@ -39,7 +39,6 @@ expect "\n:) " send -- "INSERT INTO t01565(c0, c1) VALUES (\"1\",1) ;\n" expect "INSERT" send -- "\r" -expect "\nConnected" expect "\n:) " send -- "INSERT INTO t01565(c0, c1) VALUES ('1', 1) ;\n" diff --git a/tests/queries/0_stateless/01565_reconnect_after_client_error.reference b/tests/queries/0_stateless/01565_query_loop_after_client_error.reference similarity index 100% rename from tests/queries/0_stateless/01565_reconnect_after_client_error.reference rename to tests/queries/0_stateless/01565_query_loop_after_client_error.reference