Commit Graph

512 Commits

Author SHA1 Message Date
Andrei Chekun
bad7407718 test.py: Add support for BOOST_DATA_TEST_CASE
Currently, test.py will throw an error if the test will use
BOOST_DATA_TEST_CASE. test.py as a first step getting all test
functions in the file, but when BOOST_DATA_TEST_CASE will be used the
output will have additional lines indicating parametrized test that
test.py can not handle. This commit adds handling this case, as a caveat
all tests should start from 'test' or they will be ignored.

Closes: #20530

Closes scylladb/scylladb#20556
2024-09-13 13:44:26 +03:00
Andrei Chekun
27e5fa149a [test.py] Clean duplicated arg for test suite
Arguments mode and run_id already set in the _prepare_pytest_params, so
there is no need to set them one more time.
2024-09-03 14:41:57 +02:00
Andrei Chekun
8a9146ebda [test.py] Enable allure for python test
Enable allure adapter for all python tests. Add tag and parameters to the test to be able to distinguish them across modes and runs.

Related: https://github.com/scylladb/qa-tasks/issues/1665
2024-09-03 14:41:57 +02:00
Kamil Braun
292ef0d1f9 Merge 'Fix node replace with inter-dc encryption enabled.' from Gleb Natapov
Currently if a coordinator and a node being replaced are in the same DC
while inter-dc encryption is enabled (connections between nodes in the
same DC should not be encrypted) the replace operation will fail. It
fails because a coordinator uses non encrypted connection to push raft
data to the new node, but the new node will not accept such connection
until it knows which DC the coordinator belongs to and for that the raft
data needs to be transferred.

The series adds the test for this scenario and the fix for the
chicken&egg problem above.

The series (or at least the fix itself) needs to be backported because
this is a serious regression.

Fixes: scylladb/scylladb#19025

Closes scylladb/scylladb#20290

* github.com:scylladb/scylladb:
  topology coordinator: fix indentation after the last patch
  topology coordinator: do not add replacing node without a ring to topology
  test: add test for replace in clusters with encryption enabled
  test.py: add server encryption support to cluster manager
  .gitignore: fix pattern for resources to match only one specific directory
2024-08-30 11:29:05 +02:00
Gleb Natapov
b98282a976 test.py: add server encryption support to cluster manager 2024-08-29 17:14:09 +03:00
Andrei Chekun
fd51332978 test.py: Add parameter to control the pool size from the command line
Add parameter --cluster-pool-size that can control pool size for all
PythonTestSuite tests. By default, the pool size set to 10 for most of
the suites, but this is too much for laptops. So this parameter can be
used to lower the pool size and not to freeze the system. Additionally,
the environment variable CLUSTER_POOL_SIZE was added for a convenient way
to limit pool size in the system without the need to provide each time an
additional parameter.

Related: https://github.com/scylladb/scylladb/pull/20276

Closes scylladb/scylladb#20289
2024-08-26 19:55:41 +03:00
Avi Kivity
2ef5b5e4fe Revert "[test.py] Increase pool size for CI"
This reverts commit cc428e8a36. It causes
may spurious CI failures while nodes are being torn down. Revert it until
the root cause is fixed, after which it can be reinstated.

Fixes #20116.
2024-08-21 13:21:08 +03:00
Kefu Chai
e8f9f71ef3 test.py: fix the indent
and take this opportunity to fix a typo in comment.

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
2024-08-16 13:32:57 +08:00
Kefu Chai
e88166f7a4 test.py: use XPath for iterating in "TestSuite/TestSuite"
before this change, we check for the existence of "TestSuite" node
under the root of XML tree, and then enumerating all "TestSuite" nodes
under this "TestSuite", this approach works. but it

* introduces unnecessary indent
* is not very readable

in this change, we just use "./TestSuite/TestSuite" for enumerating
all "TestSuite" nodes under "TestSuite". simpler this way.

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
2024-08-16 13:32:33 +08:00
Andrei Chekun
f24f5b7db2 test.py: Fix boost XML conversion to allure when XML file is empty
The method cannot find the TestSuite in the XML file and fails the whole job, however tests are passed. The issue was in incorrect understanding of boost summarization method. It creates one file for all modes, so there is no need to go through all modes to convert the XML file for allure.

