Github user ptnapoleon commented on a diff in the pull request:
https://github.com/apache/cassandra-dtest/pull/9#discussion_r149296501
--- Diff: upgrade_tests/upgrade_compact_storage.py ---
@@ -0,0 +1,177 @@
+# coding: utf-8
+
+import time
+
+from cassandra.query import dict_factory
+from nose.tools import assert_equal, assert_true
+from ccmlib.node import NodeError
+
+from dtest import Tester, debug
+from cassandra.protocol import ConfigurationException
+from tools.decorators import since
+
+VERSION_311 = 'git:cassandra-3.11'
+VERSION_TRUNK = 'git:trunk'
+
+
+@since('4.0')
+class UpgradeSuperColumnsThrough(Tester):
+ def upgrade_to_version(self, tag, start_rpc=True, wait=True,
nodes=None):
+ debug('Upgrading to ' + tag)
+ if nodes is None:
+ nodes = self.cluster.nodelist()
+
+ for node in nodes:
+ debug('Shutting down node: ' + node.name)
+ node.drain()
+ node.watch_log_for("DRAINED")
+ node.stop(wait_other_notice=False)
+
+ # Update Cassandra Directory
+ for node in nodes:
+ node.set_install_dir(version=tag)
+ debug("Set new cassandra dir for %s: %s" % (node.name,
node.get_install_dir()))
+ self.cluster.set_install_dir(version=tag)
+
+ # Restart nodes on new version
+ for node in nodes:
+ debug('Starting %s on new version (%s)' % (node.name, tag))
+ node.start(wait_other_notice=wait, wait_for_binary_proto=wait)
+
+ def prepare(self, num_nodes=1,
cassandra_version="github:apache/cassandra-2.2"):
+ cluster = self.cluster
+
+ # Forcing cluster version on purpose
+ cluster.set_install_dir(version=cassandra_version)
+
+ cluster.populate(num_nodes)
+
+ cluster.start()
+ return cluster
+
+ def upgrade_compact_storage_test(self):
+ cluster =
self.prepare(cassandra_version='github:apache/cassandra-3.0')
+ node = self.cluster.nodelist()[0]
+ cursor = self.patient_cql_connection(node,
row_factory=dict_factory)
+
+ cursor.execute("CREATE KEYSPACE ks WITH replication = {'class':
'SimpleStrategy','replication_factor': '1' };")
+ cursor.execute("CREATE TABLE ks.compact_table (pk int PRIMARY KEY,
col1 int, col2 int) WITH COMPACT STORAGE")
+
+ for i in xrange(1, 5):
+ cursor.execute("INSERT INTO ks.compact_table (pk, col1, col2)
VALUES ({i}, {i}, {i})".format(i=i))
+
+ self.upgrade_to_version(VERSION_TRUNK, wait=False)
+ self.allow_log_errors = True
+
+ time.sleep(5)
+ # After restart, it won't start
+ errors = len(node.grep_log("Compact Tables are not allowed in
Cassandra starting with 4.0 version"))
+ assert_true(errors > 0)
+
+ def mixed_cluster_test(self):
+ cluster = self.prepare(num_nodes=2, cassandra_version=VERSION_311)
+ node1 = self.cluster.nodelist()[0]
--- End diff --
Should just be `node1, node2 = cluster.nodelist()`
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]