{"action":"created","comment":{"url":"https://api.github.com/repos/SatelliteQE/robottelo/pulls/comments/34200966","id":34200966,"diff_hunk":"@@ -0,0 +1,116 @@\n+\"\"\"Test utilities for writing Candlepin tests\n+\n+Part of functionalities of Candlepin are defined in this module\n+and have utilities of single register by activation-key, single\n+register and attach, single subscription deletion.\n+\n+\"\"\"\n+\n+\n+from robottelo.common import conf, ssh\n+\n+import logging\n+import time\n+import requests\n+\n+\n+class CandlepinPerfTest:\n+    \"\"\"Measures performance of RH Satellite 6\n+\n+    Candlepin Subscription functionality\n+    \"\"\"\n+    username = conf.properties['foreman.admin.username']\n+    password = conf.properties['foreman.admin.password']\n+    serverhost = conf.properties['main.server.hostname']\n+\n+    # create logger\n+    logger = logging.getLogger('robottelo')\n+    logger.setLevel(logging.DEBUG)\n+    requests.packages.urllib3.disable_warnings()\n+\n+    @classmethod\n+    def single_register_activation_key(cls, ak_name, default_org, vm):\n+        \"\"\"Subscribe VM to Satellite by Register + ActivationKey\"\"\"\n+\n+        # note: must create ssh keys for vm if running on local\n+        result = ssh.command('subscription-manager clean', hostname=vm)\n+        result = ssh.command('time -p subscription-manager register \\\n+                             --activationkey={0} --org={1}'\n+                             .format(ak_name, default_org), hostname=vm)\n+        if result.return_code != 0:\n+            cls.logger.error(result.stderr)\n+        else:\n+            real_time = [real for real in result.stderr.split('\\n')\n+                         if real.startswith('real')]\n+            real_time = real_time[0].split(' ')[1]\n+            return float(real_time)\n+\n+    @classmethod\n+    def single_register_attach(cls, sub_id, default_org, environment, vm):\n+        \"\"\"Subscribe VM to Satellite by Register + Attach\"\"\"\n+\n+        ssh.command(\n+            'subscription-manager clean',\n+            hostname=vm\n+        )\n+        time_reg = cls.sub_mgr_register_authentication(default_org,\n+                                                       environment, vm)\n+        # pool_id = cls.get_subscription_pool_id()\n+        time_att = cls.sub_mgr_attach(sub_id, vm)\n+\n+        if time_reg is None or time_att is None:\n+            total_time = 0\n+        else:\n+            total_time = time_reg + time_att\n+        return time_reg, time_att, total_time\n+\n+    @classmethod\n+    def sub_mgr_register_authentication(cls, default_org, environment, vm):\n+        \"\"\"subscription-manager register -u -p --org --environment\"\"\"\n+        result = ssh.command('time -p subscription-manager \\","path":"tests/foreman/performance/common/perf_candlepin.py","position":70,"original_position":70,"commit_id":"09193485b8a3aeb97e6e60f87123f2defba5731a","original_commit_id":"09193485b8a3aeb97e6e60f87123f2defba5731a","user":{"login":"danuzclaudes","id":8943359,"avatar_url":"https://avatars.githubusercontent.com/u/8943359?v=3","gravatar_id":"","url":"https://api.github.com/users/danuzclaudes","html_url":"https://github.com/danuzclaudes","followers_url":"https://api.github.com/users/danuzclaudes/followers","following_url":"https://api.github.com/users/danuzclaudes/following{/other_user}","gists_url":"https://api.github.com/users/danuzclaudes/gists{/gist_id}","starred_url":"https://api.github.com/users/danuzclaudes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danuzclaudes/subscriptions","organizations_url":"https://api.github.com/users/danuzclaudes/orgs","repos_url":"https://api.github.com/users/danuzclaudes/repos","events_url":"https://api.github.com/users/danuzclaudes/events{/privacy}","received_events_url":"https://api.github.com/users/danuzclaudes/received_events","type":"User","site_admin":false},"body":"great..thanks!","created_at":"2015-07-08T21:28:41Z","updated_at":"2015-07-08T21:28:41Z","html_url":"https://github.com/SatelliteQE/robottelo/pull/2522#discussion_r34200966","pull_request_url":"https://api.github.com/repos/SatelliteQE/robottelo/pulls/2522","_links":{"self":{"href":"https://api.github.com/repos/SatelliteQE/robottelo/pulls/comments/34200966"},"html":{"href":"https://github.com/SatelliteQE/robottelo/pull/2522#discussion_r34200966"},"pull_request":{"href":"https://api.github.com/repos/SatelliteQE/robottelo/pulls/2522"}}},"pull_request":{"url":"https://api.github.com/repos/SatelliteQE/robottelo/pulls/2522","id":39020098,"html_url":"https://github.com/SatelliteQE/robottelo/pull/2522","diff_url":"https://github.com/SatelliteQE/robottelo/pull/2522.diff","patch_url":"https://github.com/SatelliteQE/robottelo/pull/2522.patch","issue_url":"https://api.github.com/repos/SatelliteQE/robottelo/issues/2522","number":2522,"state":"open","locked":false,"title":" [WIP] Initial performance tests","user":{"login":"danuzclaudes","id":8943359,"avatar_url":"https://avatars.githubusercontent.com/u/8943359?v=3","gravatar_id":"","url":"https://api.github.com/users/danuzclaudes","html_url":"https://github.com/danuzclaudes","followers_url":"https://api.github.com/users/danuzclaudes/followers","following_url":"https://api.github.com/users/danuzclaudes/following{/other_user}","gists_url":"https://api.github.com/users/danuzclaudes/gists{/gist_id}","starred_url":"https://api.github.com/users/danuzclaudes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danuzclaudes/subscriptions","organizations_url":"https://api.github.com/users/danuzclaudes/orgs","repos_url":"https://api.github.com/users/danuzclaudes/repos","events_url":"https://api.github.com/users/danuzclaudes/events{/privacy}","received_events_url":"https://api.github.com/users/danuzclaudes/received_events","type":"User","site_admin":false},"body":"1. Critical Change to core component robottelo/cli/base.py, robottelo/common/ssh.py\r\nIn order to measure the latency or time performance, I have to add a time command before hammer. The time output is received through standard error.\r\n\r\n2. Minor change: .gitignore, logger file-handler\r\n1) as for .gitignore, my script would produce some raw data and statistics data files in csv format,  we don't want to push them. Currently I put the csv output into an office program such as google docs; but later we can produce various graphs as our direct output.\r\n2) as for logger file-handler, currently i just name it as “log-perf-candlepin.log” and set the file handler during setUpClass step.\r\n\r\n3. Files\r\n\r\n1) common/perf_candlepin.py:\r\nProvide Candlepin functionality: single register by activation-key, single register and attach, single deletion from subscription;\r\n\r\n2) common/perf_pulp.py:\r\nProvide Pulp functionality: single repository synchronization, sequential repository synchronization, sequential repository re-synchronization\r\n\r\n3) common/perf_stat.py:\r\nProvide function to write a list of time point into csv files.\r\n\r\n4) common/perf_thread.py:\r\nCreate and Inherit Python threads to start concurrent system subscription by activation-key, concurrent subscription by register and attach, concurrent system deletion;\r\n\r\n5) common/perf_concurrent_test.py\r\nCommon parent class for each concurrent unit test case\r\n\r\n6) test_standard_prep.py:\r\nStandard process of preparation after fresh install Red Hat Satellite 6: upload manifest, change CDN address, enable repositories;\r\n\r\n7) test_candlepin_concurrent_delete.py:\r\nUnit test for concurrent deleting of hosts through REST API, using 2, 4, 6, 8, 10 threads separately;\r\n\r\n8) test_candlepin_concurrent_subscription_ak.py\r\nUnit test for concurrent subscription by activation-key tests, using 2, 4, 6, 8, 10 clients separately;\r\n\r\n\r\n9) test_candlepin_concurrent_subscription_attach.py\r\nUnit test for concurrent subscription by subscription-manager register and attach, using 2, 4, 6, 8, 10 clients separately;\r\n\r\n10) test_pulp_concurrent_initial_sync.py (under construction)\r\nUnit test for concurrent repository synchronization, syncing 2, 4, 6, 8, 10 repositories concurrently. \r\n","created_at":"2015-07-01T20:08:54Z","updated_at":"2015-07-08T21:28:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"883420b91e2e052083beed6c905d45c102900e38","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/SatelliteQE/robottelo/pulls/2522/commits","review_comments_url":"https://api.github.com/repos/SatelliteQE/robottelo/pulls/2522/comments","review_comment_url":"https://api.github.com/repos/SatelliteQE/robottelo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SatelliteQE/robottelo/issues/2522/comments","statuses_url":"https://api.github.com/repos/SatelliteQE/robottelo/statuses/09193485b8a3aeb97e6e60f87123f2defba5731a","head":{"label":"danuzclaudes:perf-satellite","ref":"perf-satellite","sha":"09193485b8a3aeb97e6e60f87123f2defba5731a","user":{"login":"danuzclaudes","id":8943359,"avatar_url":"https://avatars.githubusercontent.com/u/8943359?v=3","gravatar_id":"","url":"https://api.github.com/users/danuzclaudes","html_url":"https://github.com/danuzclaudes","followers_url":"https://api.github.com/users/danuzclaudes/followers","following_url":"https://api.github.com/users/danuzclaudes/following{/other_user}","gists_url":"https://api.github.com/users/danuzclaudes/gists{/gist_id}","starred_url":"https://api.github.com/users/danuzclaudes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danuzclaudes/subscriptions","organizations_url":"https://api.github.com/users/danuzclaudes/orgs","repos_url":"https://api.github.com/users/danuzclaudes/repos","events_url":"https://api.github.com/users/danuzclaudes/events{/privacy}","received_events_url":"https://api.github.com/users/danuzclaudes/received_events","type":"User","site_admin":false},"repo":{"id":36315720,"name":"robottelo","full_name":"danuzclaudes/robottelo","owner":{"login":"danuzclaudes","id":8943359,"avatar_url":"https://avatars.githubusercontent.com/u/8943359?v=3","gravatar_id":"","url":"https://api.github.com/users/danuzclaudes","html_url":"https://github.com/danuzclaudes","followers_url":"https://api.github.com/users/danuzclaudes/followers","following_url":"https://api.github.com/users/danuzclaudes/following{/other_user}","gists_url":"https://api.github.com/users/danuzclaudes/gists{/gist_id}","starred_url":"https://api.github.com/users/danuzclaudes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danuzclaudes/subscriptions","organizations_url":"https://api.github.com/users/danuzclaudes/orgs","repos_url":"https://api.github.com/users/danuzclaudes/repos","events_url":"https://api.github.com/users/danuzclaudes/events{/privacy}","received_events_url":"https://api.github.com/users/danuzclaudes/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/danuzclaudes/robottelo","description":"Robottelo is a test suite which exercises The Foreman.","fork":true,"url":"https://api.github.com/repos/danuzclaudes/robottelo","forks_url":"https://api.github.com/repos/danuzclaudes/robottelo/forks","keys_url":"https://api.github.com/repos/danuzclaudes/robottelo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/danuzclaudes/robottelo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/danuzclaudes/robottelo/teams","hooks_url":"https://api.github.com/repos/danuzclaudes/robottelo/hooks","issue_events_url":"https://api.github.com/repos/danuzclaudes/robottelo/issues/events{/number}","events_url":"https://api.github.com/repos/danuzclaudes/robottelo/events","assignees_url":"https://api.github.com/repos/danuzclaudes/robottelo/assignees{/user}","branches_url":"https://api.github.com/repos/danuzclaudes/robottelo/branches{/branch}","tags_url":"https://api.github.com/repos/danuzclaudes/robottelo/tags","blobs_url":"https://api.github.com/repos/danuzclaudes/robottelo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/danuzclaudes/robottelo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/danuzclaudes/robottelo/git/refs{/sha}","trees_url":"https://api.github.com/repos/danuzclaudes/robottelo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/danuzclaudes/robottelo/statuses/{sha}","languages_url":"https://api.github.com/repos/danuzclaudes/robottelo/languages","stargazers_url":"https://api.github.com/repos/danuzclaudes/robottelo/stargazers","contributors_url":"https://api.github.com/repos/danuzclaudes/robottelo/contributors","subscribers_url":"https://api.github.com/repos/danuzclaudes/robottelo/subscribers","subscription_url":"https://api.github.com/repos/danuzclaudes/robottelo/subscription","commits_url":"https://api.github.com/repos/danuzclaudes/robottelo/commits{/sha}","git_commits_url":"https://api.github.com/repos/danuzclaudes/robottelo/git/commits{/sha}","comments_url":"https://api.github.com/repos/danuzclaudes/robottelo/comments{/number}","issue_comment_url":"https://api.github.com/repos/danuzclaudes/robottelo/issues/comments{/number}","contents_url":"https://api.github.com/repos/danuzclaudes/robottelo/contents/{+path}","compare_url":"https://api.github.com/repos/danuzclaudes/robottelo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/danuzclaudes/robottelo/merges","archive_url":"https://api.github.com/repos/danuzclaudes/robottelo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/danuzclaudes/robottelo/downloads","issues_url":"https://api.github.com/repos/danuzclaudes/robottelo/issues{/number}","pulls_url":"https://api.github.com/repos/danuzclaudes/robottelo/pulls{/number}","milestones_url":"https://api.github.com/repos/danuzclaudes/robottelo/milestones{/number}","notifications_url":"https://api.github.com/repos/danuzclaudes/robottelo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/danuzclaudes/robottelo/labels{/name}","releases_url":"https://api.github.com/repos/danuzclaudes/robottelo/releases{/id}","created_at":"2015-05-26T18:31:13Z","updated_at":"2015-05-26T18:31:14Z","pushed_at":"2015-07-06T18:59:40Z","git_url":"git://github.com/danuzclaudes/robottelo.git","ssh_url":"git@github.com:danuzclaudes/robottelo.git","clone_url":"https://github.com/danuzclaudes/robottelo.git","svn_url":"https://github.com/danuzclaudes/robottelo","homepage":"","size":8358,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"SatelliteQE:master","ref":"master","sha":"53d4cab01c7997eaa252d99ee8e5ee69e38287ea","user":{"login":"SatelliteQE","id":8754276,"avatar_url":"https://avatars.githubusercontent.com/u/8754276?v=3","gravatar_id":"","url":"https://api.github.com/users/SatelliteQE","html_url":"https://github.com/SatelliteQE","followers_url":"https://api.github.com/users/SatelliteQE/followers","following_url":"https://api.github.com/users/SatelliteQE/following{/other_user}","gists_url":"https://api.github.com/users/SatelliteQE/gists{/gist_id}","starred_url":"https://api.github.com/users/SatelliteQE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SatelliteQE/subscriptions","organizations_url":"https://api.github.com/users/SatelliteQE/orgs","repos_url":"https://api.github.com/users/SatelliteQE/repos","events_url":"https://api.github.com/users/SatelliteQE/events{/privacy}","received_events_url":"https://api.github.com/users/SatelliteQE/received_events","type":"Organization","site_admin":false},"repo":{"id":4000279,"name":"robottelo","full_name":"SatelliteQE/robottelo","owner":{"login":"SatelliteQE","id":8754276,"avatar_url":"https://avatars.githubusercontent.com/u/8754276?v=3","gravatar_id":"","url":"https://api.github.com/users/SatelliteQE","html_url":"https://github.com/SatelliteQE","followers_url":"https://api.github.com/users/SatelliteQE/followers","following_url":"https://api.github.com/users/SatelliteQE/following{/other_user}","gists_url":"https://api.github.com/users/SatelliteQE/gists{/gist_id}","starred_url":"https://api.github.com/users/SatelliteQE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SatelliteQE/subscriptions","organizations_url":"https://api.github.com/users/SatelliteQE/orgs","repos_url":"https://api.github.com/users/SatelliteQE/repos","events_url":"https://api.github.com/users/SatelliteQE/events{/privacy}","received_events_url":"https://api.github.com/users/SatelliteQE/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SatelliteQE/robottelo","description":"Robottelo is a test suite which exercises The Foreman.","fork":false,"url":"https://api.github.com/repos/SatelliteQE/robottelo","forks_url":"https://api.github.com/repos/SatelliteQE/robottelo/forks","keys_url":"https://api.github.com/repos/SatelliteQE/robottelo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SatelliteQE/robottelo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SatelliteQE/robottelo/teams","hooks_url":"https://api.github.com/repos/SatelliteQE/robottelo/hooks","issue_events_url":"https://api.github.com/repos/SatelliteQE/robottelo/issues/events{/number}","events_url":"https://api.github.com/repos/SatelliteQE/robottelo/events","assignees_url":"https://api.github.com/repos/SatelliteQE/robottelo/assignees{/user}","branches_url":"https://api.github.com/repos/SatelliteQE/robottelo/branches{/branch}","tags_url":"https://api.github.com/repos/SatelliteQE/robottelo/tags","blobs_url":"https://api.github.com/repos/SatelliteQE/robottelo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SatelliteQE/robottelo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SatelliteQE/robottelo/git/refs{/sha}","trees_url":"https://api.github.com/repos/SatelliteQE/robottelo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SatelliteQE/robottelo/statuses/{sha}","languages_url":"https://api.github.com/repos/SatelliteQE/robottelo/languages","stargazers_url":"https://api.github.com/repos/SatelliteQE/robottelo/stargazers","contributors_url":"https://api.github.com/repos/SatelliteQE/robottelo/contributors","subscribers_url":"https://api.github.com/repos/SatelliteQE/robottelo/subscribers","subscription_url":"https://api.github.com/repos/SatelliteQE/robottelo/subscription","commits_url":"https://api.github.com/repos/SatelliteQE/robottelo/commits{/sha}","git_commits_url":"https://api.github.com/repos/SatelliteQE/robottelo/git/commits{/sha}","comments_url":"https://api.github.com/repos/SatelliteQE/robottelo/comments{/number}","issue_comment_url":"https://api.github.com/repos/SatelliteQE/robottelo/issues/comments{/number}","contents_url":"https://api.github.com/repos/SatelliteQE/robottelo/contents/{+path}","compare_url":"https://api.github.com/repos/SatelliteQE/robottelo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SatelliteQE/robottelo/merges","archive_url":"https://api.github.com/repos/SatelliteQE/robottelo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SatelliteQE/robottelo/downloads","issues_url":"https://api.github.com/repos/SatelliteQE/robottelo/issues{/number}","pulls_url":"https://api.github.com/repos/SatelliteQE/robottelo/pulls{/number}","milestones_url":"https://api.github.com/repos/SatelliteQE/robottelo/milestones{/number}","notifications_url":"https://api.github.com/repos/SatelliteQE/robottelo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SatelliteQE/robottelo/labels{/name}","releases_url":"https://api.github.com/repos/SatelliteQE/robottelo/releases{/id}","created_at":"2012-04-12T01:36:39Z","updated_at":"2015-06-23T17:21:41Z","pushed_at":"2015-07-08T13:38:10Z","git_url":"git://github.com/SatelliteQE/robottelo.git","ssh_url":"git@github.com:SatelliteQE/robottelo.git","clone_url":"https://github.com/SatelliteQE/robottelo.git","svn_url":"https://github.com/SatelliteQE/robottelo","homepage":"","size":17552,"stargazers_count":22,"watchers_count":22,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":29,"mirror_url":null,"open_issues_count":226,"forks":29,"open_issues":226,"watchers":22,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/SatelliteQE/robottelo/pulls/2522"},"html":{"href":"https://github.com/SatelliteQE/robottelo/pull/2522"},"issue":{"href":"https://api.github.com/repos/SatelliteQE/robottelo/issues/2522"},"comments":{"href":"https://api.github.com/repos/SatelliteQE/robottelo/issues/2522/comments"},"review_comments":{"href":"https://api.github.com/repos/SatelliteQE/robottelo/pulls/2522/comments"},"review_comment":{"href":"https://api.github.com/repos/SatelliteQE/robottelo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SatelliteQE/robottelo/pulls/2522/commits"},"statuses":{"href":"https://api.github.com/repos/SatelliteQE/robottelo/statuses/09193485b8a3aeb97e6e60f87123f2defba5731a"}}}}