old_contents: from dtest import Tester
  from assertions import *
  from tools import *
  import time
  
  class TestSchema(Tester):
  
      @require('#3919')
      def remove_columndef_test(self):
          """ Remove a column definition while a node is dead """
  
          cluster = self.cluster
          cluster.populate(2).start()
          nodes = cluster.nodelist()
          time.sleep(.3)
  
          cursor = self.cql_connection(nodes[0]).cursor()
          self.create_ks(cursor, 'ks', 3)
  
          cursor.execute("""
              CREATE TABLE cf (
                  key int PRIMARY KEY,
                  c1 int,
                  c2 int
              )
          """)
  
          # Shutdown a node and do an update
          nodes[1].stop()
          cursor.execute("ALTER TABLE cf DROP c2")
          nodes[0].compact() # compact the schema CF
          time.sleep(.5)
  
          # Restart the dead node and do a new (trivial) update to make sure the
          # schema are in agreement
          nodes[1].start()
          time.sleep(.5)
          cursor.execute("ALTER TABLE cf ADD c3 int")
  
          # Check the schema don't reference c2 anymore
          # (use the cli to be compatible with 1.0)
          cli = nodes[0].cli()
          cli.do("use ks")
          cli.do("describe ks")
          assert "Column Name: c2" not in cli.last_output(), cli.last_output()
  
new_contents: from cql import ProgrammingError
  from dtest import Tester
  from tools import *
  import time
  
  class TestSchema(Tester):
      @since('#3919')
      def drop_column_compact_test(self):
          cursor = self.prepare()
  
          cursor.execute("USE ks")
          cursor.execute("CREATE TABLE cf (key int PRIMARY KEY, c1 int, c2 int) WITH COMPACT STORAGE")
  
          with self.assertRaises(ProgrammingError) as cm:
              cursor.execute("ALTER TABLE cf DROP c1")
          self.assertEqual("Bad Request: Cannot drop columns from a non-CQL3 CF",
                           cm.exception.message)
  
      @since('#3919')
      def drop_column_test(self):
          cursor = self.prepare()
  
          cursor.execute("USE ks")
          cursor.execute("CREATE TABLE cf (key int PRIMARY KEY, c1 int, c2 int)")
          cursor.execute("CREATE INDEX ON cf(c2)")
  
          # insert some data.
          cursor.execute("INSERT INTO cf (key, c1, c2) VALUES (0, 1, 2)")
          cursor.execute("INSERT INTO cf (key, c1, c2) VALUES (1, 2, 3)")
          cursor.execute("INSERT INTO cf (key, c1, c2) VALUES (2, 3, 4)")
  
          # drop and readd c1.
          cursor.execute("ALTER TABLE cf DROP c1")
          cursor.execute("ALTER TABLE cf ADD c1 int")
  
          # add another row.
          cursor.execute("INSERT INTO cf (key, c1, c2) VALUES (3, 4, 5)")
  
          # test that old (pre-drop) c1 values aren't returned and new ones are.
          cursor.execute("SELECT c1 FROM cf")
          self.assertEqual([[None], [None], [None], [4]], sorted(cursor.fetchall()))
  
          cursor.execute("SELECT * FROM cf")
          self.assertEqual([[0,None,2], [1,None,3], [2,None,4], [3,4,5]], sorted(cursor.fetchall()))
  
          cursor.execute("SELECT c1 FROM cf WHERE key = 0")
          self.assertEqual([None], cursor.fetchone())
  
          cursor.execute("SELECT c1 FROM cf WHERE key = 3")
          self.assertEqual([4], cursor.fetchone())
  
          cursor.execute("SELECT * FROM cf WHERE c2 = 2")
          self.assertEqual([0,None,2], cursor.fetchone())
  
          cursor.execute("SELECT * FROM cf WHERE c2 = 5")
          self.assertEqual([3,4,5], cursor.fetchone())
  
      def prepare(self):
          cluster = self.cluster
          cluster.populate(1).start()
          time.sleep(1)
          nodes = cluster.nodelist()
          cursor = self.cql_connection(nodes[0], version='3.0.10').cursor()
          self.create_ks(cursor, 'ks', 1)
          return cursor
  
subject: add tests for #3919