Add tests for 'nodetool getbatchlogreplaythrottle' and 'nodetool setbatchlogreplaythrottle' (#1491)
* Add test for 'nodetool setbatchlogreplaythrottlekb' * Check log messages about updates in batchlog replay throttle * Add test for 'nodetool getbatchlogreplaythrottlekb' * Adapt tests for the renaming of the nodetool accessors for batchlog replay throttle * Remove unused imports * Removed extra blank line at the end of the file Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/8cd52d67 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/8cd52d67 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/8cd52d67 Branch: refs/heads/master Commit: 8cd52d67587ddb5efc80366ff6c6a044c30b41d3 Parents: 557ab7b Author: Andrés de la Peña <adelap...@users.noreply.github.com> Authored: Thu Jul 6 12:26:10 2017 +0100 Committer: GitHub <nore...@github.com> Committed: Thu Jul 6 12:26:10 2017 +0100 ---------------------------------------------------------------------- jmx_test.py | 21 +++++++++++++++++++++ nodetool_test.py | 22 ++++++++++++++++++++++ 2 files changed, 43 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/8cd52d67/jmx_test.py ---------------------------------------------------------------------- diff --git a/jmx_test.py b/jmx_test.py index 7251b12..7df84ac 100644 --- a/jmx_test.py +++ b/jmx_test.py @@ -181,6 +181,27 @@ class TestJMX(Tester): self.assertGreater(endpoint2Phi, 0.0) self.assertLess(endpoint2Phi, max_phi) + @since('4.0') + def test_set_get_batchlog_replay_throttle(self): + """ + @jira_ticket CASSANDRA-13614 + + Test that batchlog replay throttle can be set and get through JMX + """ + cluster = self.cluster + cluster.populate(2) + node = cluster.nodelist()[0] + remove_perf_disable_shared_mem(node) + cluster.start() + + # Set and get throttle with JMX, ensuring that the rate change is logged + with JolokiaAgent(node) as jmx: + mbean = make_mbean('db', 'StorageService') + jmx.write_attribute(mbean, 'BatchlogReplayThrottleInKB', 4096) + self.assertTrue(len(node.grep_log('Updating batchlog replay throttle to 4096 KB/s, 2048 KB/s per endpoint', + filename='debug.log')) > 0) + self.assertEqual(4096, jmx.read_attribute(mbean, 'BatchlogReplayThrottleInKB')) + @since('3.9') class TestJMXSSL(Tester): http://git-wip-us.apache.org/repos/asf/cassandra/blob/8cd52d67/nodetool_test.py ---------------------------------------------------------------------- diff --git a/nodetool_test.py b/nodetool_test.py index ff4622b..d7ce89a 100644 --- a/nodetool_test.py +++ b/nodetool_test.py @@ -136,3 +136,25 @@ class TestNodetool(Tester): out, err, _ = node.nodetool('status') self.assertEqual(0, len(err), err) self.assertRegexpMatches(out, notice_message) + + @since('4.0') + def test_set_get_batchlog_replay_throttle(self): + """ + @jira_ticket CASSANDRA-13614 + + Test that batchlog replay throttle can be set and get through nodetool + """ + cluster = self.cluster + cluster.populate(2) + node = cluster.nodelist()[0] + cluster.start() + + # Test that nodetool help messages are displayed + self.assertTrue('Set batchlog replay throttle' in node.nodetool('help setbatchlogreplaythrottle').stdout) + self.assertTrue('Print batchlog replay throttle' in node.nodetool('help getbatchlogreplaythrottle').stdout) + + # Set and get throttle with nodetool, ensuring that the rate change is logged + node.nodetool('setbatchlogreplaythrottle 2048') + self.assertTrue(len(node.grep_log('Updating batchlog replay throttle to 2048 KB/s, 1024 KB/s per endpoint', + filename='debug.log')) > 0) + self.assertTrue('Batchlog replay throttle: 2048 KB/s' in node.nodetool('getbatchlogreplaythrottle').stdout) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org