{"action":"created","comment":{"url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/pulls/comments/74233140","id":74233140,"diff_hunk":"@@ -34,8 +35,148 @@ func TestWritingAFile(t *testing.T) {\n \t}\n }\n \n-func decompressAndListFiles(tgzFile io.Reader) (map[string]string, error) {\n-\tret := map[string]string{}\n+func TestWritingToEmptyFileName(t *testing.T) {\n+\tb := bytes.Buffer{}\n+\n+\trand.Seed(0)\n+\n+\ttgz, err := NewTgz(&b)\n+\tif err != nil {\n+\t\tt.Fatal(err)\n+\t}\n+\n+\twriter := tgz.GetWriterToFile(\"\")\n+\twriter.Close()\n+\twriter = tgz.GetWriterToFile(\" \")\n+\twriter.Close()\n+\ttgz.Close()\n+\n+\tfiles, err := decompressAndListFiles(&b)\n+\n+\tif err != nil {\n+\t\tt.Fatal(err)\n+\t}\n+\n+\twant := map[string]struct{}{\"untitled_f1f85ff5\": struct{}{}, \" \": struct{}{}}\n+\n+\tif !reflect.DeepEqual(files, want) {\n+\t\tt.Fatal(\"got: %s, want: %s\", files, want)\n+\t}\n+}\n+\n+func TestWritingTwoFiles(t *testing.T) {\n+\tb := bytes.Buffer{}\n+\n+\ttgz, err := NewTgz(&b)\n+\tif err != nil {\n+\t\tt.Fatal(err)\n+\t}\n+\n+\twriter := tgz.GetWriterToFile(\"test1.txt\")\n+\twriter.Write([]byte(\"test\"))\n+\twriter.Close()\n+\n+\twriter = tgz.GetWriterToFile(\"test2.txt\")\n+\twriter.Write([]byte(\"test\"))\n+\twriter.Close()\n+\n+\ttgz.Close()\n+\n+\tfiles, err := decompressAndListFiles(&b)\n+\tif err != nil {\n+\t\tt.Fatal(err)\n+\t}\n+\n+\tif _, ok := files[\"test1.txt\"]; !ok {\n+\t\tt.Fatal(\"Expected tgz to contain test1.txt but it didnt\")\n+\t}\n+\tif _, ok := files[\"test2.txt\"]; !ok {\n+\t\tt.Fatal(\"Expected tgz to contain test1.txt but it didnt\")\n+\t}\n+}\n+\n+func TestWritingUTF8ToAFile(t *testing.T) {\n+\tb := bytes.Buffer{}\n+\n+\ttgz, err := NewTgz(&b)\n+\tif err != nil {\n+\t\tt.Fatal(err)\n+\t}\n+\n+\twriter := tgz.GetWriterToFile(\"logs/projects/phils-core/pods-fh-aaa-8-v7m10-fh-aaa.logs\")\n+\twriter.Write([]byte(\"世界世形声字 / 形聲字界世界形声字 / 形聲字世界世界世界世形声字 / 形聲字界世界世界世界\"))\n+\twriter.Close()\n+\ttgz.Close()\n+\n+\tfiles, err := decompressAndListFiles(&b)\n+\tif err != nil {\n+\t\tt.Fatal(err)\n+\t}\n+\n+\tif _, ok := files[\"logs/projects/phils-core/pods-fh-aaa-8-v7m10-fh-aaa.logs\"]; !ok {\n+\t\tt.Fatal(\"Expected tgz to contain logs/projects/phils-core/pods-fh-aaa-8-v7m10-fh-aaa.logs but it didnt\")\n+\t}\n+}\n+\n+type task func() error\n+\n+func getWriteTask(writer io.WriteCloser) task {\n+\treturn func() error {\n+\t\twriter.Write([]byte(\"世界世形声字 / 形聲字界世界形声字 / 形聲字世界世界世界世形声字 / 形聲字界世界世界世界\"))\n+\t\twriter.Close()\n+\t\treturn nil\n+\t}\n+}\n+\n+func TestParallelWrites(t *testing.T) {\n+\tb := bytes.Buffer{}\n+\n+\ttgz, err := NewTgz(&b)\n+\tif err != nil {\n+\t\tt.Fatal(err)\n+\t}\n+\n+\tnumSyncWrites := 25000\n+\n+\ttasks := []task{}\n+\n+\tfor i := 1; i <= numSyncWrites; i++ {\n+\t\ttasks = append(tasks, getWriteTask(tgz.GetWriterToFile(\"path/to/file\"+strconv.Itoa(i)+\".file\")))\n+\t}\n+\n+\tvar wg sync.WaitGroup\n+\tsem := make(chan struct{}, numSyncWrites)","path":"tgz_test.go","position":151,"original_position":151,"commit_id":"70cd5d0411817a07796a83255fe3e294177718ae","original_commit_id":"70cd5d0411817a07796a83255fe3e294177718ae","user":{"login":"rhcarvalho","id":88819,"avatar_url":"https://avatars.githubusercontent.com/u/88819?v=3","gravatar_id":"","url":"https://api.github.com/users/rhcarvalho","html_url":"https://github.com/rhcarvalho","followers_url":"https://api.github.com/users/rhcarvalho/followers","following_url":"https://api.github.com/users/rhcarvalho/following{/other_user}","gists_url":"https://api.github.com/users/rhcarvalho/gists{/gist_id}","starred_url":"https://api.github.com/users/rhcarvalho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhcarvalho/subscriptions","organizations_url":"https://api.github.com/users/rhcarvalho/orgs","repos_url":"https://api.github.com/users/rhcarvalho/repos","events_url":"https://api.github.com/users/rhcarvalho/events{/privacy}","received_events_url":"https://api.github.com/users/rhcarvalho/received_events","type":"User","site_admin":false},"body":"The number of tasks and the size of the semaphore are the same, so the semaphore is not useful :)\r\nThis test function is creating 25,000 goroutines in any case.","created_at":"2016-08-10T12:21:18Z","updated_at":"2016-08-10T12:21:18Z","html_url":"https://github.com/feedhenry/fh-system-dump-tool/pull/17#discussion_r74233140","pull_request_url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/pulls/17","_links":{"self":{"href":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/pulls/comments/74233140"},"html":{"href":"https://github.com/feedhenry/fh-system-dump-tool/pull/17#discussion_r74233140"},"pull_request":{"href":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/pulls/17"}}},"pull_request":{"url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/pulls/17","id":80772937,"html_url":"https://github.com/feedhenry/fh-system-dump-tool/pull/17","diff_url":"https://github.com/feedhenry/fh-system-dump-tool/pull/17.diff","patch_url":"https://github.com/feedhenry/fh-system-dump-tool/pull/17.patch","issue_url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/issues/17","number":17,"state":"open","locked":false,"title":"Rhmap 9321","user":{"login":"philbrookes","id":1033452,"avatar_url":"https://avatars.githubusercontent.com/u/1033452?v=3","gravatar_id":"","url":"https://api.github.com/users/philbrookes","html_url":"https://github.com/philbrookes","followers_url":"https://api.github.com/users/philbrookes/followers","following_url":"https://api.github.com/users/philbrookes/following{/other_user}","gists_url":"https://api.github.com/users/philbrookes/gists{/gist_id}","starred_url":"https://api.github.com/users/philbrookes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/philbrookes/subscriptions","organizations_url":"https://api.github.com/users/philbrookes/orgs","repos_url":"https://api.github.com/users/philbrookes/repos","events_url":"https://api.github.com/users/philbrookes/events{/privacy}","received_events_url":"https://api.github.com/users/philbrookes/received_events","type":"User","site_admin":false},"body":"re-opened from broken PR: https://github.com/feedhenry/fh-system-dump-tool/pull/13","created_at":"2016-08-10T10:48:38Z","updated_at":"2016-08-10T12:21:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6cd3c18aaf5947f7395ee2bb80269509e4b2ca67","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/pulls/17/commits","review_comments_url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/pulls/17/comments","review_comment_url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/pulls/comments{/number}","comments_url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/issues/17/comments","statuses_url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/statuses/70cd5d0411817a07796a83255fe3e294177718ae","head":{"label":"philbrookes:RHMAP-9321","ref":"RHMAP-9321","sha":"70cd5d0411817a07796a83255fe3e294177718ae","user":{"login":"philbrookes","id":1033452,"avatar_url":"https://avatars.githubusercontent.com/u/1033452?v=3","gravatar_id":"","url":"https://api.github.com/users/philbrookes","html_url":"https://github.com/philbrookes","followers_url":"https://api.github.com/users/philbrookes/followers","following_url":"https://api.github.com/users/philbrookes/following{/other_user}","gists_url":"https://api.github.com/users/philbrookes/gists{/gist_id}","starred_url":"https://api.github.com/users/philbrookes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/philbrookes/subscriptions","organizations_url":"https://api.github.com/users/philbrookes/orgs","repos_url":"https://api.github.com/users/philbrookes/repos","events_url":"https://api.github.com/users/philbrookes/events{/privacy}","received_events_url":"https://api.github.com/users/philbrookes/received_events","type":"User","site_admin":false},"repo":{"id":65282786,"name":"fh-system-dump-tool","full_name":"philbrookes/fh-system-dump-tool","owner":{"login":"philbrookes","id":1033452,"avatar_url":"https://avatars.githubusercontent.com/u/1033452?v=3","gravatar_id":"","url":"https://api.github.com/users/philbrookes","html_url":"https://github.com/philbrookes","followers_url":"https://api.github.com/users/philbrookes/followers","following_url":"https://api.github.com/users/philbrookes/following{/other_user}","gists_url":"https://api.github.com/users/philbrookes/gists{/gist_id}","starred_url":"https://api.github.com/users/philbrookes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/philbrookes/subscriptions","organizations_url":"https://api.github.com/users/philbrookes/orgs","repos_url":"https://api.github.com/users/philbrookes/repos","events_url":"https://api.github.com/users/philbrookes/events{/privacy}","received_events_url":"https://api.github.com/users/philbrookes/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/philbrookes/fh-system-dump-tool","description":"This repository contains the system dump tool for the RHMAP On-Prem product","fork":true,"url":"https://api.github.com/repos/philbrookes/fh-system-dump-tool","forks_url":"https://api.github.com/repos/philbrookes/fh-system-dump-tool/forks","keys_url":"https://api.github.com/repos/philbrookes/fh-system-dump-tool/keys{/key_id}","collaborators_url":"https://api.github.com/repos/philbrookes/fh-system-dump-tool/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/philbrookes/fh-system-dump-tool/teams","hooks_url":"https://api.github.com/repos/philbrookes/fh-system-dump-tool/hooks","issue_events_url":"https://api.github.com/repos/philbrookes/fh-system-dump-tool/issues/events{/number}","events_url":"https://api.github.com/repos/philbrookes/fh-system-dump-tool/events","assignees_url":"https://api.github.com/repos/philbrookes/fh-system-dump-tool/assignees{/user}","branches_url":"https://api.github.com/repos/philbrookes/fh-system-dump-tool/branches{/branch}","tags_url":"https://api.github.com/repos/philbrookes/fh-system-dump-tool/tags","blobs_url":"https://api.github.com/repos/philbrookes/fh-system-dump-tool/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/philbrookes/fh-system-dump-tool/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/philbrookes/fh-system-dump-tool/git/refs{/sha}","trees_url":"https://api.github.com/repos/philbrookes/fh-system-dump-tool/git/trees{/sha}","statuses_url":"https://api.github.com/repos/philbrookes/fh-system-dump-tool/statuses/{sha}","languages_url":"https://api.github.com/repos/philbrookes/fh-system-dump-tool/languages","stargazers_url":"https://api.github.com/repos/philbrookes/fh-system-dump-tool/stargazers","contributors_url":"https://api.github.com/repos/philbrookes/fh-system-dump-tool/contributors","subscribers_url":"https://api.github.com/repos/philbrookes/fh-system-dump-tool/subscribers","subscription_url":"https://api.github.com/repos/philbrookes/fh-system-dump-tool/subscription","commits_url":"https://api.github.com/repos/philbrookes/fh-system-dump-tool/commits{/sha}","git_commits_url":"https://api.github.com/repos/philbrookes/fh-system-dump-tool/git/commits{/sha}","comments_url":"https://api.github.com/repos/philbrookes/fh-system-dump-tool/comments{/number}","issue_comment_url":"https://api.github.com/repos/philbrookes/fh-system-dump-tool/issues/comments{/number}","contents_url":"https://api.github.com/repos/philbrookes/fh-system-dump-tool/contents/{+path}","compare_url":"https://api.github.com/repos/philbrookes/fh-system-dump-tool/compare/{base}...{head}","merges_url":"https://api.github.com/repos/philbrookes/fh-system-dump-tool/merges","archive_url":"https://api.github.com/repos/philbrookes/fh-system-dump-tool/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/philbrookes/fh-system-dump-tool/downloads","issues_url":"https://api.github.com/repos/philbrookes/fh-system-dump-tool/issues{/number}","pulls_url":"https://api.github.com/repos/philbrookes/fh-system-dump-tool/pulls{/number}","milestones_url":"https://api.github.com/repos/philbrookes/fh-system-dump-tool/milestones{/number}","notifications_url":"https://api.github.com/repos/philbrookes/fh-system-dump-tool/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/philbrookes/fh-system-dump-tool/labels{/name}","releases_url":"https://api.github.com/repos/philbrookes/fh-system-dump-tool/releases{/id}","deployments_url":"https://api.github.com/repos/philbrookes/fh-system-dump-tool/deployments","created_at":"2016-08-09T09:36:44Z","updated_at":"2016-08-09T09:36:44Z","pushed_at":"2016-08-10T10:48:30Z","git_url":"git://github.com/philbrookes/fh-system-dump-tool.git","ssh_url":"git@github.com:philbrookes/fh-system-dump-tool.git","clone_url":"https://github.com/philbrookes/fh-system-dump-tool.git","svn_url":"https://github.com/philbrookes/fh-system-dump-tool","homepage":null,"size":46,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"feedhenry:master","ref":"master","sha":"bc08b7338550548dfa712cd20e79f9dde2eaad3d","user":{"login":"feedhenry","id":772226,"avatar_url":"https://avatars.githubusercontent.com/u/772226?v=3","gravatar_id":"","url":"https://api.github.com/users/feedhenry","html_url":"https://github.com/feedhenry","followers_url":"https://api.github.com/users/feedhenry/followers","following_url":"https://api.github.com/users/feedhenry/following{/other_user}","gists_url":"https://api.github.com/users/feedhenry/gists{/gist_id}","starred_url":"https://api.github.com/users/feedhenry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/feedhenry/subscriptions","organizations_url":"https://api.github.com/users/feedhenry/orgs","repos_url":"https://api.github.com/users/feedhenry/repos","events_url":"https://api.github.com/users/feedhenry/events{/privacy}","received_events_url":"https://api.github.com/users/feedhenry/received_events","type":"Organization","site_admin":false},"repo":{"id":63058395,"name":"fh-system-dump-tool","full_name":"feedhenry/fh-system-dump-tool","owner":{"login":"feedhenry","id":772226,"avatar_url":"https://avatars.githubusercontent.com/u/772226?v=3","gravatar_id":"","url":"https://api.github.com/users/feedhenry","html_url":"https://github.com/feedhenry","followers_url":"https://api.github.com/users/feedhenry/followers","following_url":"https://api.github.com/users/feedhenry/following{/other_user}","gists_url":"https://api.github.com/users/feedhenry/gists{/gist_id}","starred_url":"https://api.github.com/users/feedhenry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/feedhenry/subscriptions","organizations_url":"https://api.github.com/users/feedhenry/orgs","repos_url":"https://api.github.com/users/feedhenry/repos","events_url":"https://api.github.com/users/feedhenry/events{/privacy}","received_events_url":"https://api.github.com/users/feedhenry/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/feedhenry/fh-system-dump-tool","description":"This repository contains the system dump tool for the RHMAP On-Prem product","fork":false,"url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool","forks_url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/forks","keys_url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/keys{/key_id}","collaborators_url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/teams","hooks_url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/hooks","issue_events_url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/issues/events{/number}","events_url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/events","assignees_url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/assignees{/user}","branches_url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/branches{/branch}","tags_url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/tags","blobs_url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/git/refs{/sha}","trees_url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/git/trees{/sha}","statuses_url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/statuses/{sha}","languages_url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/languages","stargazers_url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/stargazers","contributors_url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/contributors","subscribers_url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/subscribers","subscription_url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/subscription","commits_url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/commits{/sha}","git_commits_url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/git/commits{/sha}","comments_url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/comments{/number}","issue_comment_url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/issues/comments{/number}","contents_url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/contents/{+path}","compare_url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/compare/{base}...{head}","merges_url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/merges","archive_url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/downloads","issues_url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/issues{/number}","pulls_url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/pulls{/number}","milestones_url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/milestones{/number}","notifications_url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/labels{/name}","releases_url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/releases{/id}","deployments_url":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/deployments","created_at":"2016-07-11T10:20:52Z","updated_at":"2016-08-08T14:28:41Z","pushed_at":"2016-08-10T10:48:38Z","git_url":"git://github.com/feedhenry/fh-system-dump-tool.git","ssh_url":"git@github.com:feedhenry/fh-system-dump-tool.git","clone_url":"https://github.com/feedhenry/fh-system-dump-tool.git","svn_url":"https://github.com/feedhenry/fh-system-dump-tool","homepage":null,"size":78,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":2,"forks":2,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/pulls/17"},"html":{"href":"https://github.com/feedhenry/fh-system-dump-tool/pull/17"},"issue":{"href":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/issues/17"},"comments":{"href":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/issues/17/comments"},"review_comments":{"href":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/pulls/17/comments"},"review_comment":{"href":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/pulls/17/commits"},"statuses":{"href":"https://api.github.com/repos/feedhenry/fh-system-dump-tool/statuses/70cd5d0411817a07796a83255fe3e294177718ae"}}}}
{"actor":{"display_login":"rhcarvalho"}}