{"action":"created","comment":{"url":"https://api.github.com/repos/mattermost/mattermost-server/pulls/comments/141451672","pull_request_review_id":65667889,"id":141451672,"diff_hunk":"@@ -0,0 +1,27 @@\n+package jobs\n+\n+import (\n+\t\"github.com/mattermost/mattermost-server/model\"\n+\t\"github.com/stretchr/testify/assert\"\n+\t\"testing\"\n+\t\"github.com/mattermost/mattermost-server/store/sqlstore\"\n+)\n+\n+func TestGetMostRecentJob(t *testing.T) {\n+\tSrv.Store = sqlstore.Setup()\n+\n+\tjob, err := CreateJob(model.JOB_TYPE_ACTIANCE_EXPORT, nil)\n+\tassert.Nil(t, err)\n+\n+\t// a fake job type should always fail\n+\t_, err = GetMostRecentJob(\"FakeJobType\", model.JOB_STATUS_PENDING)\n+\tassert.NotNil(t, err)\n+\n+\t// same goes for a fake status\n+\t_, err = GetMostRecentJob(model.JOB_TYPE_ACTIANCE_EXPORT, \"FakeJobStatus\")\n+\tassert.NotNil(t, err)\n+\n+\t// but querying the correct type and status will return the expected job\n+\tfoundJob, err := GetMostRecentJob(model.JOB_TYPE_ACTIANCE_EXPORT, model.JOB_STATUS_PENDING)\n+\tassert.Equal(t, job.Id, foundJob.Id)","path":"jobs/jobs_test.go","position":26,"original_position":26,"commit_id":"1d3ffd86fab3fb5a40720184bd990b7d2ec9f4c9","original_commit_id":"1d3ffd86fab3fb5a40720184bd990b7d2ec9f4c9","user":{"login":"MusikPolice","id":1799952,"avatar_url":"https://avatars2.githubusercontent.com/u/1799952?v=4","gravatar_id":"","url":"https://api.github.com/users/MusikPolice","html_url":"https://github.com/MusikPolice","followers_url":"https://api.github.com/users/MusikPolice/followers","following_url":"https://api.github.com/users/MusikPolice/following{/other_user}","gists_url":"https://api.github.com/users/MusikPolice/gists{/gist_id}","starred_url":"https://api.github.com/users/MusikPolice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MusikPolice/subscriptions","organizations_url":"https://api.github.com/users/MusikPolice/orgs","repos_url":"https://api.github.com/users/MusikPolice/repos","events_url":"https://api.github.com/users/MusikPolice/events{/privacy}","received_events_url":"https://api.github.com/users/MusikPolice/received_events","type":"User","site_admin":false},"body":"In theory, this could fail if another job with these attributes is added by a concurrently running test between the time at which lines 13 and 26 are executed. This test is a prime candidate for using a mock store once we have that capability. ","created_at":"2017-09-27T19:59:48Z","updated_at":"2017-09-27T19:59:48Z","html_url":"https://github.com/mattermost/mattermost-server/pull/7527#discussion_r141451672","pull_request_url":"https://api.github.com/repos/mattermost/mattermost-server/pulls/7527","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/mattermost/mattermost-server/pulls/comments/141451672"},"html":{"href":"https://github.com/mattermost/mattermost-server/pull/7527#discussion_r141451672"},"pull_request":{"href":"https://api.github.com/repos/mattermost/mattermost-server/pulls/7527"}}},"pull_request":{"url":"https://api.github.com/repos/mattermost/mattermost-server/pulls/7527","id":143485325,"html_url":"https://github.com/mattermost/mattermost-server/pull/7527","diff_url":"https://github.com/mattermost/mattermost-server/pull/7527.diff","patch_url":"https://github.com/mattermost/mattermost-server/pull/7527.patch","issue_url":"https://api.github.com/repos/mattermost/mattermost-server/issues/7527","number":7527,"state":"open","locked":false,"title":"PLT-7503: Create Message Export Batch Endpoint","user":{"login":"MusikPolice","id":1799952,"avatar_url":"https://avatars2.githubusercontent.com/u/1799952?v=4","gravatar_id":"","url":"https://api.github.com/users/MusikPolice","html_url":"https://github.com/MusikPolice","followers_url":"https://api.github.com/users/MusikPolice/followers","following_url":"https://api.github.com/users/MusikPolice/following{/other_user}","gists_url":"https://api.github.com/users/MusikPolice/gists{/gist_id}","starred_url":"https://api.github.com/users/MusikPolice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MusikPolice/subscriptions","organizations_url":"https://api.github.com/users/MusikPolice/orgs","repos_url":"https://api.github.com/users/MusikPolice/repos","events_url":"https://api.github.com/users/MusikPolice/events{/privacy}","received_events_url":"https://api.github.com/users/MusikPolice/received_events","type":"User","site_admin":false},"body":"#### Summary\r\nStarted implementation of a job server scheduled task for exporting database contents into Actiance, a third-party enterprise compliance system.\r\n\r\n**NOTE:** This is a work in progress. I still have to integrate it with Actiance, but this PR sets up the scheduled task, and I wanted to get it up for review sooner than later so that I can correct any problems.\r\n\r\n#### Ticket Link\r\nhttps://mattermost.atlassian.net/browse/PLT-7503\r\n\r\n#### Checklist\r\n[Place an '[x]' (no spaces) in all applicable fields. Please remove unrelated fields.]\r\n- [x] Added or updated unit tests (required for all new features)\r\n- [x] Has enterprise changes - See https://github.com/mattermost/enterprise/pull/205\r\n- [x] Includes text changes and localization file ([.../i18n/en.json](https://github.com/mattermost/mattermost-server/blob/master/i18n/en.json) updates\r\n","created_at":"2017-09-27T19:55:56Z","updated_at":"2017-09-27T19:59:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1384c604076279830188a877bd65cdf1c1bfeca7","assignee":{"login":"MusikPolice","id":1799952,"avatar_url":"https://avatars2.githubusercontent.com/u/1799952?v=4","gravatar_id":"","url":"https://api.github.com/users/MusikPolice","html_url":"https://github.com/MusikPolice","followers_url":"https://api.github.com/users/MusikPolice/followers","following_url":"https://api.github.com/users/MusikPolice/following{/other_user}","gists_url":"https://api.github.com/users/MusikPolice/gists{/gist_id}","starred_url":"https://api.github.com/users/MusikPolice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MusikPolice/subscriptions","organizations_url":"https://api.github.com/users/MusikPolice/orgs","repos_url":"https://api.github.com/users/MusikPolice/repos","events_url":"https://api.github.com/users/MusikPolice/events{/privacy}","received_events_url":"https://api.github.com/users/MusikPolice/received_events","type":"User","site_admin":false},"assignees":[{"login":"MusikPolice","id":1799952,"avatar_url":"https://avatars2.githubusercontent.com/u/1799952?v=4","gravatar_id":"","url":"https://api.github.com/users/MusikPolice","html_url":"https://github.com/MusikPolice","followers_url":"https://api.github.com/users/MusikPolice/followers","following_url":"https://api.github.com/users/MusikPolice/following{/other_user}","gists_url":"https://api.github.com/users/MusikPolice/gists{/gist_id}","starred_url":"https://api.github.com/users/MusikPolice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MusikPolice/subscriptions","organizations_url":"https://api.github.com/users/MusikPolice/orgs","repos_url":"https://api.github.com/users/MusikPolice/repos","events_url":"https://api.github.com/users/MusikPolice/events{/privacy}","received_events_url":"https://api.github.com/users/MusikPolice/received_events","type":"User","site_admin":false}],"requested_reviewers":[{"login":"grundleborg","id":1198059,"avatar_url":"https://avatars1.githubusercontent.com/u/1198059?v=4","gravatar_id":"","url":"https://api.github.com/users/grundleborg","html_url":"https://github.com/grundleborg","followers_url":"https://api.github.com/users/grundleborg/followers","following_url":"https://api.github.com/users/grundleborg/following{/other_user}","gists_url":"https://api.github.com/users/grundleborg/gists{/gist_id}","starred_url":"https://api.github.com/users/grundleborg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grundleborg/subscriptions","organizations_url":"https://api.github.com/users/grundleborg/orgs","repos_url":"https://api.github.com/users/grundleborg/repos","events_url":"https://api.github.com/users/grundleborg/events{/privacy}","received_events_url":"https://api.github.com/users/grundleborg/received_events","type":"User","site_admin":false},{"login":"crspeller","id":3191642,"avatar_url":"https://avatars1.githubusercontent.com/u/3191642?v=4","gravatar_id":"","url":"https://api.github.com/users/crspeller","html_url":"https://github.com/crspeller","followers_url":"https://api.github.com/users/crspeller/followers","following_url":"https://api.github.com/users/crspeller/following{/other_user}","gists_url":"https://api.github.com/users/crspeller/gists{/gist_id}","starred_url":"https://api.github.com/users/crspeller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crspeller/subscriptions","organizations_url":"https://api.github.com/users/crspeller/orgs","repos_url":"https://api.github.com/users/crspeller/repos","events_url":"https://api.github.com/users/crspeller/events{/privacy}","received_events_url":"https://api.github.com/users/crspeller/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/mattermost/mattermost-server/pulls/7527/commits","review_comments_url":"https://api.github.com/repos/mattermost/mattermost-server/pulls/7527/comments","review_comment_url":"https://api.github.com/repos/mattermost/mattermost-server/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mattermost/mattermost-server/issues/7527/comments","statuses_url":"https://api.github.com/repos/mattermost/mattermost-server/statuses/1d3ffd86fab3fb5a40720184bd990b7d2ec9f4c9","head":{"label":"mattermost:PLT-7503","ref":"PLT-7503","sha":"1d3ffd86fab3fb5a40720184bd990b7d2ec9f4c9","user":{"login":"mattermost","id":9828093,"avatar_url":"https://avatars1.githubusercontent.com/u/9828093?v=4","gravatar_id":"","url":"https://api.github.com/users/mattermost","html_url":"https://github.com/mattermost","followers_url":"https://api.github.com/users/mattermost/followers","following_url":"https://api.github.com/users/mattermost/following{/other_user}","gists_url":"https://api.github.com/users/mattermost/gists{/gist_id}","starred_url":"https://api.github.com/users/mattermost/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattermost/subscriptions","organizations_url":"https://api.github.com/users/mattermost/orgs","repos_url":"https://api.github.com/users/mattermost/repos","events_url":"https://api.github.com/users/mattermost/events{/privacy}","received_events_url":"https://api.github.com/users/mattermost/received_events","type":"Organization","site_admin":false},"repo":{"id":37448451,"name":"mattermost-server","full_name":"mattermost/mattermost-server","owner":{"login":"mattermost","id":9828093,"avatar_url":"https://avatars1.githubusercontent.com/u/9828093?v=4","gravatar_id":"","url":"https://api.github.com/users/mattermost","html_url":"https://github.com/mattermost","followers_url":"https://api.github.com/users/mattermost/followers","following_url":"https://api.github.com/users/mattermost/following{/other_user}","gists_url":"https://api.github.com/users/mattermost/gists{/gist_id}","starred_url":"https://api.github.com/users/mattermost/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattermost/subscriptions","organizations_url":"https://api.github.com/users/mattermost/orgs","repos_url":"https://api.github.com/users/mattermost/repos","events_url":"https://api.github.com/users/mattermost/events{/privacy}","received_events_url":"https://api.github.com/users/mattermost/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mattermost/mattermost-server","description":"Open source Slack-alternative in Golang and React - Mattermost","fork":false,"url":"https://api.github.com/repos/mattermost/mattermost-server","forks_url":"https://api.github.com/repos/mattermost/mattermost-server/forks","keys_url":"https://api.github.com/repos/mattermost/mattermost-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mattermost/mattermost-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mattermost/mattermost-server/teams","hooks_url":"https://api.github.com/repos/mattermost/mattermost-server/hooks","issue_events_url":"https://api.github.com/repos/mattermost/mattermost-server/issues/events{/number}","events_url":"https://api.github.com/repos/mattermost/mattermost-server/events","assignees_url":"https://api.github.com/repos/mattermost/mattermost-server/assignees{/user}","branches_url":"https://api.github.com/repos/mattermost/mattermost-server/branches{/branch}","tags_url":"https://api.github.com/repos/mattermost/mattermost-server/tags","blobs_url":"https://api.github.com/repos/mattermost/mattermost-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mattermost/mattermost-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mattermost/mattermost-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/mattermost/mattermost-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mattermost/mattermost-server/statuses/{sha}","languages_url":"https://api.github.com/repos/mattermost/mattermost-server/languages","stargazers_url":"https://api.github.com/repos/mattermost/mattermost-server/stargazers","contributors_url":"https://api.github.com/repos/mattermost/mattermost-server/contributors","subscribers_url":"https://api.github.com/repos/mattermost/mattermost-server/subscribers","subscription_url":"https://api.github.com/repos/mattermost/mattermost-server/subscription","commits_url":"https://api.github.com/repos/mattermost/mattermost-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/mattermost/mattermost-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/mattermost/mattermost-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/mattermost/mattermost-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/mattermost/mattermost-server/contents/{+path}","compare_url":"https://api.github.com/repos/mattermost/mattermost-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mattermost/mattermost-server/merges","archive_url":"https://api.github.com/repos/mattermost/mattermost-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mattermost/mattermost-server/downloads","issues_url":"https://api.github.com/repos/mattermost/mattermost-server/issues{/number}","pulls_url":"https://api.github.com/repos/mattermost/mattermost-server/pulls{/number}","milestones_url":"https://api.github.com/repos/mattermost/mattermost-server/milestones{/number}","notifications_url":"https://api.github.com/repos/mattermost/mattermost-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mattermost/mattermost-server/labels{/name}","releases_url":"https://api.github.com/repos/mattermost/mattermost-server/releases{/id}","deployments_url":"https://api.github.com/repos/mattermost/mattermost-server/deployments","created_at":"2015-06-15T06:50:02Z","updated_at":"2017-09-27T19:08:59Z","pushed_at":"2017-09-27T19:55:57Z","git_url":"git://github.com/mattermost/mattermost-server.git","ssh_url":"git@github.com:mattermost/mattermost-server.git","clone_url":"https://github.com/mattermost/mattermost-server.git","svn_url":"https://github.com/mattermost/mattermost-server","homepage":"https://mattermost.com","size":122386,"stargazers_count":11051,"watchers_count":11051,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1777,"mirror_url":null,"open_issues_count":134,"forks":1777,"open_issues":134,"watchers":11051,"default_branch":"master"}},"base":{"label":"mattermost:master","ref":"master","sha":"8d662105d3049a5cd67a7bf42ab70d479d4348e2","user":{"login":"mattermost","id":9828093,"avatar_url":"https://avatars1.githubusercontent.com/u/9828093?v=4","gravatar_id":"","url":"https://api.github.com/users/mattermost","html_url":"https://github.com/mattermost","followers_url":"https://api.github.com/users/mattermost/followers","following_url":"https://api.github.com/users/mattermost/following{/other_user}","gists_url":"https://api.github.com/users/mattermost/gists{/gist_id}","starred_url":"https://api.github.com/users/mattermost/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattermost/subscriptions","organizations_url":"https://api.github.com/users/mattermost/orgs","repos_url":"https://api.github.com/users/mattermost/repos","events_url":"https://api.github.com/users/mattermost/events{/privacy}","received_events_url":"https://api.github.com/users/mattermost/received_events","type":"Organization","site_admin":false},"repo":{"id":37448451,"name":"mattermost-server","full_name":"mattermost/mattermost-server","owner":{"login":"mattermost","id":9828093,"avatar_url":"https://avatars1.githubusercontent.com/u/9828093?v=4","gravatar_id":"","url":"https://api.github.com/users/mattermost","html_url":"https://github.com/mattermost","followers_url":"https://api.github.com/users/mattermost/followers","following_url":"https://api.github.com/users/mattermost/following{/other_user}","gists_url":"https://api.github.com/users/mattermost/gists{/gist_id}","starred_url":"https://api.github.com/users/mattermost/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattermost/subscriptions","organizations_url":"https://api.github.com/users/mattermost/orgs","repos_url":"https://api.github.com/users/mattermost/repos","events_url":"https://api.github.com/users/mattermost/events{/privacy}","received_events_url":"https://api.github.com/users/mattermost/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mattermost/mattermost-server","description":"Open source Slack-alternative in Golang and React - Mattermost","fork":false,"url":"https://api.github.com/repos/mattermost/mattermost-server","forks_url":"https://api.github.com/repos/mattermost/mattermost-server/forks","keys_url":"https://api.github.com/repos/mattermost/mattermost-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mattermost/mattermost-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mattermost/mattermost-server/teams","hooks_url":"https://api.github.com/repos/mattermost/mattermost-server/hooks","issue_events_url":"https://api.github.com/repos/mattermost/mattermost-server/issues/events{/number}","events_url":"https://api.github.com/repos/mattermost/mattermost-server/events","assignees_url":"https://api.github.com/repos/mattermost/mattermost-server/assignees{/user}","branches_url":"https://api.github.com/repos/mattermost/mattermost-server/branches{/branch}","tags_url":"https://api.github.com/repos/mattermost/mattermost-server/tags","blobs_url":"https://api.github.com/repos/mattermost/mattermost-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mattermost/mattermost-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mattermost/mattermost-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/mattermost/mattermost-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mattermost/mattermost-server/statuses/{sha}","languages_url":"https://api.github.com/repos/mattermost/mattermost-server/languages","stargazers_url":"https://api.github.com/repos/mattermost/mattermost-server/stargazers","contributors_url":"https://api.github.com/repos/mattermost/mattermost-server/contributors","subscribers_url":"https://api.github.com/repos/mattermost/mattermost-server/subscribers","subscription_url":"https://api.github.com/repos/mattermost/mattermost-server/subscription","commits_url":"https://api.github.com/repos/mattermost/mattermost-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/mattermost/mattermost-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/mattermost/mattermost-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/mattermost/mattermost-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/mattermost/mattermost-server/contents/{+path}","compare_url":"https://api.github.com/repos/mattermost/mattermost-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mattermost/mattermost-server/merges","archive_url":"https://api.github.com/repos/mattermost/mattermost-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mattermost/mattermost-server/downloads","issues_url":"https://api.github.com/repos/mattermost/mattermost-server/issues{/number}","pulls_url":"https://api.github.com/repos/mattermost/mattermost-server/pulls{/number}","milestones_url":"https://api.github.com/repos/mattermost/mattermost-server/milestones{/number}","notifications_url":"https://api.github.com/repos/mattermost/mattermost-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mattermost/mattermost-server/labels{/name}","releases_url":"https://api.github.com/repos/mattermost/mattermost-server/releases{/id}","deployments_url":"https://api.github.com/repos/mattermost/mattermost-server/deployments","created_at":"2015-06-15T06:50:02Z","updated_at":"2017-09-27T19:08:59Z","pushed_at":"2017-09-27T19:55:57Z","git_url":"git://github.com/mattermost/mattermost-server.git","ssh_url":"git@github.com:mattermost/mattermost-server.git","clone_url":"https://github.com/mattermost/mattermost-server.git","svn_url":"https://github.com/mattermost/mattermost-server","homepage":"https://mattermost.com","size":122386,"stargazers_count":11051,"watchers_count":11051,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1777,"mirror_url":null,"open_issues_count":134,"forks":1777,"open_issues":134,"watchers":11051,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mattermost/mattermost-server/pulls/7527"},"html":{"href":"https://github.com/mattermost/mattermost-server/pull/7527"},"issue":{"href":"https://api.github.com/repos/mattermost/mattermost-server/issues/7527"},"comments":{"href":"https://api.github.com/repos/mattermost/mattermost-server/issues/7527/comments"},"review_comments":{"href":"https://api.github.com/repos/mattermost/mattermost-server/pulls/7527/comments"},"review_comment":{"href":"https://api.github.com/repos/mattermost/mattermost-server/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mattermost/mattermost-server/pulls/7527/commits"},"statuses":{"href":"https://api.github.com/repos/mattermost/mattermost-server/statuses/1d3ffd86fab3fb5a40720184bd990b7d2ec9f4c9"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"MusikPolice"}}