The problem with --foreground option is that it send the signal only to
the process that had been spawned by timeout(1), while it can create
lots of children, and when you killing parent you are closing pipes and
childrens will get EPIPE, like in [1].
[1]: https://s3.amazonaws.com/clickhouse-test-reports/0/069f8bbb2f48541cc736903e1da5459fa2c27da0/stateless_tests__debug__%5B2_5%5D.html
Another problem is that now child process will finish correctly, which
may also print some errors like QUERY_WAS_CANCELLED (see [2]).
[2]: https://s3.amazonaws.com/clickhouse-test-reports/0/ef66714bf20042ba9cb5d59b7839befe26110b93/stateless_tests__release__analyzer_.html
In general this is not required actually, since all timeout invocations
uses timeout value less then the default test limit (10min). But it may
leave some processes in case of overriding this limit, i.e.
`clickhouse-test --timeout 1`
So to workaround this at least somehow, let's send SIGTERM and only
after some timeout (here I use 0.1), SIGKILL. This will give at least
some ability to terminate all childrens that had been spawned by
timeout(1).
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
One of such cases is 02479_race_condition_between_insert_and_droppin_mv
[1], yes it can be fixed (by using fixed number of iterations, or with
some bash trickery), but it is better to fix them completelly,
eventually such tests will be submitted and pass review anyway.
By allocating process group for each test we can kill all the processes
in this process group, and this what this patch does.
This will also fix some test hangs (like in [1]) as well as some
possible issues in stress tests.
[1]: https://s3.amazonaws.com/clickhouse-test-reports/0/e2c1230b00386c4d0096a245396ab3be7ce60950/stateless_tests__release__analyzer_/run.log
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
(cherry picked from commit 72fa58e192)
One of such cases is 02479_race_condition_between_insert_and_droppin_mv
[1], yes it can be fixed (by using fixed number of iterations, or with
some bash trickery), but it is better to fix them completelly,
eventually such tests will be submitted and pass review anyway.
By allocating process group for each test we can kill all the processes
in this process group, and this what this patch does.
This will also fix some test hangs (like in [1]) as well as some
possible issues in stress tests.
[1]: https://s3.amazonaws.com/clickhouse-test-reports/0/e2c1230b00386c4d0096a245396ab3be7ce60950/stateless_tests__release__analyzer_/run.log
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
Previusly it worked only for the case when the clickhouse-client/script
exited with non 0, because the check was done before checking the
reference file.
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
The problem is that old versions of cURL (7.81.0 at least) handle
additional parameters incorrectly if in previous parameter was "/":
$ docker run --rm curlimages/curl:8.1.2 --http1.1 --get -vvv 'http://kernel.org/?bar=foo/baz' --data-urlencode "query=select 1 format Null"; echo
> GET /?bar=foo/baz&query=select+1+format+Null HTTP/1.1
> User-Agent: curl/8.1.2
$ docker run --rm curlimages/curl:7.81.0 --http1.1 --get -vvv 'http://kernel.org/?bar=foo/baz' --data-urlencode "query=select 1 format Null"; echo
> GET /?bar=foo/baz?query=select+1+format+Null HTTP/1.1
> User-Agent: curl/7.81.0-DEV
Note, that I thought about making the same for cli, but it is not that
easy, even after getting rid of sh -c and string contantenation, it
still cannot be done for CLICKHOUSE_CLIENT_OPT.
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
There was some cases when some patches to the datetime code leads to
flaky tests, due to the tests itself had been runned using regular
timezone (TZ).
But if you will this tests with something "specific" (that is not
strictly defined around 1970 year), those tests will fail.
So to catch such issues in the PRs itself, let's randomize
session_timezone as well.
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
* Do not randomize prefetch settings for debug build
* Update tests/clickhouse-test
---------
Co-authored-by: Alexander Tokmakov <tavplubix@gmail.com>
Co-authored-by: Alexander Tokmakov <tavplubix@clickhouse.com>