Closes: https://github.com/scylladb/scylladb/issues/20161

Closes scylladb/scylladb#20165
2024-08-15 20:15:31 +03:00
Andrei Chekun
3407ae5d8f [test.py] Add Junit logger for boost test
Currently, boost tests aren't using Junit. Enable Junit report output and clean them from skipped test, since boost tests are executed by function name rather than filename. This allows including boost tests result to the Allure report.

Related: https://github.com/scylladb/qa-tasks/issues/1665

Closes scylladb/scylladb#19925
2024-08-14 22:18:31 +03:00
Andrei Chekun
cc428e8a36 [test.py] Increase pool size for CI
Currently, the resource utilization in CI is low. Increasing the number of clusters will increase how many tests are executed simultaneously. This will decrease the time it takes to execute and improve resource utilization.

Related: https://github.com/scylladb/qa-tasks/issues/1667

Closes scylladb/scylladb#19832
2024-08-06 11:20:36 +03:00
Piotr Dulikowski
f00c4eaf72 Merge '[test.py] add --extra-scylla-cmdline-options argument for test.py' from Artsiom Mishuta
this PR has 2 commits
- [test: pass Scylla extra CMD args from test.py args](6b367a04b5)
- [test: adjust scylla_cluster.merge_cmdline_options behavior](c60b36090a)

