{"action":"created","comment":{"url":"https://api.github.com/repos/riptano/cassandra-dtest/pulls/comments/31155217","id":31155217,"diff_hunk":"@@ -0,0 +1,203 @@\n+from dtest import Tester, debug, DISABLE_VNODES\n+from ccmlib.node import Node, NodeError, TimeoutError\n+from cassandra import ConsistencyLevel, Unavailable, ReadTimeout\n+from cassandra.query import SimpleStatement\n+from tools import since\n+import re\n+import subprocess\n+import os\n+\n+class TestOfflineTools(Tester):\n+\n+    def sstablelevelreset_test(self):\n+        \"\"\"\n+        Insert data and call sstablelevelreset on a series of \n+        tables. Confirm level is reset to 0 using sstable2json to read tables.\n+        Test a variety of possible errors and ensure response is resonable.\n+        @since 2.1.5\n+        @jira CASSANDRA-7614\n+        \"\"\"\n+        cluster = self.cluster\n+        cluster.populate(3).start()\n+        [node1,node2, node3] = cluster.nodelist()\n+\n+        #test by trying to run on nonexistent keyspace\n+        cluster.stop(gently=False)\n+        (output, error, rc) = node1.run_sstablelevelreset(\"keyspace1\", \"standard1\", output=True)\n+        self.assertTrue(\"ColumnFamily not found: keyspace1/standard1\" in error, msg=\"Did not throw CF not found error\")\n+        # this should return exit code 0!\n+        self.assertEqual(rc, 1, msg=\"Return code was not 1 with nonexistent keyspace.\")\n+\n+        #now test by generating keyspace but not flushing sstables\n+        cluster.start()\n+        node1.stress(['write', 'n=100', '-schema', 'replication(factor=3)'])\n+        cluster.stop()\n+\n+        (output, error, rc) = node1.run_sstablelevelreset(\"keyspace1\", \"standard1\", output=True)\n+\n+        self.assertTrue(\"Found no sstables, did you give the correct keyspace/columnfamily?\" in output, msg=\"Improper error msg with no sstables\")\n+        self.assertEqual(rc, 0, msg=\"improper return code was not 1 with no sstables\")\n+\n+        #test by writing small amount of data and flushing (all sstables should be level 0)\n+        cluster.start() \n+        cursor = self.patient_cql_connection(node1)\n+        cursor.execute(\"ALTER TABLE keyspace1.standard1 with compaction={'class': 'LeveledCompactionStrategy'};\")\n+        node1.stress(['write', 'n=1000000', '-schema', 'replication(factor=3)'])","path":"offline_tools_test.py","position":45,"original_position":45,"commit_id":"3ed5b15bae18e66a78b7b5c8c9823d9985924e44","original_commit_id":"3ed5b15bae18e66a78b7b5c8c9823d9985924e44","user":{"login":"ptnapoleon","id":3408144,"avatar_url":"https://avatars.githubusercontent.com/u/3408144?v=3","gravatar_id":"","url":"https://api.github.com/users/ptnapoleon","html_url":"https://github.com/ptnapoleon","followers_url":"https://api.github.com/users/ptnapoleon/followers","following_url":"https://api.github.com/users/ptnapoleon/following{/other_user}","gists_url":"https://api.github.com/users/ptnapoleon/gists{/gist_id}","starred_url":"https://api.github.com/users/ptnapoleon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ptnapoleon/subscriptions","organizations_url":"https://api.github.com/users/ptnapoleon/orgs","repos_url":"https://api.github.com/users/ptnapoleon/repos","events_url":"https://api.github.com/users/ptnapoleon/events{/privacy}","received_events_url":"https://api.github.com/users/ptnapoleon/received_events","type":"User","site_admin":false},"body":"`n=1M`","created_at":"2015-05-27T16:54:59Z","updated_at":"2015-05-27T16:54:59Z","html_url":"https://github.com/riptano/cassandra-dtest/pull/295#discussion_r31155217","pull_request_url":"https://api.github.com/repos/riptano/cassandra-dtest/pulls/295","_links":{"self":{"href":"https://api.github.com/repos/riptano/cassandra-dtest/pulls/comments/31155217"},"html":{"href":"https://github.com/riptano/cassandra-dtest/pull/295#discussion_r31155217"},"pull_request":{"href":"https://api.github.com/repos/riptano/cassandra-dtest/pulls/295"}}},"pull_request":{"url":"https://api.github.com/repos/riptano/cassandra-dtest/pulls/295","id":36072658,"html_url":"https://github.com/riptano/cassandra-dtest/pull/295","diff_url":"https://github.com/riptano/cassandra-dtest/pull/295.diff","patch_url":"https://github.com/riptano/cassandra-dtest/pull/295.patch","issue_url":"https://api.github.com/repos/riptano/cassandra-dtest/issues/295","number":295,"state":"open","locked":false,"title":"Offlinetools + JMX","user":{"login":"shawnkumar","id":1065888,"avatar_url":"https://avatars.githubusercontent.com/u/1065888?v=3","gravatar_id":"","url":"https://api.github.com/users/shawnkumar","html_url":"https://github.com/shawnkumar","followers_url":"https://api.github.com/users/shawnkumar/followers","following_url":"https://api.github.com/users/shawnkumar/following{/other_user}","gists_url":"https://api.github.com/users/shawnkumar/gists{/gist_id}","starred_url":"https://api.github.com/users/shawnkumar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shawnkumar/subscriptions","organizations_url":"https://api.github.com/users/shawnkumar/orgs","repos_url":"https://api.github.com/users/shawnkumar/repos","events_url":"https://api.github.com/users/shawnkumar/events{/privacy}","received_events_url":"https://api.github.com/users/shawnkumar/received_events","type":"User","site_admin":false},"body":"Please don't merge yet.\r\n\r\nTODO\r\n-  add tests for sstableverify\r\n- clean up doxygen stuff","created_at":"2015-05-22T22:04:57Z","updated_at":"2015-05-27T16:54:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/riptano/cassandra-dtest/pulls/295/commits","review_comments_url":"https://api.github.com/repos/riptano/cassandra-dtest/pulls/295/comments","review_comment_url":"https://api.github.com/repos/riptano/cassandra-dtest/pulls/comments{/number}","comments_url":"https://api.github.com/repos/riptano/cassandra-dtest/issues/295/comments","statuses_url":"https://api.github.com/repos/riptano/cassandra-dtest/statuses/3ed5b15bae18e66a78b7b5c8c9823d9985924e44","head":{"label":"riptano:offlinetools","ref":"offlinetools","sha":"3ed5b15bae18e66a78b7b5c8c9823d9985924e44","user":{"login":"riptano","id":275430,"avatar_url":"https://avatars.githubusercontent.com/u/275430?v=3","gravatar_id":"","url":"https://api.github.com/users/riptano","html_url":"https://github.com/riptano","followers_url":"https://api.github.com/users/riptano/followers","following_url":"https://api.github.com/users/riptano/following{/other_user}","gists_url":"https://api.github.com/users/riptano/gists{/gist_id}","starred_url":"https://api.github.com/users/riptano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/riptano/subscriptions","organizations_url":"https://api.github.com/users/riptano/orgs","repos_url":"https://api.github.com/users/riptano/repos","events_url":"https://api.github.com/users/riptano/events{/privacy}","received_events_url":"https://api.github.com/users/riptano/received_events","type":"Organization","site_admin":false},"repo":{"id":2674774,"name":"cassandra-dtest","full_name":"riptano/cassandra-dtest","owner":{"login":"riptano","id":275430,"avatar_url":"https://avatars.githubusercontent.com/u/275430?v=3","gravatar_id":"","url":"https://api.github.com/users/riptano","html_url":"https://github.com/riptano","followers_url":"https://api.github.com/users/riptano/followers","following_url":"https://api.github.com/users/riptano/following{/other_user}","gists_url":"https://api.github.com/users/riptano/gists{/gist_id}","starred_url":"https://api.github.com/users/riptano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/riptano/subscriptions","organizations_url":"https://api.github.com/users/riptano/orgs","repos_url":"https://api.github.com/users/riptano/repos","events_url":"https://api.github.com/users/riptano/events{/privacy}","received_events_url":"https://api.github.com/users/riptano/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/riptano/cassandra-dtest","description":"Cassandra Distributed Tests","fork":false,"url":"https://api.github.com/repos/riptano/cassandra-dtest","forks_url":"https://api.github.com/repos/riptano/cassandra-dtest/forks","keys_url":"https://api.github.com/repos/riptano/cassandra-dtest/keys{/key_id}","collaborators_url":"https://api.github.com/repos/riptano/cassandra-dtest/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/riptano/cassandra-dtest/teams","hooks_url":"https://api.github.com/repos/riptano/cassandra-dtest/hooks","issue_events_url":"https://api.github.com/repos/riptano/cassandra-dtest/issues/events{/number}","events_url":"https://api.github.com/repos/riptano/cassandra-dtest/events","assignees_url":"https://api.github.com/repos/riptano/cassandra-dtest/assignees{/user}","branches_url":"https://api.github.com/repos/riptano/cassandra-dtest/branches{/branch}","tags_url":"https://api.github.com/repos/riptano/cassandra-dtest/tags","blobs_url":"https://api.github.com/repos/riptano/cassandra-dtest/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/riptano/cassandra-dtest/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/riptano/cassandra-dtest/git/refs{/sha}","trees_url":"https://api.github.com/repos/riptano/cassandra-dtest/git/trees{/sha}","statuses_url":"https://api.github.com/repos/riptano/cassandra-dtest/statuses/{sha}","languages_url":"https://api.github.com/repos/riptano/cassandra-dtest/languages","stargazers_url":"https://api.github.com/repos/riptano/cassandra-dtest/stargazers","contributors_url":"https://api.github.com/repos/riptano/cassandra-dtest/contributors","subscribers_url":"https://api.github.com/repos/riptano/cassandra-dtest/subscribers","subscription_url":"https://api.github.com/repos/riptano/cassandra-dtest/subscription","commits_url":"https://api.github.com/repos/riptano/cassandra-dtest/commits{/sha}","git_commits_url":"https://api.github.com/repos/riptano/cassandra-dtest/git/commits{/sha}","comments_url":"https://api.github.com/repos/riptano/cassandra-dtest/comments{/number}","issue_comment_url":"https://api.github.com/repos/riptano/cassandra-dtest/issues/comments{/number}","contents_url":"https://api.github.com/repos/riptano/cassandra-dtest/contents/{+path}","compare_url":"https://api.github.com/repos/riptano/cassandra-dtest/compare/{base}...{head}","merges_url":"https://api.github.com/repos/riptano/cassandra-dtest/merges","archive_url":"https://api.github.com/repos/riptano/cassandra-dtest/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/riptano/cassandra-dtest/downloads","issues_url":"https://api.github.com/repos/riptano/cassandra-dtest/issues{/number}","pulls_url":"https://api.github.com/repos/riptano/cassandra-dtest/pulls{/number}","milestones_url":"https://api.github.com/repos/riptano/cassandra-dtest/milestones{/number}","notifications_url":"https://api.github.com/repos/riptano/cassandra-dtest/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/riptano/cassandra-dtest/labels{/name}","releases_url":"https://api.github.com/repos/riptano/cassandra-dtest/releases{/id}","created_at":"2011-10-30T11:15:44Z","updated_at":"2015-05-08T19:09:35Z","pushed_at":"2015-05-27T16:53:24Z","git_url":"git://github.com/riptano/cassandra-dtest.git","ssh_url":"git@github.com:riptano/cassandra-dtest.git","clone_url":"https://github.com/riptano/cassandra-dtest.git","svn_url":"https://github.com/riptano/cassandra-dtest","homepage":"","size":17238,"stargazers_count":57,"watchers_count":57,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":35,"mirror_url":null,"open_issues_count":32,"forks":35,"open_issues":32,"watchers":57,"default_branch":"master"}},"base":{"label":"riptano:master","ref":"master","sha":"fdf6de41ad82a84f2111e699254dd9e3046d13d8","user":{"login":"riptano","id":275430,"avatar_url":"https://avatars.githubusercontent.com/u/275430?v=3","gravatar_id":"","url":"https://api.github.com/users/riptano","html_url":"https://github.com/riptano","followers_url":"https://api.github.com/users/riptano/followers","following_url":"https://api.github.com/users/riptano/following{/other_user}","gists_url":"https://api.github.com/users/riptano/gists{/gist_id}","starred_url":"https://api.github.com/users/riptano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/riptano/subscriptions","organizations_url":"https://api.github.com/users/riptano/orgs","repos_url":"https://api.github.com/users/riptano/repos","events_url":"https://api.github.com/users/riptano/events{/privacy}","received_events_url":"https://api.github.com/users/riptano/received_events","type":"Organization","site_admin":false},"repo":{"id":2674774,"name":"cassandra-dtest","full_name":"riptano/cassandra-dtest","owner":{"login":"riptano","id":275430,"avatar_url":"https://avatars.githubusercontent.com/u/275430?v=3","gravatar_id":"","url":"https://api.github.com/users/riptano","html_url":"https://github.com/riptano","followers_url":"https://api.github.com/users/riptano/followers","following_url":"https://api.github.com/users/riptano/following{/other_user}","gists_url":"https://api.github.com/users/riptano/gists{/gist_id}","starred_url":"https://api.github.com/users/riptano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/riptano/subscriptions","organizations_url":"https://api.github.com/users/riptano/orgs","repos_url":"https://api.github.com/users/riptano/repos","events_url":"https://api.github.com/users/riptano/events{/privacy}","received_events_url":"https://api.github.com/users/riptano/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/riptano/cassandra-dtest","description":"Cassandra Distributed Tests","fork":false,"url":"https://api.github.com/repos/riptano/cassandra-dtest","forks_url":"https://api.github.com/repos/riptano/cassandra-dtest/forks","keys_url":"https://api.github.com/repos/riptano/cassandra-dtest/keys{/key_id}","collaborators_url":"https://api.github.com/repos/riptano/cassandra-dtest/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/riptano/cassandra-dtest/teams","hooks_url":"https://api.github.com/repos/riptano/cassandra-dtest/hooks","issue_events_url":"https://api.github.com/repos/riptano/cassandra-dtest/issues/events{/number}","events_url":"https://api.github.com/repos/riptano/cassandra-dtest/events","assignees_url":"https://api.github.com/repos/riptano/cassandra-dtest/assignees{/user}","branches_url":"https://api.github.com/repos/riptano/cassandra-dtest/branches{/branch}","tags_url":"https://api.github.com/repos/riptano/cassandra-dtest/tags","blobs_url":"https://api.github.com/repos/riptano/cassandra-dtest/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/riptano/cassandra-dtest/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/riptano/cassandra-dtest/git/refs{/sha}","trees_url":"https://api.github.com/repos/riptano/cassandra-dtest/git/trees{/sha}","statuses_url":"https://api.github.com/repos/riptano/cassandra-dtest/statuses/{sha}","languages_url":"https://api.github.com/repos/riptano/cassandra-dtest/languages","stargazers_url":"https://api.github.com/repos/riptano/cassandra-dtest/stargazers","contributors_url":"https://api.github.com/repos/riptano/cassandra-dtest/contributors","subscribers_url":"https://api.github.com/repos/riptano/cassandra-dtest/subscribers","subscription_url":"https://api.github.com/repos/riptano/cassandra-dtest/subscription","commits_url":"https://api.github.com/repos/riptano/cassandra-dtest/commits{/sha}","git_commits_url":"https://api.github.com/repos/riptano/cassandra-dtest/git/commits{/sha}","comments_url":"https://api.github.com/repos/riptano/cassandra-dtest/comments{/number}","issue_comment_url":"https://api.github.com/repos/riptano/cassandra-dtest/issues/comments{/number}","contents_url":"https://api.github.com/repos/riptano/cassandra-dtest/contents/{+path}","compare_url":"https://api.github.com/repos/riptano/cassandra-dtest/compare/{base}...{head}","merges_url":"https://api.github.com/repos/riptano/cassandra-dtest/merges","archive_url":"https://api.github.com/repos/riptano/cassandra-dtest/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/riptano/cassandra-dtest/downloads","issues_url":"https://api.github.com/repos/riptano/cassandra-dtest/issues{/number}","pulls_url":"https://api.github.com/repos/riptano/cassandra-dtest/pulls{/number}","milestones_url":"https://api.github.com/repos/riptano/cassandra-dtest/milestones{/number}","notifications_url":"https://api.github.com/repos/riptano/cassandra-dtest/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/riptano/cassandra-dtest/labels{/name}","releases_url":"https://api.github.com/repos/riptano/cassandra-dtest/releases{/id}","created_at":"2011-10-30T11:15:44Z","updated_at":"2015-05-08T19:09:35Z","pushed_at":"2015-05-27T16:53:24Z","git_url":"git://github.com/riptano/cassandra-dtest.git","ssh_url":"git@github.com:riptano/cassandra-dtest.git","clone_url":"https://github.com/riptano/cassandra-dtest.git","svn_url":"https://github.com/riptano/cassandra-dtest","homepage":"","size":17238,"stargazers_count":57,"watchers_count":57,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":35,"mirror_url":null,"open_issues_count":32,"forks":35,"open_issues":32,"watchers":57,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/riptano/cassandra-dtest/pulls/295"},"html":{"href":"https://github.com/riptano/cassandra-dtest/pull/295"},"issue":{"href":"https://api.github.com/repos/riptano/cassandra-dtest/issues/295"},"comments":{"href":"https://api.github.com/repos/riptano/cassandra-dtest/issues/295/comments"},"review_comments":{"href":"https://api.github.com/repos/riptano/cassandra-dtest/pulls/295/comments"},"review_comment":{"href":"https://api.github.com/repos/riptano/cassandra-dtest/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/riptano/cassandra-dtest/pulls/295/commits"},"statuses":{"href":"https://api.github.com/repos/riptano/cassandra-dtest/statuses/3ed5b15bae18e66a78b7b5c8c9823d9985924e44"}}}}