Skip to content

Commit fea5074

Browse files
jacek-lewandowskijacek-lewandowski
authored andcommitted
STAR-247: Allow to easily run tests against big or bti sstable format
(cherry picked from commit 8c96801) (cherry picked from commit 8f68014) (cherry picked from commit c204342)
1 parent 387d688 commit fea5074

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

conftest.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ def check_required_loopback_interfaces_available():
4343

4444

4545
def pytest_addoption(parser):
46+
parser.addoption("--sstable-format", action="store", default="bti",
47+
help="SSTable format to be used by default for all newly created SSTables: "
48+
"big or bti (default: bti)")
4649
parser.addoption("--use-vnodes", action="store_true", default=False,
4750
help="Determines wither or not to setup clusters using vnodes for tests")
4851
parser.addoption("--use-off-heap-memtables", action="store_true", default=False,

dtest_config.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
class DTestConfig:
1313
def __init__(self):
14+
self.sstable_format = "bti"
1415
self.use_vnodes = True
1516
self.use_off_heap_memtables = False
1617
self.num_tokens = -1
@@ -41,6 +42,12 @@ def setup(self, config):
4142
self.cassandra_version_from_build = self.get_version_from_build()
4243
return
4344

45+
self.sstable_format = config.getoption("--sstable-format")
46+
if self.sstable_format:
47+
assert self.sstable_format in ['bti', 'big'], "SSTable format {} is invalid - must be either bti or big".format(self.sstable_format)
48+
default_sstable_format_prop = " -Dcassandra.sstable.format.default=" + self.sstable_format
49+
os.environ.update({"JVM_EXTRA_OPTS": (os.environ.get("JVM_EXTRA_OPTS") or "") + default_sstable_format_prop})
50+
4451
self.use_vnodes = config.getoption("--use-vnodes")
4552
self.use_off_heap_memtables = config.getoption("--use-off-heap-memtables")
4653
self.num_tokens = config.getoption("--num-tokens")

run_dtests.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
#!/usr/bin/env python
22
"""
3-
usage: run_dtests.py [-h] [--use-vnodes] [--use-off-heap-memtables] [--num-tokens=NUM_TOKENS] [--data-dir-count-per-instance=DATA_DIR_COUNT_PER_INSTANCE]
3+
usage: run_dtests.py [-h] [--sstable-format=FORMAT] [--use-vnodes] [--use-off-heap-memtables] [--num-tokens=NUM_TOKENS] [--data-dir-count-per-instance=DATA_DIR_COUNT_PER_INSTANCE]
44
[--force-resource-intensive-tests] [--skip-resource-intensive-tests] [--cassandra-dir=CASSANDRA_DIR] [--cassandra-version=CASSANDRA_VERSION]
55
[--delete-logs] [--execute-upgrade-tests] [--execute-upgrade-tests-only] [--disable-active-log-watching] [--keep-test-dir]
66
[--enable-jacoco-code-coverage] [--dtest-enable-debug-logging] [--dtest-print-tests-only] [--dtest-print-tests-output=DTEST_PRINT_TESTS_OUTPUT]
77
[--pytest-options=PYTEST_OPTIONS] [--dtest-tests=DTEST_TESTS]
88
99
optional arguments:
1010
-h, --help show this help message and exit
11+
--sstable-format SSTable format to be used by default for all newly created SSTables: big or bti (default: bti)
1112
--use-vnodes Determines wither or not to setup clusters using vnodes for tests (default: False)
1213
--use-off-heap-memtables Enable Off Heap Memtables when creating test clusters for tests (default: False)
1314
--num-tokens=NUM_TOKENS Number of tokens to set num_tokens yaml setting to when creating instances with vnodes enabled (default: 256)

0 commit comments

Comments
 (0)