Commit Graph

2 Commits

Author SHA1 Message Date
Kefu Chai
4661671220 s3/test: do not keep the tempdir forever
by default, up to 3 temporary directories are kept by pytest.
but we run only a single time for each of the $TMPDIR. per
our recent observation, it takes a lot more time for jenkins
to scan the tempdir if we use it for scylla's rundir.

so, to alleviate this symptom, we just keep up to one failed
session in the tempdir. if the test passes, the tempdir
created by pytest will be nuked. normally it is located at
scylladb/testlog/${mode}/pytest-of-$(whoami).

see also
https://docs.pytest.org/en/7.3.x/reference/reference.html#confval-tmp_path_retention_policy

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

Closes #14735

[xemul: Withdrawing from PR's comments

    object_store is the only test which

        is using tmpdir fixture
        starts / stops scylla by itself
        and put the rundir of scylla in its own tmpdir

    we don't register the step of cleaning up [the temp dir] using the utilities provided by
    cql-pytest. we rely on pytest to perform the cleanup. while cql-pytest performs the
    cleanup using a global registry.
]
2023-07-18 16:49:25 +03:00
Kefu Chai
471d75c6c6 s3/test: restructure object_store/run into a pytest
instead of using a single run to perform the test, restructure
it into a pytest based test suite with a single test case.
this should allow us to add more tests exercising the object-storage
and cached/tierd storage in future.

* add fixtures so they can be reused by tests
* use tmpdir fixture for managing the tmpdir, see
  https://docs.pytest.org/en/6.2.x/tmpdir.html#the-tmpdir-fixture
* perform part of the teardown in the "test_tempdir()" fixture
* change the type of test from "Run" to "Python"
* rename "run" to "test_basic.py"
* optionally start the minio server if the settings are not
  found in command line or env variables, so that the tests are
  self-contained without the fixture setup by test.py.
* instead of sys.exit(), use assert statement, as this is
  what pytest uses.

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
2023-07-05 17:05:13 +08:00