Commit Graph

10 Commits

Author SHA1 Message Date
Azat Khuzhin
cb4d665c02 tests: fix 02116_interactive_hello for "official build"
Example of such greeting:

    2023-02-26 15:26:33 expect: does "\u001b[0J\u001b[?25hClickHouse client version 23.3.1.207 (official build).\r\nConnecting to database test_i4r0kozg at localhost:9000 as user default.\r\nConnected to ClickHouse server version 23.3.1 revision 54461.\r\n\r\nWarnings:\r\n * Server logging level is set to 'test' and performance is degraded. This cannot be used in production.\r\n * Linux is not using a fast clock source. Performance can be degraded. Check /sys/devices/system/clocksource/clocksource0/current_clocksource\r\n * The setting 'allow_remote_fs_zero_copy_replication' is enabled for MergeTree tables. But the feature of 'zero-copy replication' is under development and is not ready for production. The usage of this feature can lead to data corruption and loss. The setting should be disabled in production.\r\n * Table system.session_log is enabled. It's unreliable and may contain garbage. Do not use it for any kind of security monitoring.\r\n\r\n\u001b[?2004h\u001b[1Gfunctional-tests :) " (spawn_id exp4) match regular expression "ClickHouse client version [\d]{2}.[\d]{1,2}.[\d]{1,2}.[\d]{1,}.\r"? Gate "ClickHouse client version *\r"? gate=yes re=no

CI: https://s3.amazonaws.com/clickhouse-test-reports/0/df1e18ad4cb9b08240273169ca7dd6ca1cac617c/stateless_tests__aarch64_/run.log
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2023-02-26 07:35:38 +01:00
Azat Khuzhin
5321a8183e Fix 02116_interactive_hello test
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2023-02-25 09:04:54 +01:00
Azat Khuzhin
a3b3e2dcc1 Fix timeout for expect tests by fixing expect_after timeout
By default expect matches patterns against output from the current
process, however if you don't have stdin attached (like the case for
CI), you will not have anything to check against, hence "timeout" simply
does not work.

Likely expect has $any_spawn_id (another option is to put expect_after
after spawn).

v2: use $any_spawn_id
Refs: https://github.com/ClickHouse/ClickHouse/pull/43819
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2023-02-23 15:02:19 +01:00
Azat Khuzhin
a6d420a1c6 One cannot use /dev/null as a history file since replxx run chmod
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2023-02-20 13:59:46 +01:00
Azat Khuzhin
238d44783b Fix flakiness of expect tests for clickhouse-client by avoiding history overlap
Yes, all writes to the history file is done under flock, *but*, before
writing the history file there is sort(), and so if you will run the
following tests the 01300_client_save_history_when_terminated_long will fail:

    $ /src/tests/clickhouse-test --print-time -j2 01180_client_syntax_errors 01300_client_save_history_when_terminated_long 0001_select

And it has nothing todo with timeouts:

    expect: does "" (spawn_id exp8) match glob pattern "for the history"? no
    f8f1dbfdaaca :) select (1, 2
    expect: does "\u001b[1Gf8f1dbfdaaca :) select \u001b[0;22;33m(\u001b[0;22;32m1\u001b[0;1m,\u001b[0m \u001b[0;22;32m2\u001b[0m\u001b[J" (spawn_id exp8) match glob pattern "for the history"? no

    expect: does "\u001b[1Gf8f1dbfdaaca :) select \u001b[0;22;33m(\u001b[0;22;32m1\u001b[0;1m,\u001b[0m \u001b[0;22;32m2\u001b[0m\u001b[J\u001b[29G" (spawn_id exp8) match glob pattern "for the history"? no
    expect: timed out

The "select (1, 2" is from 01180_client_syntax_errors

And use real file only when the history should be preserved across runs
(i.e. there are multiple invocations of clickhouse-client)

CI: https://s3.amazonaws.com/clickhouse-test-reports/0/1adfbac19fed9813725d8b1df14e617b58a45d20/stateless_tests__asan__[2/2].html
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2023-02-20 09:51:08 +01:00
Azat Khuzhin
e4b81e6de9 Add exp_internal for expect tests
This is to catch possible issues like 01565_reconnect_after_client_error in [1].

  [1]: https://s3.amazonaws.com/clickhouse-test-reports/38417/e33f236d502fe9f7906392f4ceffaee44e3c4ce4/stateless_tests__thread__actions__[3/3].html

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-07-02 17:08:06 +03:00
Azat Khuzhin
c541ee386b Mark some expect tests as long
CI: https://s3.amazonaws.com/clickhouse-test-reports/33263/765c7980b84ef6a7851a5fe2846a06f08382f03a/stateless_tests_flaky_check__address__actions_.html
2021-12-29 10:02:38 +03:00
Azat Khuzhin
a424b4ad56 Do not ignore eof in expect tests
expect_after that adjusts default timeout handler, reseted eof handler,
and this tell expect that it can ignore eof from read, consider the
following example:

<details>

    ```expect
    #!/usr/bin/expect -f

    exp_internal 1
    log_user 1
    set timeout 4
    match_max 100000

    expect_after {
        # eof { exp_continue }
        timeout {
            exit 1
        }
    }

    spawn bash -c "sleep 1; echo ':) '"
    expect ":) "
    ```

    ```
    $ ./expect.expect < /dev/null
    spawn bash -c sleep 1; echo ':) '
    parent: waiting for sync byte
    parent: telling child to go ahead
    parent: now unsynchronized from child
    spawn: returns {6614}

    expect: does "" (spawn_id exp4) match glob pattern ":) "? no
    expect: read eof
                 ^^^
    expect: set expect_out(spawn_id) "exp0"
    expect: set expect_out(buffer) ""
    ```

And with uncommented eof handler:

    ```
    $ ./expect.expect < /dev/null
    spawn bash -c sleep 1; echo ':) '
    parent: waiting for sync byte
    parent: telling child to go ahead
    parent: now unsynchronized from child
    spawn: returns {17959}

    expect: does "" (spawn_id exp4) match glob pattern ":) "? no
    expect: read eof
    expect: set expect_out(spawn_id) "exp0"
    expect: set expect_out(buffer) ""
    expect: continuing expect after update

    expect: does "" (spawn_id exp4) match glob pattern ":) "? no

    expect: does ":) \r\n" (spawn_id exp4) match glob pattern ":) "? yes
    expect: set expect_out(0,string) ":) "
    expect: set expect_out(spawn_id) "exp4"
    expect: set expect_out(buffer) ":) "
    ```

</details>
2021-12-29 10:02:38 +03:00
Azat Khuzhin
cb394c95d0 Enable tests that requires completion in fasttest 2021-12-17 22:14:37 +03:00
kssenii
9ea8408d8d Add test 2021-11-14 07:58:19 +00:00