{"action":"created","comment":{"url":"https://api.github.com/repos/dcos/dcos/pulls/comments/77418123","id":77418123,"diff_hunk":"@@ -0,0 +1,139 @@\n+#!/usr/bin/env python3\n+\"\"\"Deploys DCOS AWS CF template and then runs integration_test.py\n+\n+The following environment variables control test procedure:\n+\n+DCOS_TEMPLATE_URL: string\n+    The template to be used for deployment testing\n+\n+CI_FLAGS: string (default=None)\n+    If provided, this string will be passed directly to py.test as in:\n+    py.test -vv CI_FLAGS integration_test.py\n+\n+TEST_ADD_ENV_*: string (default=None)\n+    Any number of environment variables can be passed to integration_test.py if\n+    prefixed with 'TEST_ADD_ENV_'. The prefix will be removed before passing\n+\"\"\"\n+import logging\n+import os\n+import random\n+import stat\n+import string\n+import sys\n+from contextlib import closing\n+\n+import test_util.provide_aws\n+import test_util.test_runner\n+from ssh.ssh_tunnel import SSHTunnel\n+\n+LOGGING_FORMAT = '[%(asctime)s|%(name)s|%(levelname)s]: %(message)s'\n+logging.basicConfig(format=LOGGING_FORMAT, level=logging.DEBUG)\n+log = logging.getLogger(__name__)\n+\n+DEFAULT_AWS_REGION = 'us-west-2'\n+\n+\n+def check_environment():\n+    \"\"\"Test uses environment variables to play nicely with TeamCity config templates\n+    Grab all the environment variables here to avoid setting params all over\n+\n+    Returns:\n+        object: generic object used for cleanly passing options through the test\n+\n+    Raises:\n+        AssertionError: if any environment variables or resources are missing\n+            or do not conform\n+    \"\"\"\n+    options = type('Options', (object,), {})()\n+\n+    options.variant = os.getenv('DCOS_VARIANT', 'default')\n+\n+    options.template_url = os.getenv('DCOS_TEMPLATE_URL')\n+    assert options.template_url, 'A CF template must be specified!'\n+\n+    options.ci_flags = os.getenv('CI_FLAGS', '')\n+    options.aws_access_key_id = os.getenv('AWS_ACCESS_KEY_ID')\n+    options.aws_secret_access_key = os.getenv('AWS_SECRET_ACCESS_KEY')\n+    assert options.aws_access_key_id, 'AWS Credentials Required!'\n+    assert options.aws_secret_access_key, 'AWS Credentials Required!'\n+\n+    add_env = {}\n+    prefix = 'TEST_ADD_ENV_'\n+    for k, v in os.environ.items():\n+        if k.startswith(prefix):\n+            add_env[k.replace(prefix, '')] = v\n+    options.add_env = add_env\n+    options.pytest_dir = os.getenv('DCOS_PYTEST_DIR', '/opt/mesosphere/active/dcos-integration-test')\n+    options.pytest_cmd = os.getenv('DCOS_PYTEST_CMD', 'py.test -vv '+options.ci_flags)\n+    return options\n+\n+\n+def main():\n+    options = check_environment()\n+\n+    random_identifier = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(10))\n+    unique_cluster_id = \"CF-integration-test-{}\".format(random_identifier)\n+    log.info(\"Spinning up AWS CloudFormation with ID: {}\".format(unique_cluster_id))\n+    cf = test_util.provide_aws.SimpleDcosStack(","path":"test_util/test_aws_cf.py","position":77,"original_position":77,"commit_id":"b0820fcbde7f60ac2d0cd214db55f19ec8eeac30","original_commit_id":"b0820fcbde7f60ac2d0cd214db55f19ec8eeac30","user":{"login":"cmaloney","id":751088,"avatar_url":"https://avatars.githubusercontent.com/u/751088?v=3","gravatar_id":"","url":"https://api.github.com/users/cmaloney","html_url":"https://github.com/cmaloney","followers_url":"https://api.github.com/users/cmaloney/followers","following_url":"https://api.github.com/users/cmaloney/following{/other_user}","gists_url":"https://api.github.com/users/cmaloney/gists{/gist_id}","starred_url":"https://api.github.com/users/cmaloney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmaloney/subscriptions","organizations_url":"https://api.github.com/users/cmaloney/orgs","repos_url":"https://api.github.com/users/cmaloney/repos","events_url":"https://api.github.com/users/cmaloney/events{/privacy}","received_events_url":"https://api.github.com/users/cmaloney/received_events","type":"User","site_admin":false},"body":"When we get this all done, I think this would be something like:\r\n```python\r\nbw = BotoWrapper(aws_region=options.aws_region, aws_access_key_id=options.aws_access_key_id, aws_secret_access_key=options.aws_secret_access_key)\r\ndcos = test_util.aws.DCOSCfSimple.create(name=unique_cluster_id, template_url=options.template_url, private_agents=options.private_agents, public_agents=options.public_agents, admin_location='0.0.0.0/0', key_pair_name='default')\r\ndcos.cf_stack.wait_for_creation()\r\n```","created_at":"2016-09-02T22:05:21Z","updated_at":"2016-09-02T22:05:21Z","html_url":"https://github.com/dcos/dcos/pull/240#discussion_r77418123","pull_request_url":"https://api.github.com/repos/dcos/dcos/pulls/240","_links":{"self":{"href":"https://api.github.com/repos/dcos/dcos/pulls/comments/77418123"},"html":{"href":"https://github.com/dcos/dcos/pull/240#discussion_r77418123"},"pull_request":{"href":"https://api.github.com/repos/dcos/dcos/pulls/240"}}},"pull_request":{"url":"https://api.github.com/repos/dcos/dcos/pulls/240","id":74321059,"html_url":"https://github.com/dcos/dcos/pull/240","diff_url":"https://github.com/dcos/dcos/pull/240.diff","patch_url":"https://github.com/dcos/dcos/pull/240.patch","issue_url":"https://api.github.com/repos/dcos/dcos/issues/240","number":240,"state":"open","locked":false,"title":"Integration Testing for AWS provided deployments","user":{"login":"mellenburg","id":14269783,"avatar_url":"https://avatars.githubusercontent.com/u/14269783?v=3","gravatar_id":"","url":"https://api.github.com/users/mellenburg","html_url":"https://github.com/mellenburg","followers_url":"https://api.github.com/users/mellenburg/followers","following_url":"https://api.github.com/users/mellenburg/following{/other_user}","gists_url":"https://api.github.com/users/mellenburg/gists{/gist_id}","starred_url":"https://api.github.com/users/mellenburg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mellenburg/subscriptions","organizations_url":"https://api.github.com/users/mellenburg/orgs","repos_url":"https://api.github.com/users/mellenburg/repos","events_url":"https://api.github.com/users/mellenburg/events{/privacy}","received_events_url":"https://api.github.com/users/mellenburg/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-06-18T00:14:32Z","updated_at":"2016-09-02T22:05:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3fd15ae799faf23f348bbbab5be92805091dcb3c","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/dcos/dcos/milestones/2","html_url":"https://github.com/dcos/dcos/milestones/1.8%20GA","labels_url":"https://api.github.com/repos/dcos/dcos/milestones/2/labels","id":1912566,"number":2,"title":"1.8 GA","description":"Targeted to land before 1.8 ships","creator":{"login":"spahl","id":40360,"avatar_url":"https://avatars.githubusercontent.com/u/40360?v=3","gravatar_id":"","url":"https://api.github.com/users/spahl","html_url":"https://github.com/spahl","followers_url":"https://api.github.com/users/spahl/followers","following_url":"https://api.github.com/users/spahl/following{/other_user}","gists_url":"https://api.github.com/users/spahl/gists{/gist_id}","starred_url":"https://api.github.com/users/spahl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spahl/subscriptions","organizations_url":"https://api.github.com/users/spahl/orgs","repos_url":"https://api.github.com/users/spahl/repos","events_url":"https://api.github.com/users/spahl/events{/privacy}","received_events_url":"https://api.github.com/users/spahl/received_events","type":"User","site_admin":false},"open_issues":14,"closed_issues":43,"state":"open","created_at":"2016-07-29T20:01:19Z","updated_at":"2016-09-02T01:51:03Z","due_on":"2016-08-31T00:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/dcos/dcos/pulls/240/commits","review_comments_url":"https://api.github.com/repos/dcos/dcos/pulls/240/comments","review_comment_url":"https://api.github.com/repos/dcos/dcos/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dcos/dcos/issues/240/comments","statuses_url":"https://api.github.com/repos/dcos/dcos/statuses/b0820fcbde7f60ac2d0cd214db55f19ec8eeac30","head":{"label":"mellenburg:aws_integration","ref":"aws_integration","sha":"b0820fcbde7f60ac2d0cd214db55f19ec8eeac30","user":{"login":"mellenburg","id":14269783,"avatar_url":"https://avatars.githubusercontent.com/u/14269783?v=3","gravatar_id":"","url":"https://api.github.com/users/mellenburg","html_url":"https://github.com/mellenburg","followers_url":"https://api.github.com/users/mellenburg/followers","following_url":"https://api.github.com/users/mellenburg/following{/other_user}","gists_url":"https://api.github.com/users/mellenburg/gists{/gist_id}","starred_url":"https://api.github.com/users/mellenburg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mellenburg/subscriptions","organizations_url":"https://api.github.com/users/mellenburg/orgs","repos_url":"https://api.github.com/users/mellenburg/repos","events_url":"https://api.github.com/users/mellenburg/events{/privacy}","received_events_url":"https://api.github.com/users/mellenburg/received_events","type":"User","site_admin":false},"repo":{"id":56731971,"name":"dcos","full_name":"mellenburg/dcos","owner":{"login":"mellenburg","id":14269783,"avatar_url":"https://avatars.githubusercontent.com/u/14269783?v=3","gravatar_id":"","url":"https://api.github.com/users/mellenburg","html_url":"https://github.com/mellenburg","followers_url":"https://api.github.com/users/mellenburg/followers","following_url":"https://api.github.com/users/mellenburg/following{/other_user}","gists_url":"https://api.github.com/users/mellenburg/gists{/gist_id}","starred_url":"https://api.github.com/users/mellenburg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mellenburg/subscriptions","organizations_url":"https://api.github.com/users/mellenburg/orgs","repos_url":"https://api.github.com/users/mellenburg/repos","events_url":"https://api.github.com/users/mellenburg/events{/privacy}","received_events_url":"https://api.github.com/users/mellenburg/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mellenburg/dcos","description":"DC/OS Build and Release tools","fork":true,"url":"https://api.github.com/repos/mellenburg/dcos","forks_url":"https://api.github.com/repos/mellenburg/dcos/forks","keys_url":"https://api.github.com/repos/mellenburg/dcos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mellenburg/dcos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mellenburg/dcos/teams","hooks_url":"https://api.github.com/repos/mellenburg/dcos/hooks","issue_events_url":"https://api.github.com/repos/mellenburg/dcos/issues/events{/number}","events_url":"https://api.github.com/repos/mellenburg/dcos/events","assignees_url":"https://api.github.com/repos/mellenburg/dcos/assignees{/user}","branches_url":"https://api.github.com/repos/mellenburg/dcos/branches{/branch}","tags_url":"https://api.github.com/repos/mellenburg/dcos/tags","blobs_url":"https://api.github.com/repos/mellenburg/dcos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mellenburg/dcos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mellenburg/dcos/git/refs{/sha}","trees_url":"https://api.github.com/repos/mellenburg/dcos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mellenburg/dcos/statuses/{sha}","languages_url":"https://api.github.com/repos/mellenburg/dcos/languages","stargazers_url":"https://api.github.com/repos/mellenburg/dcos/stargazers","contributors_url":"https://api.github.com/repos/mellenburg/dcos/contributors","subscribers_url":"https://api.github.com/repos/mellenburg/dcos/subscribers","subscription_url":"https://api.github.com/repos/mellenburg/dcos/subscription","commits_url":"https://api.github.com/repos/mellenburg/dcos/commits{/sha}","git_commits_url":"https://api.github.com/repos/mellenburg/dcos/git/commits{/sha}","comments_url":"https://api.github.com/repos/mellenburg/dcos/comments{/number}","issue_comment_url":"https://api.github.com/repos/mellenburg/dcos/issues/comments{/number}","contents_url":"https://api.github.com/repos/mellenburg/dcos/contents/{+path}","compare_url":"https://api.github.com/repos/mellenburg/dcos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mellenburg/dcos/merges","archive_url":"https://api.github.com/repos/mellenburg/dcos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mellenburg/dcos/downloads","issues_url":"https://api.github.com/repos/mellenburg/dcos/issues{/number}","pulls_url":"https://api.github.com/repos/mellenburg/dcos/pulls{/number}","milestones_url":"https://api.github.com/repos/mellenburg/dcos/milestones{/number}","notifications_url":"https://api.github.com/repos/mellenburg/dcos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mellenburg/dcos/labels{/name}","releases_url":"https://api.github.com/repos/mellenburg/dcos/releases{/id}","deployments_url":"https://api.github.com/repos/mellenburg/dcos/deployments","created_at":"2016-04-21T01:13:27Z","updated_at":"2016-04-29T20:59:42Z","pushed_at":"2016-09-02T21:50:34Z","git_url":"git://github.com/mellenburg/dcos.git","ssh_url":"git@github.com:mellenburg/dcos.git","clone_url":"https://github.com/mellenburg/dcos.git","svn_url":"https://github.com/mellenburg/dcos","homepage":"https://dcos.io","size":1505,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dcos:master","ref":"master","sha":"4985fd1c67e8d4040a1d65e24ea9377781fd2bc6","user":{"login":"dcos","id":17648048,"avatar_url":"https://avatars.githubusercontent.com/u/17648048?v=3","gravatar_id":"","url":"https://api.github.com/users/dcos","html_url":"https://github.com/dcos","followers_url":"https://api.github.com/users/dcos/followers","following_url":"https://api.github.com/users/dcos/following{/other_user}","gists_url":"https://api.github.com/users/dcos/gists{/gist_id}","starred_url":"https://api.github.com/users/dcos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcos/subscriptions","organizations_url":"https://api.github.com/users/dcos/orgs","repos_url":"https://api.github.com/users/dcos/repos","events_url":"https://api.github.com/users/dcos/events{/privacy}","received_events_url":"https://api.github.com/users/dcos/received_events","type":"Organization","site_admin":false},"repo":{"id":56184050,"name":"dcos","full_name":"dcos/dcos","owner":{"login":"dcos","id":17648048,"avatar_url":"https://avatars.githubusercontent.com/u/17648048?v=3","gravatar_id":"","url":"https://api.github.com/users/dcos","html_url":"https://github.com/dcos","followers_url":"https://api.github.com/users/dcos/followers","following_url":"https://api.github.com/users/dcos/following{/other_user}","gists_url":"https://api.github.com/users/dcos/gists{/gist_id}","starred_url":"https://api.github.com/users/dcos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcos/subscriptions","organizations_url":"https://api.github.com/users/dcos/orgs","repos_url":"https://api.github.com/users/dcos/repos","events_url":"https://api.github.com/users/dcos/events{/privacy}","received_events_url":"https://api.github.com/users/dcos/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dcos/dcos","description":"DC/OS Build and Release tools","fork":false,"url":"https://api.github.com/repos/dcos/dcos","forks_url":"https://api.github.com/repos/dcos/dcos/forks","keys_url":"https://api.github.com/repos/dcos/dcos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dcos/dcos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dcos/dcos/teams","hooks_url":"https://api.github.com/repos/dcos/dcos/hooks","issue_events_url":"https://api.github.com/repos/dcos/dcos/issues/events{/number}","events_url":"https://api.github.com/repos/dcos/dcos/events","assignees_url":"https://api.github.com/repos/dcos/dcos/assignees{/user}","branches_url":"https://api.github.com/repos/dcos/dcos/branches{/branch}","tags_url":"https://api.github.com/repos/dcos/dcos/tags","blobs_url":"https://api.github.com/repos/dcos/dcos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dcos/dcos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dcos/dcos/git/refs{/sha}","trees_url":"https://api.github.com/repos/dcos/dcos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dcos/dcos/statuses/{sha}","languages_url":"https://api.github.com/repos/dcos/dcos/languages","stargazers_url":"https://api.github.com/repos/dcos/dcos/stargazers","contributors_url":"https://api.github.com/repos/dcos/dcos/contributors","subscribers_url":"https://api.github.com/repos/dcos/dcos/subscribers","subscription_url":"https://api.github.com/repos/dcos/dcos/subscription","commits_url":"https://api.github.com/repos/dcos/dcos/commits{/sha}","git_commits_url":"https://api.github.com/repos/dcos/dcos/git/commits{/sha}","comments_url":"https://api.github.com/repos/dcos/dcos/comments{/number}","issue_comment_url":"https://api.github.com/repos/dcos/dcos/issues/comments{/number}","contents_url":"https://api.github.com/repos/dcos/dcos/contents/{+path}","compare_url":"https://api.github.com/repos/dcos/dcos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dcos/dcos/merges","archive_url":"https://api.github.com/repos/dcos/dcos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dcos/dcos/downloads","issues_url":"https://api.github.com/repos/dcos/dcos/issues{/number}","pulls_url":"https://api.github.com/repos/dcos/dcos/pulls{/number}","milestones_url":"https://api.github.com/repos/dcos/dcos/milestones{/number}","notifications_url":"https://api.github.com/repos/dcos/dcos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dcos/dcos/labels{/name}","releases_url":"https://api.github.com/repos/dcos/dcos/releases{/id}","deployments_url":"https://api.github.com/repos/dcos/dcos/deployments","created_at":"2016-04-13T20:31:58Z","updated_at":"2016-09-02T14:47:04Z","pushed_at":"2016-09-02T21:50:34Z","git_url":"git://github.com/dcos/dcos.git","ssh_url":"git@github.com:dcos/dcos.git","clone_url":"https://github.com/dcos/dcos.git","svn_url":"https://github.com/dcos/dcos","homepage":"https://dcos.io","size":2265,"stargazers_count":838,"watchers_count":838,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":147,"mirror_url":null,"open_issues_count":40,"forks":147,"open_issues":40,"watchers":838,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dcos/dcos/pulls/240"},"html":{"href":"https://github.com/dcos/dcos/pull/240"},"issue":{"href":"https://api.github.com/repos/dcos/dcos/issues/240"},"comments":{"href":"https://api.github.com/repos/dcos/dcos/issues/240/comments"},"review_comments":{"href":"https://api.github.com/repos/dcos/dcos/pulls/240/comments"},"review_comment":{"href":"https://api.github.com/repos/dcos/dcos/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dcos/dcos/pulls/240/commits"},"statuses":{"href":"https://api.github.com/repos/dcos/dcos/statuses/b0820fcbde7f60ac2d0cd214db55f19ec8eeac30"}}}}
{"actor":{"display_login":"cmaloney"}}