the main goal is to solve [test.py: provide an easy-to-remember, univeral way to run scylla with trace level logging](https://github.com/scylladb/scylladb/issues/14960) issue

but also can be used to easily apply additional arguments for all UnitTests and PythonTests on the fly from the test.py CMD

Closes scylladb/scylladb#19509

* github.com:scylladb/scylladb:
  test: adjust scylla_cluster.merge_cmdline_options behavior
  test: pass scylla extra CMD args from test.py args
2024-06-28 11:11:29 +02:00
Andrei Chekun
561e88f00e [test.py] Throw meaningful error when something wrong wit Scylla binary
Fixes: https://github.com/scylladb/scylladb/issues/19489

There is already a check that Scylla binary is executable, but it's done on later stage. So in logs for specific test file there will be a message about something wrong with binary, but in console there will be now signs of that. Moreover, there will be an error that completely misleads what actually happened and why test run failed. With this check test will fail earlier providing the correct reason why it's failed

Closes scylladb/scylladb#19491
2024-06-27 17:38:32 +03:00
Artsiom Mishuta
440785bc41 test: pass scylla extra CMD args from test.py args
this commit introduces a test.py option --extra-scylla-cmdline-options
to pass extra scylla cmdline options for all tests.

Options should be space-separated:
'--logger-log-level raft=trace --default-log-level error'
2024-06-27 10:02:55 +02:00
Kefu Chai
e61061d19f test.py: improve help message on tests selection
Since 3afbd21f, we are able to selectively choose a single test
in a boost test executable which represents a test suite, and to
choose a single test in a pytest script with the syntax of
"test_suite::test_case". it's very handy for manual testing.

so let's document in the command line help message as well.

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>

Closes scylladb/scylladb#19454
2024-06-24 14:27:02 +03:00
Andrei Chekun
7bbb8d9260 [test.py] Fix URl for failed logs directory in CI
Incorrect passing of the artifacts_dir_url parameter from test.py to pytest leads to the situation when it will pass None as a string and pytest will generate incorrect URL.
2024-06-17 11:16:48 +02:00
Andrei Chekun
8d1d206aff [test.py] Add uniqueness to the test name
In CI test always executed with option --repeat=3 that leads to generate 3 test results with the same name. Junit plugin in CI cannot distinguish correctly the difference between these results. In case when we have two passes and one fail, the link to test result will sometimes be redirected to the incorrect one because the test name is the same.
To fix this ReportPlugin added that will be responsible to modify the test case name during junit report generation adding to the test name mode and run id.

Fixes: https://github.com/scylladb/scylladb/issues/17851

Fixes: https://github.com/scylladb/scylladb/issues/15973
2024-06-14 11:23:04 +02:00
Pavel Emelyanov
159e44d08a test.py: Make it possible to avoid wildcard test names matching
There's a nasty scenario when this searching plays bad joke.

When CI picks up a new branch and notices, that a test had changed, it
spawns a custom job with test.py --repeat 100 $changed_test_name in
it. Next, when the test.py tries opt-in test name matching, it uses the
wildcard search and can pick up extra unwanted tests into the run.

To solve this, the case-selection syntax is extended. Now if the caller
specifies `suite/test::*` as test, the test file is selected by exact
name match, but the specific test-case is not selected, the `*` makes it
run all cases.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>

Closes scylladb/scylladb#18704
2024-05-20 15:50:47 +02:00
Andrei Chekun
bce53efd36 Enrich test results produced by test.py
This PR resolves issue with double count of the test result for topology tests. It will not appear in the consolidated report anymore.
Another fix is to provide a better view which test failed by modifying the test case name in the report enriching it with mode and run id, so making them unique across the run.

The scope of this change is:
1. Modify the test name to have run id in name
2. Add handlers to get logs of test.py and pytest in one file that are related to test, rather than to the full suite
3. Remove topology tests from aggregating them on a suite level in Junit results
4. Add a link to the logs related to the failed tests in Junit results, so it will be easier to navigate to all logs related to test
5. Gather logs related to the failed test to one directory for better logs investigation

Ref: scylladb/scylladb#17851

Closes scylladb/scylladb#18277
2024-05-20 15:33:57 +02:00
Andrei Chekun
76a766cab0 Migrate alternator tests to PythonTestSuite
As part of the unification process, alternator tests are migrated to the PythonTestSuite instead of using the RunTestSuite. The main idea is to have one suite, so there will be easier to maintain and introduce new features.
Introduce the prepare_sql option for suite.yaml to add possibility to run cql statements as precondition for the test suite.
Related: https://github.com/scylladb/scylladb/issues/18188

Closes scylladb/scylladb#18442
2024-05-13 13:23:29 +03:00
Beni Peled
223275b4d1 test.py: add the pytest junit_suite_name parameter
By default the suitename in the junit files generated by pytest
is named `pytest` for all suites instead of the suite, ex. `topology_experimental_raft`
With this change, the junit files will use the real suitename

This change doesn't affect the Test Report in Jenkins, but it
raised part of the other task of publishing the test results to
elasticsearch https://github.com/scylladb/scylla-pkg/pull/3950
where we parse the XMLs and we need the correct suitename

Closes scylladb/scylladb#18172
2024-04-15 21:07:00 +03:00
Pavel Emelyanov
2c90aeb5ee test.py: Give local variable meaningful name
Rename t to testname as it's more informative

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2024-03-25 14:53:48 +03:00
Pavel Emelyanov
b2f5b63aaa test.py: Sanitize test list creation
To create the list of tests to run there's a loop that fist collects all
tests from suits, then filters the list in two ways -- excludes
opt-out-ed lists (disabled and matching the skip pattern) or leaves
there only opt-in-ed (those, specified as positional arguments).

This patch keeps both list-checking code close to each other so that the
intent is explicitly clear.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2024-03-25 14:53:20 +03:00
Andrei Chekun
7de28729e7 test: change maintenance socket location to /tmp
Fixes #16912

By default, ScyllaDB stores the maintenance socket in the workdir. Test.py by default uses the location for the ScyllaDB workdir as testlog/{mode}/scylla-#. The Usual location for cloning the repo is the user's home folder. In some cases, it can lead the socket path being too long and the test will start to fail. The simple way is to move the maintenance socket to /tmp folder to eliminate such a possibility.

Closes scylladb/scylladb#17941
2024-03-21 18:22:21 +02:00
Andrei Chekun
b52f79b1ce Fix leaking file descriptors in test.py
Fixes #17569

Tests are not closing file descriptor after it finishes. This leads to inability to continue tests since the default value for opened files in Linux is 1024. Issue easy to reproduce with the next command:
```
$ ./test.py --mode debug test_native_transport --repeat 1500
```
After fix applied all tests are passed with a next command:
```
$ ./test.py --mode debug test_native_transport --repeat 10000
```

Closes scylladb/scylladb#17798
2024-03-19 14:59:14 +01:00
Kefu Chai
69f140eea6 test.py: s/summarize_tests/summarize_boost_tests/
summarize_tests() is only used to summarize boost tests, so reflect
this fact using its name. we will need to summarize the tests which
generate JUnit XML as well, so this change also prepares for a
following-up change to implement a new summarize helper.

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>

Closes scylladb/scylladb#17746
2024-03-12 14:49:01 +02:00
Pavel Emelyanov
3afbd21faa test.py: Support case selection for boost tests
Boost tests support case-by-case execution and always turn it on -- when
run, boost test is split into parallel-running sub-tests each with the
specific case name.

This patch tunes this, so that when a test is run like

   test.py boost/testname::casename

No parallel-execution happens, but instead just the needed casename is
run. Example of selection:

   test.py --mode=${mode} boost/bptree_test::test_cookie_find

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2024-03-11 09:09:10 +03:00
Piotr Smaroń
44bbf2e57b test.py: improve readability of failures resulting in empty XML
Before the change, when a test failed because of some error
in the `cql_test_env.cc`, we were getting:
```
error: boost/virtual_table_test: failed to parse XML output '/home/piotrs/src/scylla2/testlog/debug/xml/boost.virtual_table_test.test_system_config_table_read.1.xunit.xml': no element found: line 1, column 0
```
After the change we're getting:
```
error: boost/virtual_table_test: Empty testcase XML output, possibly caused by a crash in the cql_test_env.cc, details: '/home/piotrs/src/scylla2/testlog/debug/xml/boost.virtual_table_test.test_system_config_table_read.1.xunit.xml': no element found: line 1, column 0
```

Closes scylladb/scylladb#17679
2024-03-08 15:17:12 +02:00
Tomasz Grabiec
85ae10f632 Merge 'Make it possible to run individual pytest cases with test.py' from Pavel Emelyanov
Today's test.py allows filtering tests to run with the `test.py --options name` syntax. The "name" argument is then considered to be some prefix, and when iterating tests only those whose name starts with that prefix are collected and executed. This has two troubles.

Minor: since it is prefix filtering, running e.g. topology_custom/test_tablets will run test_tablets _and_ test_tablets_migration from it. There's no way to exclude the latter from this selection. It's not common, but careful file names selection is welcome for better ~~user~~ testing experience.

Major: most of test files in topology and python suites contain many cases, some are extremely long. When the intent is to run a single, potentially fast, test case one needs to either wait or patch the test .py file by hand to somehow exclude unwanted test cases.

This PR adds the ability to run individual test case with test.py. The new syntax is `test.py --options name::case`. If the "::case" part is present two changes apply.

First, the test file selection is done by name match, not by prefix match. So running topology_custom/test_tablets will _not_ select test_tablets_migration from it.

Second, the "::case" part is appended to the pytest execution so that it collects and runs only the specified test case.

Closes scylladb/scylladb#17481

* github.com:scylladb/scylladb:
  test.py: Add test-case splitting in 'name' selection
  test.py: Add casename argument to PythonTest
2024-03-08 12:56:39 +01:00
Patryk Jędrzejczak
9dfb26428b test: topology: decrease the server's request timeouts
We decrease the server's request timeouts in topology tests so that
they are lower than the driver's timeout. Before, the driver could
time out its request before the server handled it successfully.
This problem caused scylladb/scylladb#15924.

A high server's request timeout can slow down the topology tests
(see the new comment in `make_scylla_conf`). We make the timeout
dependent on the testing mode to not slow down tests for no reason.

We don't touch the driver's request timeout. Decreasing it in some
modes would require too much effort for almost no improvement.

Fixes scylladb/scylladb#15924
2024-02-29 18:37:38 +01:00
Pavel Emelyanov
5682e51a97 test.py: Add test-case splitting in 'name' selection
When filtering a test by 'name' consider that name can be in a
'test::case' format. If so, get the left part to be the filter and the
right part to be the case name to be passed down to test itself.

Later, when the pytest starts it then appends the case name (if not
None) to the pytest execution, thus making it run only the specified
test-case, not the whole test file.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2024-02-22 19:24:10 +03:00
Pavel Emelyanov
b64710b0c6 test.py: Add casename argument to PythonTest
And propagate it from add_test() helper. For now keep it None, next
patch will bring more sense to this place

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2024-02-22 19:23:06 +03:00
Lakshmi Narayanan Sreethar
f8f8d64982 test.py: support skipping multiple test patterns
Support skipping multiple patterns by allowing them to be passed via
multiple '--skip' arguments to test.py.

Example : `test.py --skip=topology --skip=sstables`

Signed-off-by: Lakshmi Narayanan Sreethar <lakshmi.sreethar@scylladb.com>

Closes scylladb/scylladb#17220
2024-02-13 17:32:03 +02:00
Kefu Chai
f5e3a2d98e test.py: add boost_tests() to suite
this change is a cleanup.

so it only returns tests, to be more symmetric with `junit_tests()`.
this allows us to drop the dummy `get_test_case()` in `PythonTestSuite`.
as only the BoostTest will be asked for `get_test_case()` after this
change.

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>

Closes scylladb/scylladb#16961
2024-01-31 13:43:21 +02:00
Kefu Chai
ee28cf2285 test.py: s/defalt/default/
this typo was identified by codespell

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>

Closes scylladb/scylladb#16980
2024-01-25 16:54:07 +02:00
Kefu Chai
35b3c51f40 test.py: add "launcher" option support
before this change, all "tool" test suites use "pytest" to launch their
tests. but some of the tests might need a dedicated namespace so they
do not interfere with each other. fortunately, "unshare(1)" allows us
to run a progame in new namespaces.

in this change, we add a "launcher" option to "tool" test suites. so
that these tests can run with the specified "launcher" instead of using
"launcher". if "launcher" is not specified, its default value of
"pytest" is used.

Refs #16542
Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
2024-01-25 20:28:01 +08:00
Kefu Chai
a9851cf834 test.py: replace "$foo is False" with "not $foo"
for better readability.

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>

Closes scylladb/scylladb#16960
2024-01-24 15:21:53 +02:00
Lakshmi Narayanan Sreethar
a1867986e7 test.py: deduce correct path for unit tests when built with cmake
Fix the path deduction for unit test executables when the source code is
built with cmake.

Fixes #16906

Signed-off-by: Lakshmi Narayanan Sreethar <lakshmi.sreethar@scylladb.com>

Closes scylladb/scylladb#16907
2024-01-22 10:03:44 +02:00
Eliran Sinvani
c7dff1b81b test.py: support code coverage
test.py already support the routing of coverage data into a
predetermined folder under the `tmpdir` logs folder. This patch extends
on that and leverage the code coverage processing libraries to produce
test coverage lcov files and a coverage summary at the end of the run.
The reason for not generating the full report (which can be achieved
with a one liner through the `coverage_utils.py` cli) is that it is
assumed that unit testing is not necessarily the "last stop" in the
testing process and it might need to be joined with other coverage
information that is created at other testing stages (for example dtest).

The result of this patch is that when running test.py with one of the
coverage options (`--coverage` / `--mode-coverage`) it will perform
another step of processing and aggregating the profiling information
created.

Signed-off-by: Eliran Sinvani <eliransin@scylladb.com>
2024-01-18 11:11:34 +02:00
Eliran Sinvani
f4b6c9074a test.py: support --coverage and --coverage-mode
We aim to support code coverage reporting as part of our development
process, to this end, we will need the ability to "route" the dumped
profiles from scylla and unit test to a predetermined location.
We can consider profile data as logged data that should persist after
tests have been run.

For this we add two supported options to test.py:
--coverage - which means that all suits on all modes will participate in
             coverage.
--coverage-mode - which can be used to "turn on" coverage support only
                  for some of the modes in this run.

The strategy chosen is to save the profile data in
`tmpdir`/mode/coverage/%m.profraw (ref:
https://clang.llvm.org/docs/SourceBasedCodeCoverage.html#running-the-instrumented-program)
This means that for every suite the profiling data of each object is
going to be merged into the same file (llvm claims to lock the file so
concurrency is fine).
More resolution than the suite level seems to not give us anything
useful (at least not at the moment). Moreover, it can also be achieved
by running a single test.
Data in the suite level will help us to detect suits that don't generate
coverage data at all and to fix this or to skip generating the profiles
for them.

Also added support of  'coverage' parameter in the `suite.yaml` file,
which can be used to disable coverage for a specific suite, this
parameter defaults to True but if a suite is known to not generate
profiles or the suite profile data is not needed or obfuscate the result
it can be set to false in order to cancel profiles routing and
processing for this suite.

Signed-off-by: Eliran Sinvani <eliransin@scylladb.com>
2024-01-18 11:11:34 +02:00
Kefu Chai
382a5e2d0c test.py: build using build/build.ninja when it exists
CMake puts `build.ninja` under `build`, so use it if it exists, and
fall back to current directory otherwise.

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
2024-01-10 10:01:02 +08:00
Kefu Chai
6674e87842 test.py: extract ninja()
use ninja() to build target using `ninja`. since CMake puts
`build.ninja` under "build", while `configure.py` puts it under
the root source directory, this change prepares us for a follow-up
change to build with build/build.ninja.

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
2024-01-10 10:01:02 +08:00
Kefu Chai
5fda822c4e test.py: extract path_to()
use path_to() to find the path to the directory under build directory.

this change helps to find the executables built using CMake as well.

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
2024-01-10 10:01:02 +08:00
Kefu Chai
0b11ae9fe6 test.py: define all_modes as a dict of mode:CMAKE_BUILD_TYPE
because scylla build mode and CMAKE_BUILD_TYPE is not identical,
let's define `all_modes` as a dict so we can look it up.
this change prepares for a follow-up commit which adds a path
resolver which support both build system generator: the plain
`configure.py` and CMake driven by `configure.py`.

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
2024-01-10 10:01:02 +08:00
Kefu Chai
47d8edc0fc test.py: s/asyncio.get_event_loop()/asyncio.get_running_loop()/
the latter raises a RuntimeError if there is no no running event loop,
while the former gets one from the the default policy in this case.
in the use cases in test.py, there is always a running event loop,
when `asyncio.get_event_loop()` gets called. so let's use
the preferred `asyncio.get_running_loop()`.

see https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.get_event_loop

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>

Closes scylladb/scylladb#16398
2024-01-04 08:39:49 +02:00
Konstantin Osipov
246da8884a test.py: override SCYLLA_* env keys
test.py inherits its env from the user, which is the right thing:
some python modules, e.g. logging, do accept env-based configuration.

However, test.py also starts subprocesses, i.e. tests, which start
scylladb instances. And when the instance is started without an explicit
configuration file, SCYLLA_CONF from user environment can be used.

If this scylla.conf contains funny parameters, e.g. unsupported
configuration options, the tests may break in an unexpected way.

Avoid this by resetting the respecting env keys in test.py.

Fixes gh-16583

Closes scylladb/scylladb#16577
2023-12-31 13:02:49 +02:00
Yaniv Kaul
0b0a3ee7fc Typos: fix typos in code
Last batch, hopefully, sing codespell, went over the docs and fixed some typos.

Refs: https://github.com/scylladb/scylladb/issues/16255
Signed-off-by: Yaniv Kaul <yaniv.kaul@scylladb.com>

Closes scylladb/scylladb#16388
2023-12-13 10:45:21 +02:00
Yaron Kaikov
c3ee53f3be test.py: enable xml validation
Following https://github.com/scylladb/scylladb/issues/4774#issuecomment-1752089862

Adding back xml validation

Closes: https://github.com/scylladb/scylla-pkg/issues/3441

Closes scylladb/scylladb#16198
2023-11-29 09:02:36 +02:00
Kamil Braun
3bcee6a981 Revert "Merge 'Change all tests to shut down gracefully on shutdown' from Eliran Sinvani"
This reverts commit 7c7baf71d5.

If `stop_gracefully` times out during test teardown phase, it crashes
the test framework reporting multiple errors, for example:
```
12:35:52  /jenkins/workspace/scylla-master/next/scylla/test/pylib/artifact_registry.py:41: RuntimeWarning: coroutine 'PythonTestSuite.get_cluster_factory.<locals>.create_cluster.<locals>.stop' was never awaited
12:35:52    self.exit_artifacts = {}
12:35:52  RuntimeWarning: Enable tracemalloc to get the object allocation traceback
12:35:52  Stopping server ScyllaServer(470, 127.126.216.43, a577f4c7-d5e6-4bdb-8d37-727c11e2a8df) gracefully took longer than 60s
12:35:52  Traceback (most recent call last):
12:35:52    File "/usr/lib64/python3.11/asyncio/tasks.py", line 500, in wait_for
12:35:52      return fut.result()
12:35:52             ^^^^^^^^^^^^
12:35:52    File "/usr/lib64/python3.11/asyncio/subprocess.py", line 137, in wait
12:35:52      return await self._transport._wait()
12:35:52             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12:35:52    File "/usr/lib64/python3.11/asyncio/base_subprocess.py", line 230, in _wait
12:35:52      return await waiter
12:35:52             ^^^^^^^^^^^^
12:35:52  asyncio.exceptions.CancelledError
12:35:52
12:35:52  The above exception was the direct cause of the following exception:
12:35:52
12:35:52  Traceback (most recent call last):
12:35:52    File "/jenkins/workspace/scylla-master/next/scylla/test/pylib/scylla_cluster.py", line 521, in stop_gracefully
12:35:52      await asyncio.wait_for(wait_task, timeout=STOP_TIMEOUT_SECONDS)
12:35:52    File "/usr/lib64/python3.11/asyncio/tasks.py", line 502, in wait_for
12:35:52      raise exceptions.TimeoutError() from exc
12:35:52  TimeoutError
12:35:52
12:35:52  During handling of the above exception, another exception occurred:
12:35:52
12:35:52  Traceback (most recent call last):
12:35:52    File "/jenkins/workspace/scylla-master/next/scylla/./test.py", line 1615, in workaround_python26789
12:35:52      code = await main()
12:35:52             ^^^^^^^^^^^^
12:35:52    File "/jenkins/workspace/scylla-master/next/scylla/./test.py", line 1582, in main
12:35:52      await run_all_tests(signaled, options)
12:35:52    File "/jenkins/workspace/scylla-master/next/scylla/./test.py", line 1359, in run_all_tests
12:35:52      await reap(done, pending, signaled)
12:35:52    File "/jenkins/workspace/scylla-master/next/scylla/./test.py", line 1342, in reap
12:35:52      result = coro.result()
12:35:52               ^^^^^^^^^^^^^
12:35:52    File "/jenkins/workspace/scylla-master/next/scylla/./test.py", line 201, in run
12:35:52      await test.run(options)
12:35:52    File "/jenkins/workspace/scylla-master/next/scylla/./test.py", line 957, in run
12:35:52      async with get_cluster_manager(self.mode + '/' + self.uname, self.suite.clusters, test_path) as manager:
12:35:52    File "/usr/lib64/python3.11/contextlib.py", line 211, in __aexit__
12:35:52      await anext(self.gen)
12:35:52    File "/jenkins/workspace/scylla-master/next/scylla/test/pylib/scylla_cluster.py", line 1330, in get_cluster_manager
12:35:52      await manager.stop()
12:35:52    File "/jenkins/workspace/scylla-master/next/scylla/test/pylib/scylla_cluster.py", line 1024, in stop
12:35:52      await self.clusters.put(self.cluster, is_dirty=True)
12:35:52    File "/jenkins/workspace/scylla-master/next/scylla/test/pylib/pool.py", line 104, in put
12:35:52      await self.destroy(obj)
12:35:52    File "/jenkins/workspace/scylla-master/next/scylla/./test.py", line 368, in recycle_cluster
12:35:52      await cluster.stop_gracefully()
12:35:52    File "/jenkins/workspace/scylla-master/next/scylla/test/pylib/scylla_cluster.py", line 689, in stop_gracefully
12:35:52      await asyncio.gather(*(server.stop_gracefully() for server in self.running.values()))
12:35:52    File "/jenkins/workspace/scylla-master/next/scylla/test/pylib/scylla_cluster.py", line 527, in stop_gracefully
12:35:52      raise RuntimeError(
12:35:52  RuntimeError: Stopping server ScyllaServer(470, 127.126.216.43, a577f4c7-d5e6-4bdb-8d37-727c11e2a8df) gracefully took longer than 60s
12:35:58  sys:1: RuntimeWarning: coroutine 'PythonTestSuite.get_cluster_factory.<locals>.create_cluster.<locals>.uninstall' was never awaited
12:35:58  sys:1: RuntimeWarning: coroutine 'PythonTestSuite.get_cluster_factory.<locals>.create_cluster.<locals>.stop' was never awaited
```
2023-11-09 12:30:35 +01:00