{"action":"created","comment":{"url":"https://api.github.com/repos/polydawn/repeatr/pulls/comments/25823718","id":25823718,"diff_hunk":"@@ -0,0 +1,103 @@\n+package dir\n+\n+import (\n+\t\"io/ioutil\"\n+\t\"os\"\n+\t\"path/filepath\"\n+\t\"testing\"\n+\t\"time\"\n+\n+\t. \"github.com/smartystreets/goconvey/convey\"\n+\t\"github.com/spacemonkeygo/errors\"\n+\t\"github.com/spacemonkeygo/errors/try\"\n+\t\"polydawn.net/repeatr/def\"\n+\t\"polydawn.net/repeatr/lib/fshash\"\n+\t\"polydawn.net/repeatr/testutil\"\n+)\n+\n+func Test(t *testing.T) {\n+\tConvey(\"Given a nonexistant path\", t, func() {\n+\t\tConvey(\"The input config should be rejected during validation\", func() {\n+\t\t\tcorrectError := false\n+\t\t\ttry.Do(func() {\n+\t\t\t\tNew(def.Input{\n+\t\t\t\t\tType:     \"dir\",\n+\t\t\t\t\tHash:     \"abcd\",\n+\t\t\t\t\tURL:      \"/tmp/certainly/should/not/exist\",\n+\t\t\t\t\tLocation: \"/data\",\n+\t\t\t\t\t// REVIEW: two of these four fields were more for the executor.\n+\t\t\t\t\t// maybe this struct isn't the sanest to use for this arg.\n+\t\t\t\t})\n+\t\t\t}).Catch(def.ValidationError, func(e *errors.Error) {\n+\t\t\t\tcorrectError = true\n+\t\t\t}).Done()\n+\n+\t\t\tSo(correctError, ShouldBeTrue)\n+\t\t})\n+\t})\n+\n+\tConvey(\"Given a directory with a mixture of files and folders\", t,\n+\t\ttestutil.WithTmpdir(func() {\n+\t\t\tpwd, _ := os.Getwd()\n+\t\t\tos.Mkdir(\"src\", 0755)\n+\t\t\tos.Mkdir(\"src/a\", 01777)\n+\t\t\tos.Mkdir(\"src/b\", 0750)\n+\t\t\tf, err := os.OpenFile(\"src/b/c\", os.O_RDWR|os.O_CREATE, 0664)\n+\t\t\tSo(err, ShouldBeNil)\n+\t\t\tf.Write([]byte(\"zyx\"))\n+\t\t\tSo(f.Close(), ShouldBeNil)\n+\n+\t\t\t// save attributes first because access times are conceptually insane\n+\t\t\t// remarkably, since the first read doesn't cause atimes to change,\n+\t\t\t// the inputter can capture it and we can recreate it.\n+\t\t\t// but that still doesn't make anything else about checking or handling it sane.\n+\t\t\tpath0metadata := fshash.ReadMetadata(\"src\")\n+\t\t\tpath0metadata.Name = \"\"\n+\t\t\tpath1metadata := fshash.ReadMetadata(\"src/a\")\n+\t\t\tpath2metadata := fshash.ReadMetadata(\"src/b\")\n+\t\t\tpath3metadata := fshash.ReadMetadata(\"src/b/c\")\n+\n+\t\t\tConvey(\"We can construct an input\", func() {\n+\t\t\t\tinputter := New(def.Input{\n+\t\t\t\t\tType: \"dir\",\n+\t\t\t\t\tHash: \"abcd\",\n+\t\t\t\t\tURL:  filepath.Join(pwd, \"src\"),\n+\t\t\t\t})\n+\n+\t\t\t\tConvey(\"Apply succeeds (hash checks pass)\", func() {\n+\t\t\t\t\t// wait a moment before copying to decrease the odds of nanotime telling a huge, huge lie.","path":"input/dir/dir_input_test.go","position":68,"original_position":68,"commit_id":"d14e24d7ef519c40edfff7fdcd4a24f9e2be1f6e","original_commit_id":"d14e24d7ef519c40edfff7fdcd4a24f9e2be1f6e","user":{"login":"kofalt","id":265071,"avatar_url":"https://avatars.githubusercontent.com/u/265071?v=3","gravatar_id":"","url":"https://api.github.com/users/kofalt","html_url":"https://github.com/kofalt","followers_url":"https://api.github.com/users/kofalt/followers","following_url":"https://api.github.com/users/kofalt/following{/other_user}","gists_url":"https://api.github.com/users/kofalt/gists{/gist_id}","starred_url":"https://api.github.com/users/kofalt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kofalt/subscriptions","organizations_url":"https://api.github.com/users/kofalt/orgs","repos_url":"https://api.github.com/users/kofalt/repos","events_url":"https://api.github.com/users/kofalt/events{/privacy}","received_events_url":"https://api.github.com/users/kofalt/received_events","type":"User","site_admin":false},"body":"Can you amend this slightly to explain *what* goes wrong, exactly? There's no context.","created_at":"2015-03-04T23:00:45Z","updated_at":"2015-03-04T23:00:45Z","html_url":"https://github.com/polydawn/repeatr/pull/5#discussion_r25823718","pull_request_url":"https://api.github.com/repos/polydawn/repeatr/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/polydawn/repeatr/pulls/comments/25823718"},"html":{"href":"https://github.com/polydawn/repeatr/pull/5#discussion_r25823718"},"pull_request":{"href":"https://api.github.com/repos/polydawn/repeatr/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/polydawn/repeatr/pulls/5","id":30512877,"html_url":"https://github.com/polydawn/repeatr/pull/5","diff_url":"https://github.com/polydawn/repeatr/pull/5.diff","patch_url":"https://github.com/polydawn/repeatr/pull/5.patch","issue_url":"https://api.github.com/repos/polydawn/repeatr/issues/5","number":5,"state":"open","locked":false,"title":"Inputs draft","user":{"login":"heavenlyhash","id":627638,"avatar_url":"https://avatars.githubusercontent.com/u/627638?v=3","gravatar_id":"","url":"https://api.github.com/users/heavenlyhash","html_url":"https://github.com/heavenlyhash","followers_url":"https://api.github.com/users/heavenlyhash/followers","following_url":"https://api.github.com/users/heavenlyhash/following{/other_user}","gists_url":"https://api.github.com/users/heavenlyhash/gists{/gist_id}","starred_url":"https://api.github.com/users/heavenlyhash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/heavenlyhash/subscriptions","organizations_url":"https://api.github.com/users/heavenlyhash/orgs","repos_url":"https://api.github.com/users/heavenlyhash/repos","events_url":"https://api.github.com/users/heavenlyhash/events{/privacy}","received_events_url":"https://api.github.com/users/heavenlyhash/received_events","type":"User","site_admin":false},"body":"First pass on some hashing and file shuffling stuff for inputs.\r\n\r\nThere's still a lot of todos here, but any tests not yet passing are skipped so we can merge this and continue to iterate from here.","created_at":"2015-03-04T22:46:49Z","updated_at":"2015-03-04T23:00:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e8dd91122cb0a04ab4bda96fae0a993ec9f528a1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/polydawn/repeatr/pulls/5/commits","review_comments_url":"https://api.github.com/repos/polydawn/repeatr/pulls/5/comments","review_comment_url":"https://api.github.com/repos/polydawn/repeatr/pulls/comments{/number}","comments_url":"https://api.github.com/repos/polydawn/repeatr/issues/5/comments","statuses_url":"https://api.github.com/repos/polydawn/repeatr/statuses/d14e24d7ef519c40edfff7fdcd4a24f9e2be1f6e","head":{"label":"polydawn:inputs-draft","ref":"inputs-draft","sha":"d14e24d7ef519c40edfff7fdcd4a24f9e2be1f6e","user":{"login":"polydawn","id":5307883,"avatar_url":"https://avatars.githubusercontent.com/u/5307883?v=3","gravatar_id":"","url":"https://api.github.com/users/polydawn","html_url":"https://github.com/polydawn","followers_url":"https://api.github.com/users/polydawn/followers","following_url":"https://api.github.com/users/polydawn/following{/other_user}","gists_url":"https://api.github.com/users/polydawn/gists{/gist_id}","starred_url":"https://api.github.com/users/polydawn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/polydawn/subscriptions","organizations_url":"https://api.github.com/users/polydawn/orgs","repos_url":"https://api.github.com/users/polydawn/repos","events_url":"https://api.github.com/users/polydawn/events{/privacy}","received_events_url":"https://api.github.com/users/polydawn/received_events","type":"Organization","site_admin":false},"repo":{"id":31432509,"name":"repeatr","full_name":"polydawn/repeatr","owner":{"login":"polydawn","id":5307883,"avatar_url":"https://avatars.githubusercontent.com/u/5307883?v=3","gravatar_id":"","url":"https://api.github.com/users/polydawn","html_url":"https://github.com/polydawn","followers_url":"https://api.github.com/users/polydawn/followers","following_url":"https://api.github.com/users/polydawn/following{/other_user}","gists_url":"https://api.github.com/users/polydawn/gists{/gist_id}","starred_url":"https://api.github.com/users/polydawn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/polydawn/subscriptions","organizations_url":"https://api.github.com/users/polydawn/orgs","repos_url":"https://api.github.com/users/polydawn/repos","events_url":"https://api.github.com/users/polydawn/events{/privacy}","received_events_url":"https://api.github.com/users/polydawn/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/polydawn/repeatr","description":"Run it. Run it again.","fork":false,"url":"https://api.github.com/repos/polydawn/repeatr","forks_url":"https://api.github.com/repos/polydawn/repeatr/forks","keys_url":"https://api.github.com/repos/polydawn/repeatr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/polydawn/repeatr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/polydawn/repeatr/teams","hooks_url":"https://api.github.com/repos/polydawn/repeatr/hooks","issue_events_url":"https://api.github.com/repos/polydawn/repeatr/issues/events{/number}","events_url":"https://api.github.com/repos/polydawn/repeatr/events","assignees_url":"https://api.github.com/repos/polydawn/repeatr/assignees{/user}","branches_url":"https://api.github.com/repos/polydawn/repeatr/branches{/branch}","tags_url":"https://api.github.com/repos/polydawn/repeatr/tags","blobs_url":"https://api.github.com/repos/polydawn/repeatr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/polydawn/repeatr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/polydawn/repeatr/git/refs{/sha}","trees_url":"https://api.github.com/repos/polydawn/repeatr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/polydawn/repeatr/statuses/{sha}","languages_url":"https://api.github.com/repos/polydawn/repeatr/languages","stargazers_url":"https://api.github.com/repos/polydawn/repeatr/stargazers","contributors_url":"https://api.github.com/repos/polydawn/repeatr/contributors","subscribers_url":"https://api.github.com/repos/polydawn/repeatr/subscribers","subscription_url":"https://api.github.com/repos/polydawn/repeatr/subscription","commits_url":"https://api.github.com/repos/polydawn/repeatr/commits{/sha}","git_commits_url":"https://api.github.com/repos/polydawn/repeatr/git/commits{/sha}","comments_url":"https://api.github.com/repos/polydawn/repeatr/comments{/number}","issue_comment_url":"https://api.github.com/repos/polydawn/repeatr/issues/comments{/number}","contents_url":"https://api.github.com/repos/polydawn/repeatr/contents/{+path}","compare_url":"https://api.github.com/repos/polydawn/repeatr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/polydawn/repeatr/merges","archive_url":"https://api.github.com/repos/polydawn/repeatr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/polydawn/repeatr/downloads","issues_url":"https://api.github.com/repos/polydawn/repeatr/issues{/number}","pulls_url":"https://api.github.com/repos/polydawn/repeatr/pulls{/number}","milestones_url":"https://api.github.com/repos/polydawn/repeatr/milestones{/number}","notifications_url":"https://api.github.com/repos/polydawn/repeatr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/polydawn/repeatr/labels{/name}","releases_url":"https://api.github.com/repos/polydawn/repeatr/releases{/id}","created_at":"2015-02-27T18:12:08Z","updated_at":"2015-03-03T18:25:04Z","pushed_at":"2015-03-04T22:44:39Z","git_url":"git://github.com/polydawn/repeatr.git","ssh_url":"git@github.com:polydawn/repeatr.git","clone_url":"https://github.com/polydawn/repeatr.git","svn_url":"https://github.com/polydawn/repeatr","homepage":null,"size":308,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"polydawn:master","ref":"master","sha":"9816f4d70a9c634478afa38de11c6b67e1ae285f","user":{"login":"polydawn","id":5307883,"avatar_url":"https://avatars.githubusercontent.com/u/5307883?v=3","gravatar_id":"","url":"https://api.github.com/users/polydawn","html_url":"https://github.com/polydawn","followers_url":"https://api.github.com/users/polydawn/followers","following_url":"https://api.github.com/users/polydawn/following{/other_user}","gists_url":"https://api.github.com/users/polydawn/gists{/gist_id}","starred_url":"https://api.github.com/users/polydawn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/polydawn/subscriptions","organizations_url":"https://api.github.com/users/polydawn/orgs","repos_url":"https://api.github.com/users/polydawn/repos","events_url":"https://api.github.com/users/polydawn/events{/privacy}","received_events_url":"https://api.github.com/users/polydawn/received_events","type":"Organization","site_admin":false},"repo":{"id":31432509,"name":"repeatr","full_name":"polydawn/repeatr","owner":{"login":"polydawn","id":5307883,"avatar_url":"https://avatars.githubusercontent.com/u/5307883?v=3","gravatar_id":"","url":"https://api.github.com/users/polydawn","html_url":"https://github.com/polydawn","followers_url":"https://api.github.com/users/polydawn/followers","following_url":"https://api.github.com/users/polydawn/following{/other_user}","gists_url":"https://api.github.com/users/polydawn/gists{/gist_id}","starred_url":"https://api.github.com/users/polydawn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/polydawn/subscriptions","organizations_url":"https://api.github.com/users/polydawn/orgs","repos_url":"https://api.github.com/users/polydawn/repos","events_url":"https://api.github.com/users/polydawn/events{/privacy}","received_events_url":"https://api.github.com/users/polydawn/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/polydawn/repeatr","description":"Run it. Run it again.","fork":false,"url":"https://api.github.com/repos/polydawn/repeatr","forks_url":"https://api.github.com/repos/polydawn/repeatr/forks","keys_url":"https://api.github.com/repos/polydawn/repeatr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/polydawn/repeatr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/polydawn/repeatr/teams","hooks_url":"https://api.github.com/repos/polydawn/repeatr/hooks","issue_events_url":"https://api.github.com/repos/polydawn/repeatr/issues/events{/number}","events_url":"https://api.github.com/repos/polydawn/repeatr/events","assignees_url":"https://api.github.com/repos/polydawn/repeatr/assignees{/user}","branches_url":"https://api.github.com/repos/polydawn/repeatr/branches{/branch}","tags_url":"https://api.github.com/repos/polydawn/repeatr/tags","blobs_url":"https://api.github.com/repos/polydawn/repeatr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/polydawn/repeatr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/polydawn/repeatr/git/refs{/sha}","trees_url":"https://api.github.com/repos/polydawn/repeatr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/polydawn/repeatr/statuses/{sha}","languages_url":"https://api.github.com/repos/polydawn/repeatr/languages","stargazers_url":"https://api.github.com/repos/polydawn/repeatr/stargazers","contributors_url":"https://api.github.com/repos/polydawn/repeatr/contributors","subscribers_url":"https://api.github.com/repos/polydawn/repeatr/subscribers","subscription_url":"https://api.github.com/repos/polydawn/repeatr/subscription","commits_url":"https://api.github.com/repos/polydawn/repeatr/commits{/sha}","git_commits_url":"https://api.github.com/repos/polydawn/repeatr/git/commits{/sha}","comments_url":"https://api.github.com/repos/polydawn/repeatr/comments{/number}","issue_comment_url":"https://api.github.com/repos/polydawn/repeatr/issues/comments{/number}","contents_url":"https://api.github.com/repos/polydawn/repeatr/contents/{+path}","compare_url":"https://api.github.com/repos/polydawn/repeatr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/polydawn/repeatr/merges","archive_url":"https://api.github.com/repos/polydawn/repeatr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/polydawn/repeatr/downloads","issues_url":"https://api.github.com/repos/polydawn/repeatr/issues{/number}","pulls_url":"https://api.github.com/repos/polydawn/repeatr/pulls{/number}","milestones_url":"https://api.github.com/repos/polydawn/repeatr/milestones{/number}","notifications_url":"https://api.github.com/repos/polydawn/repeatr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/polydawn/repeatr/labels{/name}","releases_url":"https://api.github.com/repos/polydawn/repeatr/releases{/id}","created_at":"2015-02-27T18:12:08Z","updated_at":"2015-03-03T18:25:04Z","pushed_at":"2015-03-04T22:44:39Z","git_url":"git://github.com/polydawn/repeatr.git","ssh_url":"git@github.com:polydawn/repeatr.git","clone_url":"https://github.com/polydawn/repeatr.git","svn_url":"https://github.com/polydawn/repeatr","homepage":null,"size":308,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/polydawn/repeatr/pulls/5"},"html":{"href":"https://github.com/polydawn/repeatr/pull/5"},"issue":{"href":"https://api.github.com/repos/polydawn/repeatr/issues/5"},"comments":{"href":"https://api.github.com/repos/polydawn/repeatr/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/polydawn/repeatr/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/polydawn/repeatr/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/polydawn/repeatr/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/polydawn/repeatr/statuses/d14e24d7ef519c40edfff7fdcd4a24f9e2be1f6e"}}}}