in upgrade_tests/upgrade_manifest.py [0:0]
def set_version_family():
"""
Detects the version family (line) using dtest.py:CASSANDRA_VERSION_FROM_BUILD
"""
# todo CASSANDRA-14421
# current_version = CASSANDRA_VERSION_FROM_BUILD
# There are times when we want to know the C* version we're testing against
# before we call Tester.setUp. In the general case, we can't know that -- the
# test method could use any version it wants for self.cluster. However, we can
# get the version from build.xml in the C* repository specified by
# CASSANDRA_VERSION or CASSANDRA_DIR. This should use the same resolution
# strategy as the actual checkout code in Tester.setUp; if it does not, that is
# a bug.
cassandra_version_slug = CONFIG.getoption("--cassandra-version")
cassandra_dir = CONFIG.getoption("--cassandra-dir") or CONFIG.getini("cassandra_dir")
# Prefer CASSANDRA_VERSION if it's set in the environment. If not, use CASSANDRA_DIR
if cassandra_version_slug:
# fetch but don't build the specified C* version
ccm_repo_cache_dir, _ = ccmlib.repository.setup(cassandra_version_slug)
current_version = get_version_from_build(ccm_repo_cache_dir)
else:
current_version = get_version_from_build(cassandra_dir)
# TODO add a new item whenever Cassandra is branched
if current_version.vstring.startswith('2.0'):
version_family = CASSANDRA_2_0
elif current_version.vstring.startswith('2.1'):
version_family = CASSANDRA_2_1
elif current_version.vstring.startswith('2.2'):
version_family = CASSANDRA_2_2
elif current_version.vstring.startswith('3.0'):
version_family = CASSANDRA_3_0
elif current_version.vstring.startswith('3.11'):
version_family = CASSANDRA_3_11
elif current_version.vstring.startswith('4.0'):
version_family = CASSANDRA_4_0
elif current_version.vstring.startswith('4.1'):
version_family = CASSANDRA_4_1
elif current_version.vstring.startswith('5.0'):
version_family = CASSANDRA_5_0
else:
# when this occurs, it's time to update this manifest a bit!
raise RuntimeError("Testing upgrades from/to version %s is not supported. Please use a custom manifest (see upgrade_manifest.py)" % current_version.vstring)
global VERSION_FAMILY
VERSION_FAMILY = version_family
logger.info("Setting version family to %s\n" % VERSION_FAMILY)