You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by dc...@apache.org on 2021/01/08 18:17:13 UTC

[cassandra-dtest] branch trunk updated: fix version checking for 4.0+ conditionals

This is an automated email from the ASF dual-hosted git repository.

dcapwell pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra-dtest.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 5cf417b  fix version checking for 4.0+ conditionals
5cf417b is described below

commit 5cf417bd6cf4077e3a0fe7339d0c974d4cda4762
Author: Adam Holmberg <ad...@datastax.com>
AuthorDate: Wed Dec 23 12:31:31 2020 -0600

    fix version checking for 4.0+ conditionals
    
    patch by Adam Holmberg; reviewed by Benjamin Lerer, David Capwell for CASSANDRA-16330
---
 upgrade_tests/paging_test.py         |  8 ++------
 upgrade_tests/thrift_upgrade_test.py | 20 ++++----------------
 upgrade_tests/upgrade_base.py        | 13 +++++--------
 3 files changed, 11 insertions(+), 30 deletions(-)

diff --git a/upgrade_tests/paging_test.py b/upgrade_tests/paging_test.py
index 11df0b9..06c5dfd 100644
--- a/upgrade_tests/paging_test.py
+++ b/upgrade_tests/paging_test.py
@@ -471,9 +471,7 @@ class TestPagingData(BasePagingTester, PageAssertionMixin):
                 ) WITH COMPACT STORAGE;
             """)
 
-        version_string = self.upgrade_version_string()
-        #4.0 doesn't support compact storage
-        if version_string == 'trunk' or version_string >= MAJOR_VERSION_4:
+        if testing_compact_storage and self.upgrade_is_version_4_or_greater():  # 4.0 doesn't support compact storage
             cursor.execute("ALTER TABLE test2 DROP COMPACT STORAGE;")
 
         for is_upgraded, cursor in self.do_upgrade(cursor):
@@ -527,9 +525,7 @@ class TestPagingData(BasePagingTester, PageAssertionMixin):
                 ) WITH COMPACT STORAGE;
             """)
 
-        version_string = self.upgrade_version_string()
-        #4.0 doesn't support compact storage
-        if version_string == 'trunk' or version_string >= MAJOR_VERSION_4:
+        if testing_compact_storage and self.upgrade_is_version_4_or_greater():  # 4.0 doesn't support compact storage
             cursor.execute("ALTER TABLE test2 DROP COMPACT STORAGE;")
 
         for is_upgraded, cursor in self.do_upgrade(cursor):
diff --git a/upgrade_tests/thrift_upgrade_test.py b/upgrade_tests/thrift_upgrade_test.py
index cad1d7e..491786e 100644
--- a/upgrade_tests/thrift_upgrade_test.py
+++ b/upgrade_tests/thrift_upgrade_test.py
@@ -588,10 +588,7 @@ class TestThrift(UpgradeTester):
         _validate_dense_cql(cursor)
         _validate_dense_thrift(client)
 
-        version_string = self.upgrade_version_string()
-        is_version_4_or_greater = version_string == 'trunk' or version_string >= '4.0'
-        #4.0 doesn't support compact storage
-        if is_version_4_or_greater:
+        if self.upgrade_is_version_4_or_greater():  # 4.0 doesn't support compact storage
             cursor.execute("ALTER TABLE ks.dense_super_1 DROP COMPACT STORAGE;")
 
         for is_upgraded, cursor in self.do_upgrade(cursor, row_factory=dict_factory, use_thrift=True):
@@ -628,10 +625,7 @@ class TestThrift(UpgradeTester):
         _validate_dense_cql(cursor, cf='dense_super_2', key='renamed_key', column1='renamed_column1', column2='renamed_column2', value='renamed_value')
         _validate_dense_thrift(client, cf='dense_super_2')
 
-        version_string = self.upgrade_version_string()
-        is_version_4_or_greater = version_string == 'trunk' or version_string >= '4.0'
-        #4.0 doesn't support compact storage
-        if is_version_4_or_greater:
+        if self.upgrade_is_version_4_or_greater():  # 4.0 doesn't support compact storage
             cursor.execute("ALTER TABLE ks.dense_super_2 DROP COMPACT STORAGE;")
 
         for is_upgraded, cursor in self.do_upgrade(cursor, row_factory=dict_factory, use_thrift=True):
@@ -671,10 +665,7 @@ class TestThrift(UpgradeTester):
         _validate_sparse_thrift(client)
         _validate_sparse_cql(cursor, column1='renamed_column1', key='renamed_key')
 
-        version_string = self.upgrade_version_string()
-        is_version_4_or_greater = version_string == 'trunk' or version_string >= '4.0'
-        #4.0 doesn't support compact storage
-        if is_version_4_or_greater:
+        if self.upgrade_is_version_4_or_greater():  # 4.0 doesn't support compact storage
             cursor.execute("ALTER TABLE ks.sparse_super_1 DROP COMPACT STORAGE;")
 
         for is_upgraded, cursor in self.do_upgrade(cursor, row_factory=dict_factory, use_thrift=True):
@@ -711,10 +702,7 @@ class TestThrift(UpgradeTester):
         _validate_sparse_thrift(client, cf='sparse_super_2')
         _validate_sparse_cql(cursor, cf='sparse_super_2')
 
-        version_string = self.upgrade_version_string()
-        is_version_4_or_greater = version_string == 'trunk' or version_string >= '4.0'
-        #4.0 doesn't support compact storage
-        if is_version_4_or_greater:
+        if self.upgrade_is_version_4_or_greater():  # 4.0 doesn't support compact storage
             cursor.execute("ALTER TABLE ks.sparse_super_2 DROP COMPACT STORAGE;")
 
         for is_upgraded, cursor in self.do_upgrade(cursor, row_factory=dict_factory, use_thrift=True):
diff --git a/upgrade_tests/upgrade_base.py b/upgrade_tests/upgrade_base.py
index 62a06ea..04c0c18 100644
--- a/upgrade_tests/upgrade_base.py
+++ b/upgrade_tests/upgrade_base.py
@@ -251,18 +251,15 @@ class UpgradeTester(Tester, metaclass=ABCMeta):
         )
         assert self.UPGRADE_PATH is not None, no_upgrade_path_error
 
-    def upgrade_version_string(self):
+    def upgrade_version_family(self):
         """
         Returns a hopefully useful version string that can be compared
         to tune test behavior. For trunk this returns trunk, for an earlier
         version like github:apache/cassandra-3.11 it returns a version number
         as a string
-        :return:
         """
-        version_string = self.UPGRADE_PATH.upgrade_version
-        if version_string.startswith('github'):
-            version_string = version_string.partition('/')[2]
-        if "-" in version_string:
-            version_string = version_string.partition('-')[2]
-        return version_string
+        return self.UPGRADE_PATH.upgrade_meta.family
 
+    def upgrade_is_version_4_or_greater(self):
+        upgrade_version = self.upgrade_version_family()
+        return upgrade_version == 'trunk' or upgrade_version >= '4.0'


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org