{"action":"created","comment":{"url":"https://api.github.com/repos/coreos/init/pulls/comments/137922311","pull_request_review_id":61391831,"id":137922311,"diff_hunk":"@@ -0,0 +1,192 @@\n+// Copyright 2017 CoreOS, Inc.\n+//\n+// Licensed under the Apache License, Version 2.0 (the \"License\");\n+// you may not use this file except in compliance with the License.\n+// You may obtain a copy of the License at\n+//\n+//     http://www.apache.org/licenses/LICENSE-2.0\n+//\n+// Unless required by applicable law or agreed to in writing, software\n+// distributed under the License is distributed on an \"AS IS\" BASIS,\n+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+// See the License for the specific language governing permissions and\n+// limitations under the License.\n+\n+package register\n+\n+import (\n+\t\"fmt\"\n+\t\"io/ioutil\"\n+\t\"os\"\n+\t\"path/filepath\"\n+\t\"strings\"\n+\t\"testing\"\n+\n+\t\"github.com/coreos/init/tests/util\"\n+)\n+\n+type Test struct {\n+\tName            string\n+\tFunc            func(*testing.T, Test)\n+\tBinaryPath      string\n+\tIgnitionConfig  *string\n+\tCloudinitConfig *string\n+}\n+\n+func (test Test) Run(t *testing.T) {\n+\tif os.Getenv(\"TMPDIR\") == \"\" {\n+\t\ttmpDir, err := ioutil.TempDir(\"/var/tmp\", \"\")\n+\t\tif err != nil {\n+\t\t\tt.Fatalf(\"failed to create temp working dir in /var/tmp: %v\", err)\n+\t\t}\n+\n+\t\terr = os.Setenv(\"TMPDIR\", tmpDir)\n+\t\tif err != nil {\n+\t\t\tt.Fatalf(\"couldn't set TMPDIR env var: %v\", err)\n+\t\t}\n+\n+\t\tdefer test.RemoveAll(t, tmpDir)\n+\t\tdefer os.Setenv(\"TMPDIR\", \"\")\n+\t}\n+\ttest.Func(t, test)\n+}\n+\n+func (test Test) CreateDevice(t *testing.T) (string, string) {\n+\tdiskFile, err := ioutil.TempFile(\"\", \"coreos-install-disk\")","path":"tests/register/register.go","position":55,"original_position":55,"commit_id":"865c5422a3058494dd84ba70cc6a531a2927db9d","original_commit_id":"865c5422a3058494dd84ba70cc6a531a2927db9d","user":{"login":"bgilbert","id":361374,"avatar_url":"https://avatars1.githubusercontent.com/u/361374?v=4","gravatar_id":"","url":"https://api.github.com/users/bgilbert","html_url":"https://github.com/bgilbert","followers_url":"https://api.github.com/users/bgilbert/followers","following_url":"https://api.github.com/users/bgilbert/following{/other_user}","gists_url":"https://api.github.com/users/bgilbert/gists{/gist_id}","starred_url":"https://api.github.com/users/bgilbert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bgilbert/subscriptions","organizations_url":"https://api.github.com/users/bgilbert/orgs","repos_url":"https://api.github.com/users/bgilbert/repos","events_url":"https://api.github.com/users/bgilbert/events{/privacy}","received_events_url":"https://api.github.com/users/bgilbert/received_events","type":"User","site_admin":false},"body":"You'll want to avoid `TempFile` here; just use `OpenFile` with a fixed filename in `os.TempDir()`.  The file descriptor you're leaking will prevent the OS from freeing the space used by the file until the process exits, so once you have a large number of tests, you'll be consuming a significant amount of space in `/var/tmp`.\r\n\r\nReally: once you have an outer tmpdir per test, you don't need any further TempFile calls at all; fixed names are okay.","created_at":"2017-09-09T09:10:13Z","updated_at":"2017-09-09T09:15:45Z","html_url":"https://github.com/coreos/init/pull/248#discussion_r137922311","pull_request_url":"https://api.github.com/repos/coreos/init/pulls/248","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/coreos/init/pulls/comments/137922311"},"html":{"href":"https://github.com/coreos/init/pull/248#discussion_r137922311"},"pull_request":{"href":"https://api.github.com/repos/coreos/init/pulls/248"}}},"pull_request":{"url":"https://api.github.com/repos/coreos/init/pulls/248","id":139601523,"html_url":"https://github.com/coreos/init/pull/248","diff_url":"https://github.com/coreos/init/pull/248.diff","patch_url":"https://github.com/coreos/init/pull/248.patch","issue_url":"https://api.github.com/repos/coreos/init/issues/248","number":248,"state":"open","locked":false,"title":"tests: add coreos_install tests","user":{"login":"arithx","id":1923653,"avatar_url":"https://avatars1.githubusercontent.com/u/1923653?v=4","gravatar_id":"","url":"https://api.github.com/users/arithx","html_url":"https://github.com/arithx","followers_url":"https://api.github.com/users/arithx/followers","following_url":"https://api.github.com/users/arithx/following{/other_user}","gists_url":"https://api.github.com/users/arithx/gists{/gist_id}","starred_url":"https://api.github.com/users/arithx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arithx/subscriptions","organizations_url":"https://api.github.com/users/arithx/orgs","repos_url":"https://api.github.com/users/arithx/repos","events_url":"https://api.github.com/users/arithx/events{/privacy}","received_events_url":"https://api.github.com/users/arithx/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-09-06T15:59:20Z","updated_at":"2017-09-09T09:15:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d9e1091885b07a6b327cb6855b30ba0c435ce053","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/coreos/init/pulls/248/commits","review_comments_url":"https://api.github.com/repos/coreos/init/pulls/248/comments","review_comment_url":"https://api.github.com/repos/coreos/init/pulls/comments{/number}","comments_url":"https://api.github.com/repos/coreos/init/issues/248/comments","statuses_url":"https://api.github.com/repos/coreos/init/statuses/865c5422a3058494dd84ba70cc6a531a2927db9d","head":{"label":"arithx:coreos-install-tests","ref":"coreos-install-tests","sha":"865c5422a3058494dd84ba70cc6a531a2927db9d","user":{"login":"arithx","id":1923653,"avatar_url":"https://avatars1.githubusercontent.com/u/1923653?v=4","gravatar_id":"","url":"https://api.github.com/users/arithx","html_url":"https://github.com/arithx","followers_url":"https://api.github.com/users/arithx/followers","following_url":"https://api.github.com/users/arithx/following{/other_user}","gists_url":"https://api.github.com/users/arithx/gists{/gist_id}","starred_url":"https://api.github.com/users/arithx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arithx/subscriptions","organizations_url":"https://api.github.com/users/arithx/orgs","repos_url":"https://api.github.com/users/arithx/repos","events_url":"https://api.github.com/users/arithx/events{/privacy}","received_events_url":"https://api.github.com/users/arithx/received_events","type":"User","site_admin":false},"repo":{"id":102507138,"name":"init","full_name":"arithx/init","owner":{"login":"arithx","id":1923653,"avatar_url":"https://avatars1.githubusercontent.com/u/1923653?v=4","gravatar_id":"","url":"https://api.github.com/users/arithx","html_url":"https://github.com/arithx","followers_url":"https://api.github.com/users/arithx/followers","following_url":"https://api.github.com/users/arithx/following{/other_user}","gists_url":"https://api.github.com/users/arithx/gists{/gist_id}","starred_url":"https://api.github.com/users/arithx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arithx/subscriptions","organizations_url":"https://api.github.com/users/arithx/orgs","repos_url":"https://api.github.com/users/arithx/repos","events_url":"https://api.github.com/users/arithx/events{/privacy}","received_events_url":"https://api.github.com/users/arithx/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/arithx/init","description":"init system units and configuration for Container Linux","fork":true,"url":"https://api.github.com/repos/arithx/init","forks_url":"https://api.github.com/repos/arithx/init/forks","keys_url":"https://api.github.com/repos/arithx/init/keys{/key_id}","collaborators_url":"https://api.github.com/repos/arithx/init/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/arithx/init/teams","hooks_url":"https://api.github.com/repos/arithx/init/hooks","issue_events_url":"https://api.github.com/repos/arithx/init/issues/events{/number}","events_url":"https://api.github.com/repos/arithx/init/events","assignees_url":"https://api.github.com/repos/arithx/init/assignees{/user}","branches_url":"https://api.github.com/repos/arithx/init/branches{/branch}","tags_url":"https://api.github.com/repos/arithx/init/tags","blobs_url":"https://api.github.com/repos/arithx/init/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/arithx/init/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/arithx/init/git/refs{/sha}","trees_url":"https://api.github.com/repos/arithx/init/git/trees{/sha}","statuses_url":"https://api.github.com/repos/arithx/init/statuses/{sha}","languages_url":"https://api.github.com/repos/arithx/init/languages","stargazers_url":"https://api.github.com/repos/arithx/init/stargazers","contributors_url":"https://api.github.com/repos/arithx/init/contributors","subscribers_url":"https://api.github.com/repos/arithx/init/subscribers","subscription_url":"https://api.github.com/repos/arithx/init/subscription","commits_url":"https://api.github.com/repos/arithx/init/commits{/sha}","git_commits_url":"https://api.github.com/repos/arithx/init/git/commits{/sha}","comments_url":"https://api.github.com/repos/arithx/init/comments{/number}","issue_comment_url":"https://api.github.com/repos/arithx/init/issues/comments{/number}","contents_url":"https://api.github.com/repos/arithx/init/contents/{+path}","compare_url":"https://api.github.com/repos/arithx/init/compare/{base}...{head}","merges_url":"https://api.github.com/repos/arithx/init/merges","archive_url":"https://api.github.com/repos/arithx/init/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/arithx/init/downloads","issues_url":"https://api.github.com/repos/arithx/init/issues{/number}","pulls_url":"https://api.github.com/repos/arithx/init/pulls{/number}","milestones_url":"https://api.github.com/repos/arithx/init/milestones{/number}","notifications_url":"https://api.github.com/repos/arithx/init/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/arithx/init/labels{/name}","releases_url":"https://api.github.com/repos/arithx/init/releases{/id}","deployments_url":"https://api.github.com/repos/arithx/init/deployments","created_at":"2017-09-05T16:51:19Z","updated_at":"2017-09-05T16:51:20Z","pushed_at":"2017-09-09T00:13:04Z","git_url":"git://github.com/arithx/init.git","ssh_url":"git@github.com:arithx/init.git","clone_url":"https://github.com/arithx/init.git","svn_url":"https://github.com/arithx/init","homepage":"","size":367,"stargazers_count":0,"watchers_count":0,"language":"Shell","has_issues":false,"has_projects":true,"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":"coreos:master","ref":"master","sha":"357d25dd959505dc9ac52f9a36d5f1641c7b557d","user":{"login":"coreos","id":3730757,"avatar_url":"https://avatars3.githubusercontent.com/u/3730757?v=4","gravatar_id":"","url":"https://api.github.com/users/coreos","html_url":"https://github.com/coreos","followers_url":"https://api.github.com/users/coreos/followers","following_url":"https://api.github.com/users/coreos/following{/other_user}","gists_url":"https://api.github.com/users/coreos/gists{/gist_id}","starred_url":"https://api.github.com/users/coreos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coreos/subscriptions","organizations_url":"https://api.github.com/users/coreos/orgs","repos_url":"https://api.github.com/users/coreos/repos","events_url":"https://api.github.com/users/coreos/events{/privacy}","received_events_url":"https://api.github.com/users/coreos/received_events","type":"Organization","site_admin":false},"repo":{"id":8788253,"name":"init","full_name":"coreos/init","owner":{"login":"coreos","id":3730757,"avatar_url":"https://avatars3.githubusercontent.com/u/3730757?v=4","gravatar_id":"","url":"https://api.github.com/users/coreos","html_url":"https://github.com/coreos","followers_url":"https://api.github.com/users/coreos/followers","following_url":"https://api.github.com/users/coreos/following{/other_user}","gists_url":"https://api.github.com/users/coreos/gists{/gist_id}","starred_url":"https://api.github.com/users/coreos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coreos/subscriptions","organizations_url":"https://api.github.com/users/coreos/orgs","repos_url":"https://api.github.com/users/coreos/repos","events_url":"https://api.github.com/users/coreos/events{/privacy}","received_events_url":"https://api.github.com/users/coreos/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/coreos/init","description":"init system units and configuration for Container Linux","fork":false,"url":"https://api.github.com/repos/coreos/init","forks_url":"https://api.github.com/repos/coreos/init/forks","keys_url":"https://api.github.com/repos/coreos/init/keys{/key_id}","collaborators_url":"https://api.github.com/repos/coreos/init/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/coreos/init/teams","hooks_url":"https://api.github.com/repos/coreos/init/hooks","issue_events_url":"https://api.github.com/repos/coreos/init/issues/events{/number}","events_url":"https://api.github.com/repos/coreos/init/events","assignees_url":"https://api.github.com/repos/coreos/init/assignees{/user}","branches_url":"https://api.github.com/repos/coreos/init/branches{/branch}","tags_url":"https://api.github.com/repos/coreos/init/tags","blobs_url":"https://api.github.com/repos/coreos/init/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/coreos/init/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/coreos/init/git/refs{/sha}","trees_url":"https://api.github.com/repos/coreos/init/git/trees{/sha}","statuses_url":"https://api.github.com/repos/coreos/init/statuses/{sha}","languages_url":"https://api.github.com/repos/coreos/init/languages","stargazers_url":"https://api.github.com/repos/coreos/init/stargazers","contributors_url":"https://api.github.com/repos/coreos/init/contributors","subscribers_url":"https://api.github.com/repos/coreos/init/subscribers","subscription_url":"https://api.github.com/repos/coreos/init/subscription","commits_url":"https://api.github.com/repos/coreos/init/commits{/sha}","git_commits_url":"https://api.github.com/repos/coreos/init/git/commits{/sha}","comments_url":"https://api.github.com/repos/coreos/init/comments{/number}","issue_comment_url":"https://api.github.com/repos/coreos/init/issues/comments{/number}","contents_url":"https://api.github.com/repos/coreos/init/contents/{+path}","compare_url":"https://api.github.com/repos/coreos/init/compare/{base}...{head}","merges_url":"https://api.github.com/repos/coreos/init/merges","archive_url":"https://api.github.com/repos/coreos/init/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/coreos/init/downloads","issues_url":"https://api.github.com/repos/coreos/init/issues{/number}","pulls_url":"https://api.github.com/repos/coreos/init/pulls{/number}","milestones_url":"https://api.github.com/repos/coreos/init/milestones{/number}","notifications_url":"https://api.github.com/repos/coreos/init/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/coreos/init/labels{/name}","releases_url":"https://api.github.com/repos/coreos/init/releases{/id}","deployments_url":"https://api.github.com/repos/coreos/init/deployments","created_at":"2013-03-15T00:06:17Z","updated_at":"2017-09-06T23:41:45Z","pushed_at":"2017-09-07T19:11:56Z","git_url":"git://github.com/coreos/init.git","ssh_url":"git@github.com:coreos/init.git","clone_url":"https://github.com/coreos/init.git","svn_url":"https://github.com/coreos/init","homepage":"","size":356,"stargazers_count":74,"watchers_count":74,"language":"Shell","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":90,"mirror_url":null,"open_issues_count":17,"forks":90,"open_issues":17,"watchers":74,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/coreos/init/pulls/248"},"html":{"href":"https://github.com/coreos/init/pull/248"},"issue":{"href":"https://api.github.com/repos/coreos/init/issues/248"},"comments":{"href":"https://api.github.com/repos/coreos/init/issues/248/comments"},"review_comments":{"href":"https://api.github.com/repos/coreos/init/pulls/248/comments"},"review_comment":{"href":"https://api.github.com/repos/coreos/init/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/coreos/init/pulls/248/commits"},"statuses":{"href":"https://api.github.com/repos/coreos/init/statuses/865c5422a3058494dd84ba70cc6a531a2927db9d"}},"author_association":"NONE"}}
{"actor":{"display_login":"bgilbert"}}