Removed cluster reuse from codebase
Project: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/commit/1cc49419 Tree: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/tree/1cc49419 Diff: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/diff/1cc49419 Branch: refs/heads/master Commit: 1cc4941916a3df199821f974e47acd667f65c2b8 Parents: 93aa314 Author: MichaelHamm <[email protected]> Authored: Mon Jun 19 11:06:13 2017 -0700 Committer: Philip Thompson <[email protected]> Committed: Tue Jun 20 12:09:35 2017 +0200 ---------------------------------------------------------------------- INSTALL.md | 4 ---- README.md | 3 +-- cqlsh_tests/cqlsh_copy_tests.py | 24 +----------------------- dtest.py | 25 ------------------------- upgrade_tests/cql_tests.py | 14 +------------- 5 files changed, 3 insertions(+), 67 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/1cc49419/INSTALL.md ---------------------------------------------------------------------- diff --git a/INSTALL.md b/INSTALL.md index 0e9e9e1..69985c3 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -129,10 +129,6 @@ will often need to modify them in some fashion at some later point: cd ~/git/cstar/cassandra-dtest PRINT_DEBUG=true nosetests -x -s -v putget_test.py -* To reuse cassandra clusters when possible, set the environment variable REUSE_CLUSTER - - REUSE_CLUSTER=true nosetests -s -v cql_tests.py - * Some tests will not run with vnodes enabled (you'll see a "SKIP: Test disabled for vnodes" message in that case). Use the provided runner script instead: ./run_dtests.py --vnodes false --nose-options "-x -s -v" topology_test.py:TestTopology.movement_test http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/1cc49419/README.md ---------------------------------------------------------------------- diff --git a/README.md b/README.md index 79a65e0..ba32c3c 100644 --- a/README.md +++ b/README.md @@ -43,8 +43,7 @@ environment variable (that still will have precedence if given though). Existing tests are probably the best place to start to look at how to write tests. -Each test spawns a new fresh cluster and tears it down after the test, unless -`REUSE_CLUSTER` is set to true. Then some tests will share cassandra instances. If a +Each test spawns a new fresh cluster and tears it down after the test. If a test fails, the logs for the node are saved in a `logs/<timestamp>` directory for analysis (it's not perfect but has been good enough so far, I'm open to better suggestions). http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/1cc49419/cqlsh_tests/cqlsh_copy_tests.py ---------------------------------------------------------------------- diff --git a/cqlsh_tests/cqlsh_copy_tests.py b/cqlsh_tests/cqlsh_copy_tests.py index 43d33db..8501497 100644 --- a/cqlsh_tests/cqlsh_copy_tests.py +++ b/cqlsh_tests/cqlsh_copy_tests.py @@ -25,8 +25,7 @@ from ccmlib.common import is_win from cqlsh_tools import (DummyColorMap, assert_csvs_items_equal, csv_rows, monkeypatch_driver, random_list, unmonkeypatch_driver, write_rows_to_csv) -from dtest import (DISABLE_VNODES, Tester, canReuseCluster, debug, - freshCluster, warning, create_ks) +from dtest import (DISABLE_VNODES, Tester, debug, warning, create_ks) from tools.data import rows_to_list from tools.decorators import since from tools.metadata_wrapper import (UpdatingClusterMetadataWrapper, @@ -55,7 +54,6 @@ class UTC(datetime.tzinfo): return datetime.timedelta(0) -@canReuseCluster class CqlshCopyTest(Tester): """ Tests the COPY TO and COPY FROM features in cqlsh. @@ -2359,23 +2357,18 @@ class CqlshCopyTest(Tester): new_results = list(self.session.execute("SELECT * FROM testcopyto")) self.assertEqual(results, new_results) - @freshCluster() def test_round_trip_murmur3(self): self._test_round_trip(nodes=3, partitioner="murmur3") - @freshCluster() def test_round_trip_random(self): self._test_round_trip(nodes=3, partitioner="random") - @freshCluster() def test_round_trip_order_preserving(self): self._test_round_trip(nodes=3, partitioner="order") - @freshCluster() def test_round_trip_byte_ordered(self): self._test_round_trip(nodes=3, partitioner="byte") - @freshCluster() def test_source_copy_round_trip(self): """ Like test_round_trip, but uses the SOURCE command to execute the @@ -2523,7 +2516,6 @@ class CqlshCopyTest(Tester): return ret - @freshCluster() def test_bulk_round_trip_default(self): """ Test bulk import with default stress import (one row per operation) @@ -2542,7 +2534,6 @@ class CqlshCopyTest(Tester): self._test_bulk_round_trip(nodes=3, partitioner="murmur3", num_operations=100000, copy_from_options={'PREPAREDSTATEMENTS': False}) - @freshCluster() def test_bulk_round_trip_blogposts(self): """ Test bulk import with a user profile that inserts 10 rows per operation and has a replication factor 3 @@ -2554,7 +2545,6 @@ class CqlshCopyTest(Tester): profile=os.path.join(os.path.dirname(os.path.realpath(__file__)), 'blogposts.yaml'), stress_table='stresscql.blogposts') - @freshCluster() def test_bulk_round_trip_blogposts_with_max_connections(self): """ Same as test_bulk_round_trip_blogposts but limit the maximum number of concurrent connections a host will @@ -2572,7 +2562,6 @@ class CqlshCopyTest(Tester): copy_to_options={'NUMPROCESSES': 5, 'MAXATTEMPTS': 20}, copy_from_options={'NUMPROCESSES': 2}) - @freshCluster() def test_bulk_round_trip_with_timeouts(self): """ Test bulk import with very short read and write timeout values, this should exercise the @@ -2587,7 +2576,6 @@ class CqlshCopyTest(Tester): copy_from_options={'MAXINSERTERRORS': -1}, skip_count_checks=True) - @freshCluster() def test_bulk_round_trip_with_low_ingestrate(self): """ Test bulk import with default stress import (one row per operation) and a low @@ -2598,7 +2586,6 @@ class CqlshCopyTest(Tester): self._test_bulk_round_trip(nodes=3, partitioner="murmur3", num_operations=10000, copy_from_options={'INGESTRATE': 1500}) - @freshCluster() def test_bulk_round_trip_with_single_core(self): """ Perform a round trip on a simulated single core machine. When determining the number of cores, @@ -2614,7 +2601,6 @@ class CqlshCopyTest(Tester): for out in ret: self.assertIn("Detected 1 core", out[0]) - @freshCluster() @since('3.0.5') def test_bulk_round_trip_with_backoff(self): """ @@ -2655,7 +2641,6 @@ class CqlshCopyTest(Tester): debug("Using failure range: {}, {}".format(start, end)) return start, end - @freshCluster() def test_copy_to_with_more_failures_than_max_attempts(self): """ Test exporting rows with failure injection by setting the environment variable CQLSH_COPY_TEST_FAILURES, @@ -2686,7 +2671,6 @@ class CqlshCopyTest(Tester): self.assertIn('some records might be missing', err) self.assertTrue(len(open(tempfile.name).readlines()) < num_records) - @freshCluster() def test_copy_to_with_fewer_failures_than_max_attempts(self): """ Test exporting rows with failure injection by setting the environment variable CQLSH_COPY_TEST_FAILURES, @@ -2716,7 +2700,6 @@ class CqlshCopyTest(Tester): self.assertNotIn('some records might be missing', err) self.assertEqual(num_records, len(open(tempfile.name).readlines())) - @freshCluster() def test_copy_to_with_child_process_crashing(self): """ Test exporting rows with failure injection by setting the environment variable CQLSH_COPY_TEST_FAILURES, @@ -2746,7 +2729,6 @@ class CqlshCopyTest(Tester): self.assertIn('some records might be missing', err) self.assertTrue(len(open(tempfile.name).readlines()) < num_records) - @freshCluster() def test_copy_from_with_more_failures_than_max_attempts(self): """ Test importing rows with failure injection by setting the environment variable CQLSH_COPY_TEST_FAILURES, @@ -2783,7 +2765,6 @@ class CqlshCopyTest(Tester): num_records_imported = rows_to_list(self.session.execute("SELECT COUNT(*) FROM {}".format(stress_table)))[0][0] self.assertTrue(num_records_imported < num_records) - @freshCluster() def test_copy_from_with_fewer_failures_than_max_attempts(self): """ Test importing rows with failure injection by setting the environment variable CQLSH_COPY_TEST_FAILURES, @@ -2823,7 +2804,6 @@ class CqlshCopyTest(Tester): num_records_imported = rows_to_list(self.session.execute("SELECT COUNT(*) FROM {}".format(stress_table)))[0][0] self.assertEquals(num_records, num_records_imported) - @freshCluster() def test_copy_from_with_child_process_crashing(self): """ Test importing rows with failure injection by setting the environment variable CQLSH_COPY_TEST_FAILURES, @@ -2898,7 +2878,6 @@ class CqlshCopyTest(Tester): self.assertLess(num_records_imported, num_records) @since('2.2.5') - @freshCluster() def test_copy_from_with_large_cql_rows(self): """ Test importing CQL rows that are larger than batch_size_warn_threshold_in_kb and @@ -2994,7 +2973,6 @@ class CqlshCopyTest(Tester): _test(True) _test(False) - @freshCluster() @since('2.2') def test_round_trip_with_authentication(self): """ http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/1cc49419/dtest.py ---------------------------------------------------------------------- diff --git a/dtest.py b/dtest.py index 1033c69..0fd5ec5 100644 --- a/dtest.py +++ b/dtest.py @@ -71,7 +71,6 @@ PRINT_DEBUG = os.environ.get('PRINT_DEBUG', '').lower() in ('yes', 'true') OFFHEAP_MEMTABLES = os.environ.get('OFFHEAP_MEMTABLES', '').lower() in ('yes', 'true') NUM_TOKENS = os.environ.get('NUM_TOKENS', '256') RECORD_COVERAGE = os.environ.get('RECORD_COVERAGE', '').lower() in ('yes', 'true') -REUSE_CLUSTER = os.environ.get('REUSE_CLUSTER', '').lower() in ('yes', 'true') IGNORE_REQUIRE = os.environ.get('IGNORE_REQUIRE', '').lower() in ('yes', 'true') DATADIR_COUNT = os.environ.get('DATADIR_COUNT', '3') ENABLE_ACTIVE_LOG_WATCHING = os.environ.get('ENABLE_ACTIVE_LOG_WATCHING', '').lower() in ('yes', 'true') @@ -1069,30 +1068,6 @@ class ReusableClusterTester(Tester): init_default_config(cls.cluster, cls.cluster_options) -def canReuseCluster(Tester): - orig_init = Tester.__init__ - # make copy of original __init__, so we can call it without recursion - - def __init__(self, *args, **kwargs): - self._preserve_cluster = REUSE_CLUSTER - orig_init(self, *args, **kwargs) # call the original __init__ - - Tester.__init__ = __init__ # set the class' __init__ to the new one - return Tester - - -class freshCluster(): - - def __call__(self, f): - def wrapped(obj): - obj._preserve_cluster = False - obj.setUp() - f(obj) - wrapped.__name__ = f.__name__ - wrapped.__doc__ = f.__doc__ - return wrapped - - class MultiError(Exception): """ Extends Exception to provide reporting multiple exceptions at once. http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/1cc49419/upgrade_tests/cql_tests.py ---------------------------------------------------------------------- diff --git a/upgrade_tests/cql_tests.py b/upgrade_tests/cql_tests.py index d9245d2..267d2a4 100644 --- a/upgrade_tests/cql_tests.py +++ b/upgrade_tests/cql_tests.py @@ -18,7 +18,7 @@ from cassandra.util import sortedset from nose.exc import SkipTest from nose.tools import assert_not_in -from dtest import RUN_STATIC_UPGRADE_MATRIX, debug, freshCluster +from dtest import RUN_STATIC_UPGRADE_MATRIX, debug from thrift_bindings.v22.ttypes import \ ConsistencyLevel as ThriftConsistencyLevel from thrift_bindings.v22.ttypes import (CfDef, Column, ColumnDef, @@ -297,7 +297,6 @@ class TestCQL(UpgradeTester): [24, 'Something something', 'Frodo Baggins'], [30, 'Yet one more message', None]]) - @freshCluster() def limit_ranges_test(self): """ Validate LIMIT option for 'range queries' in SELECT statements """ cursor = self.prepare(ordered=True) @@ -1125,7 +1124,6 @@ class TestCQL(UpgradeTester): assert_all(cursor, "SELECT * FROM users WHERE KEY='user1'", []) - @freshCluster() def undefined_column_handling_test(self): cursor = self.prepare(ordered=True) @@ -1149,7 +1147,6 @@ class TestCQL(UpgradeTester): assert_all(cursor, "SELECT v2 FROM test WHERE k = 1", [[None]]) - @freshCluster() def range_tombstones_test(self): """ Test deletion by 'composite prefix' (range tombstones) """ @@ -1654,7 +1651,6 @@ class TestCQL(UpgradeTester): cursor.execute("INSERT INTO test (k, c) VALUES (2, 2)") assert_one(cursor, "SELECT * FROM test", [2, 2, None, None]) - @freshCluster() def only_pk_test(self): """ Check table with only a PK (part of #4361) @@ -1731,7 +1727,6 @@ class TestCQL(UpgradeTester): cursor.execute("INSERT INTO test (k, t) VALUES (0, '2011-02-03')") assert_invalid(cursor, "INSERT INTO test (k, t) VALUES (0, '2011-42-42')") - @freshCluster() def range_slice_test(self): """ Test a regression from #1337 @@ -1756,7 +1751,6 @@ class TestCQL(UpgradeTester): assert_row_count(cursor, 'test', 2) - @freshCluster() def composite_index_with_pk_test(self): cursor = self.prepare(ordered=True) @@ -1820,7 +1814,6 @@ class TestCQL(UpgradeTester): assert_invalid(cursor, "SELECT content FROM blogs WHERE time1 = 1 AND time2 = 1 AND author='foo'") assert_invalid(cursor, "SELECT content FROM blogs WHERE time1 = 1 AND time2 > 0 AND author='foo'") - @freshCluster() def limit_bugs_test(self): """ Test for LIMIT bugs from #4579 @@ -1911,7 +1904,6 @@ class TestCQL(UpgradeTester): assert_invalid(cursor, "SELECT * FROM compositetest WHERE ctime>=12345679 AND key='key3' AND ctime<=12345680 LIMIT 3;") assert_invalid(cursor, "SELECT * FROM compositetest WHERE ctime=12345679 AND key='key3' AND ctime<=12345680 LIMIT 3;") - @freshCluster() def order_by_multikey_test(self): """ Test for #4612 bug and more generally order by when multiple C* rows are queried @@ -2343,7 +2335,6 @@ class TestCQL(UpgradeTester): assert_one(cursor, "SELECT l1, l2 FROM test WHERE k = 0", [[1, 24, 3], [4, 42, 6]]) - @freshCluster() def composite_index_collections_test(self): cursor = self.prepare(ordered=True) cursor.execute(""" @@ -2372,7 +2363,6 @@ class TestCQL(UpgradeTester): query = "SELECT blog_id, content FROM blogs WHERE author='foo'" assert_all(cursor, query, [[1, set(['bar1', 'bar2'])], [1, set(['bar2', 'bar3'])], [2, set(['baz'])]]) - @freshCluster() def truncate_clean_cache_test(self): cursor = self.prepare(ordered=True, use_cache=True) @@ -3195,7 +3185,6 @@ class TestCQL(UpgradeTester): assert_invalid(cursor, "DELETE FROM test2 WHERE k = 0 AND i > 0 IF EXISTS") assert_invalid(cursor, "DELETE FROM test2 WHERE k = 0 AND i > 0 IF v = 'foo'") - @freshCluster() def range_key_ordered_test(self): cursor = self.prepare(ordered=True) @@ -3430,7 +3419,6 @@ class TestCQL(UpgradeTester): cursor.execute("INSERT INTO test(k) VALUES (0)") assert_one(cursor, "SELECT dateOf(t) FROM test WHERE k=0", [None]) - @freshCluster() def cas_simple_test(self): # cursor = self.prepare(nodes=3, rf=3) cursor = self.prepare() --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
