diff --git a/server/events/atlantis_workspace.go b/server/events/atlantis_workspace.go index a57aee053..190b87790 100644 --- a/server/events/atlantis_workspace.go +++ b/server/events/atlantis_workspace.go @@ -42,6 +42,9 @@ type AtlantisWorkspace interface { // FileWorkspace implements AtlantisWorkspace with the file system. type FileWorkspace struct { DataDir string + // TestingOverrideCloneURL can be used during testing to override the URL + // that is cloned. If it's empty then we clone normally. + TestingOverrideCloneURL string } // Clone git clones headRepo, checks out the branch and then returns the absolute @@ -68,7 +71,11 @@ func (w *FileWorkspace) Clone( } log.Info("git cloning %q into %q", headRepo.SanitizedCloneURL, cloneDir) - cloneCmd := exec.Command("git", "clone", headRepo.CloneURL, cloneDir) // #nosec + cloneURL := headRepo.CloneURL + if w.TestingOverrideCloneURL != "" { + cloneURL = w.TestingOverrideCloneURL + } + cloneCmd := exec.Command("git", "clone", cloneURL, cloneDir) // #nosec if output, err := cloneCmd.CombinedOutput(); err != nil { return "", errors.Wrapf(err, "cloning %s: %s", headRepo.SanitizedCloneURL, string(output)) } diff --git a/server/events_controller.go b/server/events_controller.go index b205f2eb8..e9ee6e1e0 100644 --- a/server/events_controller.go +++ b/server/events_controller.go @@ -177,7 +177,12 @@ func (e *EventsController) handlePullRequestEvent(w http.ResponseWriter, baseRep // workspace to '*' to indicate that all applicable dirs and workspaces // should be planned. autoplanCmd := events.NewCommand("*", nil, events.Plan, false, "*", true) - go e.CommandRunner.ExecuteCommand(baseRepo, headRepo, user, pull.Num, autoplanCmd) + if !e.TestingMode { + go e.CommandRunner.ExecuteCommand(baseRepo, headRepo, user, pull.Num, autoplanCmd) + } else { + // When testing we want to wait for everything to complete. + e.CommandRunner.ExecuteCommand(baseRepo, headRepo, user, pull.Num, autoplanCmd) + } return case ClosedPullEvent: // If the pull request was closed, we delete locks. diff --git a/server/events_controller_e2e_test.go b/server/events_controller_e2e_test.go index 97883c0a1..8a9bd6691 100644 --- a/server/events_controller_e2e_test.go +++ b/server/events_controller_e2e_test.go @@ -6,8 +6,8 @@ import ( "io/ioutil" "net/http" "net/http/httptest" - "os" "path/filepath" + "regexp" "strings" "testing" @@ -29,20 +29,111 @@ import ( . "github.com/runatlantis/atlantis/testing" ) -func Test(t *testing.T) { +/* +flows: +- pull request opened autoplan +- comment to apply + +github/gitlab + +locking + +merging pull requests + +different repo organizations + +atlantis.yaml + +*/ +func TestGitHubWorkflow(t *testing.T) { RegisterMockTestingT(t) - // Config. + cases := []struct { + Description string + // RepoDir is relative to testfixtures/test-repos. + RepoDir string + ModifiedFiles []string + ExpAutoplanCommentFile string + ExpMergeCommentFile string + CommentAndReplies []string + }{ + { + Description: "simple", + RepoDir: "simple", + ModifiedFiles: []string{"main.tf"}, + ExpAutoplanCommentFile: "exp-output-autoplan.txt", + CommentAndReplies: []string{ + "atlantis apply", "exp-output-apply.txt", + }, + ExpMergeCommentFile: "exp-output-merge.txt", + }, + } + for _, c := range cases { + ctrl, vcsClient, githubGetter, atlantisWorkspace := setupE2E(t) + t.Run(c.Description, func(t *testing.T) { + // Set the repo to be cloned through the testing backdoor. + repoDir, err := filepath.Abs(filepath.Join("testfixtures", "test-repos", c.RepoDir)) + Ok(t, err) + atlantisWorkspace.TestingOverrideCloneURL = fmt.Sprintf("file://%s", repoDir) + + // Setup test dependencies. + w := httptest.NewRecorder() + When(githubGetter.GetPullRequest(AnyRepo(), AnyInt())).ThenReturn(GitHubPullRequestParsed(), nil) + When(vcsClient.GetModifiedFiles(AnyRepo(), matchers.AnyModelsPullRequest())).ThenReturn(c.ModifiedFiles, nil) + + // First, send the open pull request event and trigger an autoplan. + pullOpenedReq := GitHubPullRequestOpenedEvent(t) + ctrl.Post(w, pullOpenedReq) + responseContains(t, w, 200, "Processing...") + _, _, autoplanComment := vcsClient.VerifyWasCalledOnce().CreateComment(AnyRepo(), AnyInt(), AnyString()).GetCapturedArguments() + exp, err := ioutil.ReadFile(filepath.Join(repoDir, c.ExpAutoplanCommentFile)) + Ok(t, err) + Equals(t, string(exp), autoplanComment) + + // Now send any other comments. + for i := 0; i < len(c.CommentAndReplies); i += 2 { + comment := c.CommentAndReplies[i] + expOutputFile := c.CommentAndReplies[i+1] + + commentReq := GitHubCommentEvent(t, comment) + w = httptest.NewRecorder() + ctrl.Post(w, commentReq) + responseContains(t, w, 200, "Processing...") + _, _, autoplanComment = vcsClient.VerifyWasCalled(Twice()).CreateComment(AnyRepo(), AnyInt(), AnyString()).GetCapturedArguments() + + exp, err = ioutil.ReadFile(filepath.Join(repoDir, expOutputFile)) + Ok(t, err) + // Replace all 'ID: 1111818181' strings with * so we can do a comparison. + idRegex := regexp.MustCompile(`\(ID: [0-9]+\)`) + autoplanComment = idRegex.ReplaceAllString(autoplanComment, "(ID: ******************)") + Equals(t, string(exp), autoplanComment) + } + + // Finally, send the pull request merged event. + pullClosedReq := GitHubPullRequestClosedEvent(t) + w = httptest.NewRecorder() + ctrl.Post(w, pullClosedReq) + responseContains(t, w, 200, "Pull request cleaned successfully") + _, _, pullClosedComment := vcsClient.VerifyWasCalled(Times(3)).CreateComment(AnyRepo(), AnyInt(), AnyString()).GetCapturedArguments() + exp, err = ioutil.ReadFile(filepath.Join(repoDir, c.ExpMergeCommentFile)) + Ok(t, err) + Equals(t, string(exp), pullClosedComment) + }) + } +} + +func setupE2E(t *testing.T) (server.EventsController, *vcsmocks.MockClientProxy, *mocks.MockGithubPullGetter, *events.FileWorkspace) { allowForkPRs := false dataDir, cleanup := TempDir(t) defer cleanup() + testRepoDir, err := filepath.Abs("testfixtures/test-repos/simple") + Ok(t, err) // Mocks. e2eVCSClient := vcsmocks.NewMockClientProxy() e2eStatusUpdater := mocks.NewMockCommitStatusUpdater() e2eGithubGetter := mocks.NewMockGithubPullGetter() e2eGitlabGetter := mocks.NewMockGitlabMergeRequestGetter() - e2eWorkspace := mocks.NewMockAtlantisWorkspace() // Real dependencies. logger := logging.NewSimpleLogger("server", nil, true, logging.Debug) @@ -66,6 +157,10 @@ func Test(t *testing.T) { projectLocker := &events.DefaultProjectLocker{ Locker: lockingClient, } + atlantisWorkspace := &events.FileWorkspace{ + DataDir: dataDir, + TestingOverrideCloneURL: testRepoDir, + } defaultTFVersion := terraformClient.Version() commandHandler := &events.CommandHandler{ @@ -85,7 +180,7 @@ func Test(t *testing.T) { ParserValidator: &yaml.ParserValidator{}, ProjectFinder: &events.DefaultProjectFinder{}, VCSClient: e2eVCSClient, - Workspace: e2eWorkspace, + Workspace: atlantisWorkspace, ProjectOperator: events.ProjectOperator{ Locker: projectLocker, LockURLGenerator: &mockLockURLGenerator{}, @@ -104,16 +199,20 @@ func Test(t *testing.T) { ApprovalOperator: runtime.ApprovalOperator{ VCSClient: e2eVCSClient, }, - Workspace: e2eWorkspace, + Workspace: atlantisWorkspace, Webhooks: &mockWebhookSender{}, }, }, } ctrl := server.EventsController{ - TestingMode: true, - CommandRunner: commandHandler, - PullCleaner: nil, + TestingMode: true, + CommandRunner: commandHandler, + PullCleaner: &events.PullClosedExecutor{ + Locker: lockingClient, + VCSClient: e2eVCSClient, + Workspace: atlantisWorkspace, + }, Logger: logger, Parser: eventParser, CommentParser: commentParser, @@ -133,32 +232,7 @@ func Test(t *testing.T) { Username: "atlantisbot", }, } - - // Test GitHub Post - req := GitHubCommentEvent(t, "atlantis plan") - w := httptest.NewRecorder() - When(e2eGithubGetter.GetPullRequest(AnyRepo(), AnyInt())).ThenReturn(GitHubPullRequestParsed(), nil) - testRepoDir, err := filepath.Abs("testfixtures/test-repos/simple") - Ok(t, err) - When(e2eWorkspace.Clone(matchers.AnyPtrToLoggingSimpleLogger(), AnyRepo(), AnyRepo(), matchers.AnyModelsPullRequest(), AnyString())).ThenReturn(testRepoDir, nil) - // Clean up .terraform and plan files when we're done. - defer func() { - os.RemoveAll(filepath.Join(testRepoDir, ".terraform")) - planFiles, _ := filepath.Glob(testRepoDir + "/*.tfplan") - for _, file := range planFiles { - os.Remove(file) - } - }() - - ctrl.Post(w, req) - responseContains(t, w, 200, "Processing...") - _, _, comment := e2eVCSClient.VerifyWasCalledOnce().CreateComment(AnyRepo(), AnyInt(), AnyString()).GetCapturedArguments() - - exp, err := ioutil.ReadFile(filepath.Join(testRepoDir, "exp-output-atlantis-plan.txt")) - fmt.Println((string(exp))) - Ok(t, err) - - Equals(t, string(exp), comment) + return ctrl, e2eVCSClient, e2eGithubGetter, atlantisWorkspace } type mockLockURLGenerator struct{} @@ -184,6 +258,26 @@ func GitHubCommentEvent(t *testing.T, comment string) *http.Request { return req } +func GitHubPullRequestOpenedEvent(t *testing.T) *http.Request { + requestJSON, err := ioutil.ReadFile(filepath.Join("testfixtures", "githubPullRequestOpenedEvent.json")) + Ok(t, err) + req, err := http.NewRequest("POST", "/events", bytes.NewBuffer(requestJSON)) + Ok(t, err) + req.Header.Set("Content-Type", "application/json") + req.Header.Set(githubHeader, "pull_request") + return req +} + +func GitHubPullRequestClosedEvent(t *testing.T) *http.Request { + requestJSON, err := ioutil.ReadFile(filepath.Join("testfixtures", "githubPullRequestClosedEvent.json")) + Ok(t, err) + req, err := http.NewRequest("POST", "/events", bytes.NewBuffer(requestJSON)) + Ok(t, err) + req.Header.Set("Content-Type", "application/json") + req.Header.Set(githubHeader, "pull_request") + return req +} + func GitHubPullRequestParsed() *github.PullRequest { return &github.PullRequest{ Number: github.Int(1), diff --git a/server/testfixtures/githubPullRequestClosedEvent.json b/server/testfixtures/githubPullRequestClosedEvent.json new file mode 100644 index 000000000..1fd568761 --- /dev/null +++ b/server/testfixtures/githubPullRequestClosedEvent.json @@ -0,0 +1,468 @@ +{ + "action": "closed", + "number": 1, + "pull_request": { + "url": "https://api.github.com/repos/runatlantis/atlantis-tests/pulls/1", + "id": 193308707, + "node_id": "MDExOlB1bGxSZXF1ZXN0MTkzMzA4NzA3", + "html_url": "https://github.com/runatlantis/atlantis-tests/pull/1", + "diff_url": "https://github.com/runatlantis/atlantis-tests/pull/1.diff", + "patch_url": "https://github.com/runatlantis/atlantis-tests/pull/1.patch", + "issue_url": "https://api.github.com/repos/runatlantis/atlantis-tests/issues/1", + "number": 1, + "state": "closed", + "locked": false, + "title": "Add new project layouts", + "user": { + "login": "runatlantis", + "id": 1034429, + "node_id": "MDQ6VXNlcjEwMzQ0Mjk=", + "avatar_url": "https://avatars1.githubusercontent.com/u/1034429?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/runatlantis", + "html_url": "https://github.com/runatlantis", + "followers_url": "https://api.github.com/users/runatlantis/followers", + "following_url": "https://api.github.com/users/runatlantis/following{/other_user}", + "gists_url": "https://api.github.com/users/runatlantis/gists{/gist_id}", + "starred_url": "https://api.github.com/users/runatlantis/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/runatlantis/subscriptions", + "organizations_url": "https://api.github.com/users/runatlantis/orgs", + "repos_url": "https://api.github.com/users/runatlantis/repos", + "events_url": "https://api.github.com/users/runatlantis/events{/privacy}", + "received_events_url": "https://api.github.com/users/runatlantis/received_events", + "type": "User", + "site_admin": false + }, + "body": "", + "created_at": "2018-06-07T12:45:41Z", + "updated_at": "2018-06-16T16:55:19Z", + "closed_at": "2018-06-16T16:55:19Z", + "merged_at": null, + "merge_commit_sha": "e96e1cea0d79f4ff07845060ade0b21ff1ffe37f", + "assignee": null, + "assignees": [ + + ], + "requested_reviewers": [ + + ], + "requested_teams": [ + + ], + "labels": [ + + ], + "milestone": null, + "commits_url": "https://api.github.com/repos/runatlantis/atlantis-tests/pulls/1/commits", + "review_comments_url": "https://api.github.com/repos/runatlantis/atlantis-tests/pulls/1/comments", + "review_comment_url": "https://api.github.com/repos/runatlantis/atlantis-tests/pulls/comments{/number}", + "comments_url": "https://api.github.com/repos/runatlantis/atlantis-tests/issues/1/comments", + "statuses_url": "https://api.github.com/repos/runatlantis/atlantis-tests/statuses/5e2d140b2d74bf61675677f01dc947ae8512e18e", + "head": { + "label": "runatlantis:atlantisyaml", + "ref": "atlantisyaml", + "sha": "5e2d140b2d74bf61675677f01dc947ae8512e18e", + "user": { + "login": "runatlantis", + "id": 1034429, + "node_id": "MDQ6VXNlcjEwMzQ0Mjk=", + "avatar_url": "https://avatars1.githubusercontent.com/u/1034429?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/runatlantis", + "html_url": "https://github.com/runatlantis", + "followers_url": "https://api.github.com/users/runatlantis/followers", + "following_url": "https://api.github.com/users/runatlantis/following{/other_user}", + "gists_url": "https://api.github.com/users/runatlantis/gists{/gist_id}", + "starred_url": "https://api.github.com/users/runatlantis/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/runatlantis/subscriptions", + "organizations_url": "https://api.github.com/users/runatlantis/orgs", + "repos_url": "https://api.github.com/users/runatlantis/repos", + "events_url": "https://api.github.com/users/runatlantis/events{/privacy}", + "received_events_url": "https://api.github.com/users/runatlantis/received_events", + "type": "User", + "site_admin": false + }, + "repo": { + "id": 136474117, + "node_id": "MDEwOlJlcG9zaXRvcnkxMzY0NzQxMTc=", + "name": "atlantis-tests", + "full_name": "runatlantis/atlantis-tests", + "owner": { + "login": "runatlantis", + "id": 1034429, + "node_id": "MDQ6VXNlcjEwMzQ0Mjk=", + "avatar_url": "https://avatars1.githubusercontent.com/u/1034429?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/runatlantis", + "html_url": "https://github.com/runatlantis", + "followers_url": "https://api.github.com/users/runatlantis/followers", + "following_url": "https://api.github.com/users/runatlantis/following{/other_user}", + "gists_url": "https://api.github.com/users/runatlantis/gists{/gist_id}", + "starred_url": "https://api.github.com/users/runatlantis/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/runatlantis/subscriptions", + "organizations_url": "https://api.github.com/users/runatlantis/orgs", + "repos_url": "https://api.github.com/users/runatlantis/repos", + "events_url": "https://api.github.com/users/runatlantis/events{/privacy}", + "received_events_url": "https://api.github.com/users/runatlantis/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/runatlantis/atlantis-tests", + "description": "A set of terraform projects that atlantis e2e tests run on.", + "fork": true, + "url": "https://api.github.com/repos/runatlantis/atlantis-tests", + "forks_url": "https://api.github.com/repos/runatlantis/atlantis-tests/forks", + "keys_url": "https://api.github.com/repos/runatlantis/atlantis-tests/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/runatlantis/atlantis-tests/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/runatlantis/atlantis-tests/teams", + "hooks_url": "https://api.github.com/repos/runatlantis/atlantis-tests/hooks", + "issue_events_url": "https://api.github.com/repos/runatlantis/atlantis-tests/issues/events{/number}", + "events_url": "https://api.github.com/repos/runatlantis/atlantis-tests/events", + "assignees_url": "https://api.github.com/repos/runatlantis/atlantis-tests/assignees{/user}", + "branches_url": "https://api.github.com/repos/runatlantis/atlantis-tests/branches{/branch}", + "tags_url": "https://api.github.com/repos/runatlantis/atlantis-tests/tags", + "blobs_url": "https://api.github.com/repos/runatlantis/atlantis-tests/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/runatlantis/atlantis-tests/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/runatlantis/atlantis-tests/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/runatlantis/atlantis-tests/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/runatlantis/atlantis-tests/statuses/{sha}", + "languages_url": "https://api.github.com/repos/runatlantis/atlantis-tests/languages", + "stargazers_url": "https://api.github.com/repos/runatlantis/atlantis-tests/stargazers", + "contributors_url": "https://api.github.com/repos/runatlantis/atlantis-tests/contributors", + "subscribers_url": "https://api.github.com/repos/runatlantis/atlantis-tests/subscribers", + "subscription_url": "https://api.github.com/repos/runatlantis/atlantis-tests/subscription", + "commits_url": "https://api.github.com/repos/runatlantis/atlantis-tests/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/runatlantis/atlantis-tests/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/runatlantis/atlantis-tests/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/runatlantis/atlantis-tests/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/runatlantis/atlantis-tests/contents/{+path}", + "compare_url": "https://api.github.com/repos/runatlantis/atlantis-tests/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/runatlantis/atlantis-tests/merges", + "archive_url": "https://api.github.com/repos/runatlantis/atlantis-tests/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/runatlantis/atlantis-tests/downloads", + "issues_url": "https://api.github.com/repos/runatlantis/atlantis-tests/issues{/number}", + "pulls_url": "https://api.github.com/repos/runatlantis/atlantis-tests/pulls{/number}", + "milestones_url": "https://api.github.com/repos/runatlantis/atlantis-tests/milestones{/number}", + "notifications_url": "https://api.github.com/repos/runatlantis/atlantis-tests/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/runatlantis/atlantis-tests/labels{/name}", + "releases_url": "https://api.github.com/repos/runatlantis/atlantis-tests/releases{/id}", + "deployments_url": "https://api.github.com/repos/runatlantis/atlantis-tests/deployments", + "created_at": "2018-06-07T12:28:23Z", + "updated_at": "2018-06-07T12:28:27Z", + "pushed_at": "2018-06-11T16:22:17Z", + "git_url": "git://github.com/runatlantis/atlantis-tests.git", + "ssh_url": "git@github.com:runatlantis/atlantis-tests.git", + "clone_url": "https://github.com/runatlantis/atlantis-tests.git", + "svn_url": "https://github.com/runatlantis/atlantis-tests", + "homepage": null, + "size": 8, + "stargazers_count": 0, + "watchers_count": 0, + "language": "HCL", + "has_issues": false, + "has_projects": true, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "open_issues_count": 1, + "license": { + "key": "other", + "name": "Other", + "spdx_id": null, + "url": null, + "node_id": "MDc6TGljZW5zZTA=" + }, + "forks": 0, + "open_issues": 1, + "watchers": 0, + "default_branch": "master" + } + }, + "base": { + "label": "runatlantis:master", + "ref": "master", + "sha": "f59a822e83b3cd193142c7624ea635a5d7894388", + "user": { + "login": "runatlantis", + "id": 1034429, + "node_id": "MDQ6VXNlcjEwMzQ0Mjk=", + "avatar_url": "https://avatars1.githubusercontent.com/u/1034429?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/runatlantis", + "html_url": "https://github.com/runatlantis", + "followers_url": "https://api.github.com/users/runatlantis/followers", + "following_url": "https://api.github.com/users/runatlantis/following{/other_user}", + "gists_url": "https://api.github.com/users/runatlantis/gists{/gist_id}", + "starred_url": "https://api.github.com/users/runatlantis/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/runatlantis/subscriptions", + "organizations_url": "https://api.github.com/users/runatlantis/orgs", + "repos_url": "https://api.github.com/users/runatlantis/repos", + "events_url": "https://api.github.com/users/runatlantis/events{/privacy}", + "received_events_url": "https://api.github.com/users/runatlantis/received_events", + "type": "User", + "site_admin": false + }, + "repo": { + "id": 136474117, + "node_id": "MDEwOlJlcG9zaXRvcnkxMzY0NzQxMTc=", + "name": "atlantis-tests", + "full_name": "runatlantis/atlantis-tests", + "owner": { + "login": "runatlantis", + "id": 1034429, + "node_id": "MDQ6VXNlcjEwMzQ0Mjk=", + "avatar_url": "https://avatars1.githubusercontent.com/u/1034429?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/runatlantis", + "html_url": "https://github.com/runatlantis", + "followers_url": "https://api.github.com/users/runatlantis/followers", + "following_url": "https://api.github.com/users/runatlantis/following{/other_user}", + "gists_url": "https://api.github.com/users/runatlantis/gists{/gist_id}", + "starred_url": "https://api.github.com/users/runatlantis/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/runatlantis/subscriptions", + "organizations_url": "https://api.github.com/users/runatlantis/orgs", + "repos_url": "https://api.github.com/users/runatlantis/repos", + "events_url": "https://api.github.com/users/runatlantis/events{/privacy}", + "received_events_url": "https://api.github.com/users/runatlantis/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/runatlantis/atlantis-tests", + "description": "A set of terraform projects that atlantis e2e tests run on.", + "fork": true, + "url": "https://api.github.com/repos/runatlantis/atlantis-tests", + "forks_url": "https://api.github.com/repos/runatlantis/atlantis-tests/forks", + "keys_url": "https://api.github.com/repos/runatlantis/atlantis-tests/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/runatlantis/atlantis-tests/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/runatlantis/atlantis-tests/teams", + "hooks_url": "https://api.github.com/repos/runatlantis/atlantis-tests/hooks", + "issue_events_url": "https://api.github.com/repos/runatlantis/atlantis-tests/issues/events{/number}", + "events_url": "https://api.github.com/repos/runatlantis/atlantis-tests/events", + "assignees_url": "https://api.github.com/repos/runatlantis/atlantis-tests/assignees{/user}", + "branches_url": "https://api.github.com/repos/runatlantis/atlantis-tests/branches{/branch}", + "tags_url": "https://api.github.com/repos/runatlantis/atlantis-tests/tags", + "blobs_url": "https://api.github.com/repos/runatlantis/atlantis-tests/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/runatlantis/atlantis-tests/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/runatlantis/atlantis-tests/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/runatlantis/atlantis-tests/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/runatlantis/atlantis-tests/statuses/{sha}", + "languages_url": "https://api.github.com/repos/runatlantis/atlantis-tests/languages", + "stargazers_url": "https://api.github.com/repos/runatlantis/atlantis-tests/stargazers", + "contributors_url": "https://api.github.com/repos/runatlantis/atlantis-tests/contributors", + "subscribers_url": "https://api.github.com/repos/runatlantis/atlantis-tests/subscribers", + "subscription_url": "https://api.github.com/repos/runatlantis/atlantis-tests/subscription", + "commits_url": "https://api.github.com/repos/runatlantis/atlantis-tests/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/runatlantis/atlantis-tests/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/runatlantis/atlantis-tests/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/runatlantis/atlantis-tests/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/runatlantis/atlantis-tests/contents/{+path}", + "compare_url": "https://api.github.com/repos/runatlantis/atlantis-tests/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/runatlantis/atlantis-tests/merges", + "archive_url": "https://api.github.com/repos/runatlantis/atlantis-tests/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/runatlantis/atlantis-tests/downloads", + "issues_url": "https://api.github.com/repos/runatlantis/atlantis-tests/issues{/number}", + "pulls_url": "https://api.github.com/repos/runatlantis/atlantis-tests/pulls{/number}", + "milestones_url": "https://api.github.com/repos/runatlantis/atlantis-tests/milestones{/number}", + "notifications_url": "https://api.github.com/repos/runatlantis/atlantis-tests/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/runatlantis/atlantis-tests/labels{/name}", + "releases_url": "https://api.github.com/repos/runatlantis/atlantis-tests/releases{/id}", + "deployments_url": "https://api.github.com/repos/runatlantis/atlantis-tests/deployments", + "created_at": "2018-06-07T12:28:23Z", + "updated_at": "2018-06-07T12:28:27Z", + "pushed_at": "2018-06-11T16:22:17Z", + "git_url": "git://github.com/runatlantis/atlantis-tests.git", + "ssh_url": "git@github.com:runatlantis/atlantis-tests.git", + "clone_url": "https://github.com/runatlantis/atlantis-tests.git", + "svn_url": "https://github.com/runatlantis/atlantis-tests", + "homepage": null, + "size": 8, + "stargazers_count": 0, + "watchers_count": 0, + "language": "HCL", + "has_issues": false, + "has_projects": true, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "open_issues_count": 1, + "license": { + "key": "other", + "name": "Other", + "spdx_id": null, + "url": null, + "node_id": "MDc6TGljZW5zZTA=" + }, + "forks": 0, + "open_issues": 1, + "watchers": 0, + "default_branch": "master" + } + }, + "_links": { + "self": { + "href": "https://api.github.com/repos/runatlantis/atlantis-tests/pulls/1" + }, + "html": { + "href": "https://github.com/runatlantis/atlantis-tests/pull/1" + }, + "issue": { + "href": "https://api.github.com/repos/runatlantis/atlantis-tests/issues/1" + }, + "comments": { + "href": "https://api.github.com/repos/runatlantis/atlantis-tests/issues/1/comments" + }, + "review_comments": { + "href": "https://api.github.com/repos/runatlantis/atlantis-tests/pulls/1/comments" + }, + "review_comment": { + "href": "https://api.github.com/repos/runatlantis/atlantis-tests/pulls/comments{/number}" + }, + "commits": { + "href": "https://api.github.com/repos/runatlantis/atlantis-tests/pulls/1/commits" + }, + "statuses": { + "href": "https://api.github.com/repos/runatlantis/atlantis-tests/statuses/5e2d140b2d74bf61675677f01dc947ae8512e18e" + } + }, + "author_association": "OWNER", + "merged": false, + "mergeable": true, + "rebaseable": true, + "mergeable_state": "clean", + "merged_by": null, + "comments": 62, + "review_comments": 0, + "maintainer_can_modify": false, + "commits": 3, + "additions": 198, + "deletions": 8, + "changed_files": 24 + }, + "repository": { + "id": 136474117, + "node_id": "MDEwOlJlcG9zaXRvcnkxMzY0NzQxMTc=", + "name": "atlantis-tests", + "full_name": "runatlantis/atlantis-tests", + "owner": { + "login": "runatlantis", + "id": 1034429, + "node_id": "MDQ6VXNlcjEwMzQ0Mjk=", + "avatar_url": "https://avatars1.githubusercontent.com/u/1034429?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/runatlantis", + "html_url": "https://github.com/runatlantis", + "followers_url": "https://api.github.com/users/runatlantis/followers", + "following_url": "https://api.github.com/users/runatlantis/following{/other_user}", + "gists_url": "https://api.github.com/users/runatlantis/gists{/gist_id}", + "starred_url": "https://api.github.com/users/runatlantis/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/runatlantis/subscriptions", + "organizations_url": "https://api.github.com/users/runatlantis/orgs", + "repos_url": "https://api.github.com/users/runatlantis/repos", + "events_url": "https://api.github.com/users/runatlantis/events{/privacy}", + "received_events_url": "https://api.github.com/users/runatlantis/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/runatlantis/atlantis-tests", + "description": "A set of terraform projects that atlantis e2e tests run on.", + "fork": true, + "url": "https://api.github.com/repos/runatlantis/atlantis-tests", + "forks_url": "https://api.github.com/repos/runatlantis/atlantis-tests/forks", + "keys_url": "https://api.github.com/repos/runatlantis/atlantis-tests/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/runatlantis/atlantis-tests/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/runatlantis/atlantis-tests/teams", + "hooks_url": "https://api.github.com/repos/runatlantis/atlantis-tests/hooks", + "issue_events_url": "https://api.github.com/repos/runatlantis/atlantis-tests/issues/events{/number}", + "events_url": "https://api.github.com/repos/runatlantis/atlantis-tests/events", + "assignees_url": "https://api.github.com/repos/runatlantis/atlantis-tests/assignees{/user}", + "branches_url": "https://api.github.com/repos/runatlantis/atlantis-tests/branches{/branch}", + "tags_url": "https://api.github.com/repos/runatlantis/atlantis-tests/tags", + "blobs_url": "https://api.github.com/repos/runatlantis/atlantis-tests/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/runatlantis/atlantis-tests/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/runatlantis/atlantis-tests/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/runatlantis/atlantis-tests/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/runatlantis/atlantis-tests/statuses/{sha}", + "languages_url": "https://api.github.com/repos/runatlantis/atlantis-tests/languages", + "stargazers_url": "https://api.github.com/repos/runatlantis/atlantis-tests/stargazers", + "contributors_url": "https://api.github.com/repos/runatlantis/atlantis-tests/contributors", + "subscribers_url": "https://api.github.com/repos/runatlantis/atlantis-tests/subscribers", + "subscription_url": "https://api.github.com/repos/runatlantis/atlantis-tests/subscription", + "commits_url": "https://api.github.com/repos/runatlantis/atlantis-tests/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/runatlantis/atlantis-tests/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/runatlantis/atlantis-tests/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/runatlantis/atlantis-tests/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/runatlantis/atlantis-tests/contents/{+path}", + "compare_url": "https://api.github.com/repos/runatlantis/atlantis-tests/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/runatlantis/atlantis-tests/merges", + "archive_url": "https://api.github.com/repos/runatlantis/atlantis-tests/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/runatlantis/atlantis-tests/downloads", + "issues_url": "https://api.github.com/repos/runatlantis/atlantis-tests/issues{/number}", + "pulls_url": "https://api.github.com/repos/runatlantis/atlantis-tests/pulls{/number}", + "milestones_url": "https://api.github.com/repos/runatlantis/atlantis-tests/milestones{/number}", + "notifications_url": "https://api.github.com/repos/runatlantis/atlantis-tests/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/runatlantis/atlantis-tests/labels{/name}", + "releases_url": "https://api.github.com/repos/runatlantis/atlantis-tests/releases{/id}", + "deployments_url": "https://api.github.com/repos/runatlantis/atlantis-tests/deployments", + "created_at": "2018-06-07T12:28:23Z", + "updated_at": "2018-06-07T12:28:27Z", + "pushed_at": "2018-06-11T16:22:17Z", + "git_url": "git://github.com/runatlantis/atlantis-tests.git", + "ssh_url": "git@github.com:runatlantis/atlantis-tests.git", + "clone_url": "https://github.com/runatlantis/atlantis-tests.git", + "svn_url": "https://github.com/runatlantis/atlantis-tests", + "homepage": null, + "size": 8, + "stargazers_count": 0, + "watchers_count": 0, + "language": "HCL", + "has_issues": false, + "has_projects": true, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "open_issues_count": 1, + "license": { + "key": "other", + "name": "Other", + "spdx_id": null, + "url": null, + "node_id": "MDc6TGljZW5zZTA=" + }, + "forks": 0, + "open_issues": 1, + "watchers": 0, + "default_branch": "master" + }, + "sender": { + "login": "runatlantis", + "id": 1034429, + "node_id": "MDQ6VXNlcjEwMzQ0Mjk=", + "avatar_url": "https://avatars1.githubusercontent.com/u/1034429?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/runatlantis", + "html_url": "https://github.com/runatlantis", + "followers_url": "https://api.github.com/users/runatlantis/followers", + "following_url": "https://api.github.com/users/runatlantis/following{/other_user}", + "gists_url": "https://api.github.com/users/runatlantis/gists{/gist_id}", + "starred_url": "https://api.github.com/users/runatlantis/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/runatlantis/subscriptions", + "organizations_url": "https://api.github.com/users/runatlantis/orgs", + "repos_url": "https://api.github.com/users/runatlantis/repos", + "events_url": "https://api.github.com/users/runatlantis/events{/privacy}", + "received_events_url": "https://api.github.com/users/runatlantis/received_events", + "type": "User", + "site_admin": false + } +} \ No newline at end of file diff --git a/server/testfixtures/githubPullRequestOpenedEvent.json b/server/testfixtures/githubPullRequestOpenedEvent.json new file mode 100644 index 000000000..0b969438e --- /dev/null +++ b/server/testfixtures/githubPullRequestOpenedEvent.json @@ -0,0 +1,468 @@ +{ + "action": "opened", + "number": 2, + "pull_request": { + "url": "https://api.github.com/repos/runatlantis/atlantis-tests/pulls/2", + "id": 194034250, + "node_id": "MDExOlB1bGxSZXF1ZXN0MTk0MDM0MjUw", + "html_url": "https://github.com/runatlantis/atlantis-tests/pull/2", + "diff_url": "https://github.com/runatlantis/atlantis-tests/pull/2.diff", + "patch_url": "https://github.com/runatlantis/atlantis-tests/pull/2.patch", + "issue_url": "https://api.github.com/repos/runatlantis/atlantis-tests/issues/2", + "number": 2, + "state": "open", + "locked": false, + "title": "Noyaml", + "user": { + "login": "runatlantis", + "id": 1034429, + "node_id": "MDQ6VXNlcjEwMzQ0Mjk=", + "avatar_url": "https://avatars1.githubusercontent.com/u/1034429?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/runatlantis", + "html_url": "https://github.com/runatlantis", + "followers_url": "https://api.github.com/users/runatlantis/followers", + "following_url": "https://api.github.com/users/runatlantis/following{/other_user}", + "gists_url": "https://api.github.com/users/runatlantis/gists{/gist_id}", + "starred_url": "https://api.github.com/users/runatlantis/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/runatlantis/subscriptions", + "organizations_url": "https://api.github.com/users/runatlantis/orgs", + "repos_url": "https://api.github.com/users/runatlantis/repos", + "events_url": "https://api.github.com/users/runatlantis/events{/privacy}", + "received_events_url": "https://api.github.com/users/runatlantis/received_events", + "type": "User", + "site_admin": false + }, + "body": "", + "created_at": "2018-06-11T16:22:16Z", + "updated_at": "2018-06-11T16:22:16Z", + "closed_at": null, + "merged_at": null, + "merge_commit_sha": null, + "assignee": null, + "assignees": [ + + ], + "requested_reviewers": [ + + ], + "requested_teams": [ + + ], + "labels": [ + + ], + "milestone": null, + "commits_url": "https://api.github.com/repos/runatlantis/atlantis-tests/pulls/2/commits", + "review_comments_url": "https://api.github.com/repos/runatlantis/atlantis-tests/pulls/2/comments", + "review_comment_url": "https://api.github.com/repos/runatlantis/atlantis-tests/pulls/comments{/number}", + "comments_url": "https://api.github.com/repos/runatlantis/atlantis-tests/issues/2/comments", + "statuses_url": "https://api.github.com/repos/runatlantis/atlantis-tests/statuses/c31fd9ea6f557ad2ea659944c3844a059b83bc5d", + "head": { + "label": "runatlantis:noyaml", + "ref": "noyaml", + "sha": "c31fd9ea6f557ad2ea659944c3844a059b83bc5d", + "user": { + "login": "runatlantis", + "id": 1034429, + "node_id": "MDQ6VXNlcjEwMzQ0Mjk=", + "avatar_url": "https://avatars1.githubusercontent.com/u/1034429?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/runatlantis", + "html_url": "https://github.com/runatlantis", + "followers_url": "https://api.github.com/users/runatlantis/followers", + "following_url": "https://api.github.com/users/runatlantis/following{/other_user}", + "gists_url": "https://api.github.com/users/runatlantis/gists{/gist_id}", + "starred_url": "https://api.github.com/users/runatlantis/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/runatlantis/subscriptions", + "organizations_url": "https://api.github.com/users/runatlantis/orgs", + "repos_url": "https://api.github.com/users/runatlantis/repos", + "events_url": "https://api.github.com/users/runatlantis/events{/privacy}", + "received_events_url": "https://api.github.com/users/runatlantis/received_events", + "type": "User", + "site_admin": false + }, + "repo": { + "id": 136474117, + "node_id": "MDEwOlJlcG9zaXRvcnkxMzY0NzQxMTc=", + "name": "atlantis-tests", + "full_name": "runatlantis/atlantis-tests", + "owner": { + "login": "runatlantis", + "id": 1034429, + "node_id": "MDQ6VXNlcjEwMzQ0Mjk=", + "avatar_url": "https://avatars1.githubusercontent.com/u/1034429?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/runatlantis", + "html_url": "https://github.com/runatlantis", + "followers_url": "https://api.github.com/users/runatlantis/followers", + "following_url": "https://api.github.com/users/runatlantis/following{/other_user}", + "gists_url": "https://api.github.com/users/runatlantis/gists{/gist_id}", + "starred_url": "https://api.github.com/users/runatlantis/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/runatlantis/subscriptions", + "organizations_url": "https://api.github.com/users/runatlantis/orgs", + "repos_url": "https://api.github.com/users/runatlantis/repos", + "events_url": "https://api.github.com/users/runatlantis/events{/privacy}", + "received_events_url": "https://api.github.com/users/runatlantis/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/runatlantis/atlantis-tests", + "description": "A set of terraform projects that atlantis e2e tests run on.", + "fork": true, + "url": "https://api.github.com/repos/runatlantis/atlantis-tests", + "forks_url": "https://api.github.com/repos/runatlantis/atlantis-tests/forks", + "keys_url": "https://api.github.com/repos/runatlantis/atlantis-tests/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/runatlantis/atlantis-tests/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/runatlantis/atlantis-tests/teams", + "hooks_url": "https://api.github.com/repos/runatlantis/atlantis-tests/hooks", + "issue_events_url": "https://api.github.com/repos/runatlantis/atlantis-tests/issues/events{/number}", + "events_url": "https://api.github.com/repos/runatlantis/atlantis-tests/events", + "assignees_url": "https://api.github.com/repos/runatlantis/atlantis-tests/assignees{/user}", + "branches_url": "https://api.github.com/repos/runatlantis/atlantis-tests/branches{/branch}", + "tags_url": "https://api.github.com/repos/runatlantis/atlantis-tests/tags", + "blobs_url": "https://api.github.com/repos/runatlantis/atlantis-tests/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/runatlantis/atlantis-tests/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/runatlantis/atlantis-tests/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/runatlantis/atlantis-tests/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/runatlantis/atlantis-tests/statuses/{sha}", + "languages_url": "https://api.github.com/repos/runatlantis/atlantis-tests/languages", + "stargazers_url": "https://api.github.com/repos/runatlantis/atlantis-tests/stargazers", + "contributors_url": "https://api.github.com/repos/runatlantis/atlantis-tests/contributors", + "subscribers_url": "https://api.github.com/repos/runatlantis/atlantis-tests/subscribers", + "subscription_url": "https://api.github.com/repos/runatlantis/atlantis-tests/subscription", + "commits_url": "https://api.github.com/repos/runatlantis/atlantis-tests/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/runatlantis/atlantis-tests/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/runatlantis/atlantis-tests/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/runatlantis/atlantis-tests/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/runatlantis/atlantis-tests/contents/{+path}", + "compare_url": "https://api.github.com/repos/runatlantis/atlantis-tests/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/runatlantis/atlantis-tests/merges", + "archive_url": "https://api.github.com/repos/runatlantis/atlantis-tests/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/runatlantis/atlantis-tests/downloads", + "issues_url": "https://api.github.com/repos/runatlantis/atlantis-tests/issues{/number}", + "pulls_url": "https://api.github.com/repos/runatlantis/atlantis-tests/pulls{/number}", + "milestones_url": "https://api.github.com/repos/runatlantis/atlantis-tests/milestones{/number}", + "notifications_url": "https://api.github.com/repos/runatlantis/atlantis-tests/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/runatlantis/atlantis-tests/labels{/name}", + "releases_url": "https://api.github.com/repos/runatlantis/atlantis-tests/releases{/id}", + "deployments_url": "https://api.github.com/repos/runatlantis/atlantis-tests/deployments", + "created_at": "2018-06-07T12:28:23Z", + "updated_at": "2018-06-07T12:28:27Z", + "pushed_at": "2018-06-11T16:22:09Z", + "git_url": "git://github.com/runatlantis/atlantis-tests.git", + "ssh_url": "git@github.com:runatlantis/atlantis-tests.git", + "clone_url": "https://github.com/runatlantis/atlantis-tests.git", + "svn_url": "https://github.com/runatlantis/atlantis-tests", + "homepage": null, + "size": 7, + "stargazers_count": 0, + "watchers_count": 0, + "language": "HCL", + "has_issues": false, + "has_projects": true, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "open_issues_count": 2, + "license": { + "key": "other", + "name": "Other", + "spdx_id": null, + "url": null, + "node_id": "MDc6TGljZW5zZTA=" + }, + "forks": 0, + "open_issues": 2, + "watchers": 0, + "default_branch": "master" + } + }, + "base": { + "label": "runatlantis:master", + "ref": "master", + "sha": "f59a822e83b3cd193142c7624ea635a5d7894388", + "user": { + "login": "runatlantis", + "id": 1034429, + "node_id": "MDQ6VXNlcjEwMzQ0Mjk=", + "avatar_url": "https://avatars1.githubusercontent.com/u/1034429?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/runatlantis", + "html_url": "https://github.com/runatlantis", + "followers_url": "https://api.github.com/users/runatlantis/followers", + "following_url": "https://api.github.com/users/runatlantis/following{/other_user}", + "gists_url": "https://api.github.com/users/runatlantis/gists{/gist_id}", + "starred_url": "https://api.github.com/users/runatlantis/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/runatlantis/subscriptions", + "organizations_url": "https://api.github.com/users/runatlantis/orgs", + "repos_url": "https://api.github.com/users/runatlantis/repos", + "events_url": "https://api.github.com/users/runatlantis/events{/privacy}", + "received_events_url": "https://api.github.com/users/runatlantis/received_events", + "type": "User", + "site_admin": false + }, + "repo": { + "id": 136474117, + "node_id": "MDEwOlJlcG9zaXRvcnkxMzY0NzQxMTc=", + "name": "atlantis-tests", + "full_name": "runatlantis/atlantis-tests", + "owner": { + "login": "runatlantis", + "id": 1034429, + "node_id": "MDQ6VXNlcjEwMzQ0Mjk=", + "avatar_url": "https://avatars1.githubusercontent.com/u/1034429?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/runatlantis", + "html_url": "https://github.com/runatlantis", + "followers_url": "https://api.github.com/users/runatlantis/followers", + "following_url": "https://api.github.com/users/runatlantis/following{/other_user}", + "gists_url": "https://api.github.com/users/runatlantis/gists{/gist_id}", + "starred_url": "https://api.github.com/users/runatlantis/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/runatlantis/subscriptions", + "organizations_url": "https://api.github.com/users/runatlantis/orgs", + "repos_url": "https://api.github.com/users/runatlantis/repos", + "events_url": "https://api.github.com/users/runatlantis/events{/privacy}", + "received_events_url": "https://api.github.com/users/runatlantis/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/runatlantis/atlantis-tests", + "description": "A set of terraform projects that atlantis e2e tests run on.", + "fork": true, + "url": "https://api.github.com/repos/runatlantis/atlantis-tests", + "forks_url": "https://api.github.com/repos/runatlantis/atlantis-tests/forks", + "keys_url": "https://api.github.com/repos/runatlantis/atlantis-tests/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/runatlantis/atlantis-tests/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/runatlantis/atlantis-tests/teams", + "hooks_url": "https://api.github.com/repos/runatlantis/atlantis-tests/hooks", + "issue_events_url": "https://api.github.com/repos/runatlantis/atlantis-tests/issues/events{/number}", + "events_url": "https://api.github.com/repos/runatlantis/atlantis-tests/events", + "assignees_url": "https://api.github.com/repos/runatlantis/atlantis-tests/assignees{/user}", + "branches_url": "https://api.github.com/repos/runatlantis/atlantis-tests/branches{/branch}", + "tags_url": "https://api.github.com/repos/runatlantis/atlantis-tests/tags", + "blobs_url": "https://api.github.com/repos/runatlantis/atlantis-tests/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/runatlantis/atlantis-tests/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/runatlantis/atlantis-tests/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/runatlantis/atlantis-tests/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/runatlantis/atlantis-tests/statuses/{sha}", + "languages_url": "https://api.github.com/repos/runatlantis/atlantis-tests/languages", + "stargazers_url": "https://api.github.com/repos/runatlantis/atlantis-tests/stargazers", + "contributors_url": "https://api.github.com/repos/runatlantis/atlantis-tests/contributors", + "subscribers_url": "https://api.github.com/repos/runatlantis/atlantis-tests/subscribers", + "subscription_url": "https://api.github.com/repos/runatlantis/atlantis-tests/subscription", + "commits_url": "https://api.github.com/repos/runatlantis/atlantis-tests/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/runatlantis/atlantis-tests/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/runatlantis/atlantis-tests/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/runatlantis/atlantis-tests/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/runatlantis/atlantis-tests/contents/{+path}", + "compare_url": "https://api.github.com/repos/runatlantis/atlantis-tests/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/runatlantis/atlantis-tests/merges", + "archive_url": "https://api.github.com/repos/runatlantis/atlantis-tests/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/runatlantis/atlantis-tests/downloads", + "issues_url": "https://api.github.com/repos/runatlantis/atlantis-tests/issues{/number}", + "pulls_url": "https://api.github.com/repos/runatlantis/atlantis-tests/pulls{/number}", + "milestones_url": "https://api.github.com/repos/runatlantis/atlantis-tests/milestones{/number}", + "notifications_url": "https://api.github.com/repos/runatlantis/atlantis-tests/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/runatlantis/atlantis-tests/labels{/name}", + "releases_url": "https://api.github.com/repos/runatlantis/atlantis-tests/releases{/id}", + "deployments_url": "https://api.github.com/repos/runatlantis/atlantis-tests/deployments", + "created_at": "2018-06-07T12:28:23Z", + "updated_at": "2018-06-07T12:28:27Z", + "pushed_at": "2018-06-11T16:22:09Z", + "git_url": "git://github.com/runatlantis/atlantis-tests.git", + "ssh_url": "git@github.com:runatlantis/atlantis-tests.git", + "clone_url": "https://github.com/runatlantis/atlantis-tests.git", + "svn_url": "https://github.com/runatlantis/atlantis-tests", + "homepage": null, + "size": 7, + "stargazers_count": 0, + "watchers_count": 0, + "language": "HCL", + "has_issues": false, + "has_projects": true, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "open_issues_count": 2, + "license": { + "key": "other", + "name": "Other", + "spdx_id": null, + "url": null, + "node_id": "MDc6TGljZW5zZTA=" + }, + "forks": 0, + "open_issues": 2, + "watchers": 0, + "default_branch": "master" + } + }, + "_links": { + "self": { + "href": "https://api.github.com/repos/runatlantis/atlantis-tests/pulls/2" + }, + "html": { + "href": "https://github.com/runatlantis/atlantis-tests/pull/2" + }, + "issue": { + "href": "https://api.github.com/repos/runatlantis/atlantis-tests/issues/2" + }, + "comments": { + "href": "https://api.github.com/repos/runatlantis/atlantis-tests/issues/2/comments" + }, + "review_comments": { + "href": "https://api.github.com/repos/runatlantis/atlantis-tests/pulls/2/comments" + }, + "review_comment": { + "href": "https://api.github.com/repos/runatlantis/atlantis-tests/pulls/comments{/number}" + }, + "commits": { + "href": "https://api.github.com/repos/runatlantis/atlantis-tests/pulls/2/commits" + }, + "statuses": { + "href": "https://api.github.com/repos/runatlantis/atlantis-tests/statuses/c31fd9ea6f557ad2ea659944c3844a059b83bc5d" + } + }, + "author_association": "OWNER", + "merged": false, + "mergeable": null, + "rebaseable": null, + "mergeable_state": "unknown", + "merged_by": null, + "comments": 0, + "review_comments": 0, + "maintainer_can_modify": false, + "commits": 5, + "additions": 181, + "deletions": 8, + "changed_files": 23 + }, + "repository": { + "id": 136474117, + "node_id": "MDEwOlJlcG9zaXRvcnkxMzY0NzQxMTc=", + "name": "atlantis-tests", + "full_name": "runatlantis/atlantis-tests", + "owner": { + "login": "runatlantis", + "id": 1034429, + "node_id": "MDQ6VXNlcjEwMzQ0Mjk=", + "avatar_url": "https://avatars1.githubusercontent.com/u/1034429?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/runatlantis", + "html_url": "https://github.com/runatlantis", + "followers_url": "https://api.github.com/users/runatlantis/followers", + "following_url": "https://api.github.com/users/runatlantis/following{/other_user}", + "gists_url": "https://api.github.com/users/runatlantis/gists{/gist_id}", + "starred_url": "https://api.github.com/users/runatlantis/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/runatlantis/subscriptions", + "organizations_url": "https://api.github.com/users/runatlantis/orgs", + "repos_url": "https://api.github.com/users/runatlantis/repos", + "events_url": "https://api.github.com/users/runatlantis/events{/privacy}", + "received_events_url": "https://api.github.com/users/runatlantis/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/runatlantis/atlantis-tests", + "description": "A set of terraform projects that atlantis e2e tests run on.", + "fork": true, + "url": "https://api.github.com/repos/runatlantis/atlantis-tests", + "forks_url": "https://api.github.com/repos/runatlantis/atlantis-tests/forks", + "keys_url": "https://api.github.com/repos/runatlantis/atlantis-tests/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/runatlantis/atlantis-tests/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/runatlantis/atlantis-tests/teams", + "hooks_url": "https://api.github.com/repos/runatlantis/atlantis-tests/hooks", + "issue_events_url": "https://api.github.com/repos/runatlantis/atlantis-tests/issues/events{/number}", + "events_url": "https://api.github.com/repos/runatlantis/atlantis-tests/events", + "assignees_url": "https://api.github.com/repos/runatlantis/atlantis-tests/assignees{/user}", + "branches_url": "https://api.github.com/repos/runatlantis/atlantis-tests/branches{/branch}", + "tags_url": "https://api.github.com/repos/runatlantis/atlantis-tests/tags", + "blobs_url": "https://api.github.com/repos/runatlantis/atlantis-tests/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/runatlantis/atlantis-tests/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/runatlantis/atlantis-tests/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/runatlantis/atlantis-tests/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/runatlantis/atlantis-tests/statuses/{sha}", + "languages_url": "https://api.github.com/repos/runatlantis/atlantis-tests/languages", + "stargazers_url": "https://api.github.com/repos/runatlantis/atlantis-tests/stargazers", + "contributors_url": "https://api.github.com/repos/runatlantis/atlantis-tests/contributors", + "subscribers_url": "https://api.github.com/repos/runatlantis/atlantis-tests/subscribers", + "subscription_url": "https://api.github.com/repos/runatlantis/atlantis-tests/subscription", + "commits_url": "https://api.github.com/repos/runatlantis/atlantis-tests/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/runatlantis/atlantis-tests/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/runatlantis/atlantis-tests/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/runatlantis/atlantis-tests/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/runatlantis/atlantis-tests/contents/{+path}", + "compare_url": "https://api.github.com/repos/runatlantis/atlantis-tests/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/runatlantis/atlantis-tests/merges", + "archive_url": "https://api.github.com/repos/runatlantis/atlantis-tests/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/runatlantis/atlantis-tests/downloads", + "issues_url": "https://api.github.com/repos/runatlantis/atlantis-tests/issues{/number}", + "pulls_url": "https://api.github.com/repos/runatlantis/atlantis-tests/pulls{/number}", + "milestones_url": "https://api.github.com/repos/runatlantis/atlantis-tests/milestones{/number}", + "notifications_url": "https://api.github.com/repos/runatlantis/atlantis-tests/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/runatlantis/atlantis-tests/labels{/name}", + "releases_url": "https://api.github.com/repos/runatlantis/atlantis-tests/releases{/id}", + "deployments_url": "https://api.github.com/repos/runatlantis/atlantis-tests/deployments", + "created_at": "2018-06-07T12:28:23Z", + "updated_at": "2018-06-07T12:28:27Z", + "pushed_at": "2018-06-11T16:22:09Z", + "git_url": "git://github.com/runatlantis/atlantis-tests.git", + "ssh_url": "git@github.com:runatlantis/atlantis-tests.git", + "clone_url": "https://github.com/runatlantis/atlantis-tests.git", + "svn_url": "https://github.com/runatlantis/atlantis-tests", + "homepage": null, + "size": 7, + "stargazers_count": 0, + "watchers_count": 0, + "language": "HCL", + "has_issues": false, + "has_projects": true, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "open_issues_count": 2, + "license": { + "key": "other", + "name": "Other", + "spdx_id": null, + "url": null, + "node_id": "MDc6TGljZW5zZTA=" + }, + "forks": 0, + "open_issues": 2, + "watchers": 0, + "default_branch": "master" + }, + "sender": { + "login": "runatlantis", + "id": 1034429, + "node_id": "MDQ6VXNlcjEwMzQ0Mjk=", + "avatar_url": "https://avatars1.githubusercontent.com/u/1034429?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/runatlantis", + "html_url": "https://github.com/runatlantis", + "followers_url": "https://api.github.com/users/runatlantis/followers", + "following_url": "https://api.github.com/users/runatlantis/following{/other_user}", + "gists_url": "https://api.github.com/users/runatlantis/gists{/gist_id}", + "starred_url": "https://api.github.com/users/runatlantis/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/runatlantis/subscriptions", + "organizations_url": "https://api.github.com/users/runatlantis/orgs", + "repos_url": "https://api.github.com/users/runatlantis/repos", + "events_url": "https://api.github.com/users/runatlantis/events{/privacy}", + "received_events_url": "https://api.github.com/users/runatlantis/received_events", + "type": "User", + "site_admin": false + } +} \ No newline at end of file diff --git a/server/testfixtures/test-repos/simple/.gitkeep b/server/testfixtures/test-repos/simple/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/server/testfixtures/test-repos/simple/exp-output-apply.txt b/server/testfixtures/test-repos/simple/exp-output-apply.txt new file mode 100644 index 000000000..4d254afae --- /dev/null +++ b/server/testfixtures/test-repos/simple/exp-output-apply.txt @@ -0,0 +1,13 @@ +Ran Apply in dir: `.` workspace: `default` +```diff +null_resource.simple: Creating... +null_resource.simple: Creation complete after 0s (ID: ******************) + +Apply complete! Resources: 1 added, 0 changed, 0 destroyed. + +Outputs: + +this = default + +``` + diff --git a/server/testfixtures/test-repos/simple/exp-output-autoplan.txt b/server/testfixtures/test-repos/simple/exp-output-autoplan.txt new file mode 100644 index 000000000..15a712c42 --- /dev/null +++ b/server/testfixtures/test-repos/simple/exp-output-autoplan.txt @@ -0,0 +1,23 @@ +Ran Plan in dir: `.` workspace: `default` +```diff +Refreshing Terraform state in-memory prior to plan... +The refreshed state will be used to calculate this plan, but will not be +persisted to local or remote state storage. + + +------------------------------------------------------------------------ + +An execution plan has been generated and is shown below. +Resource actions are indicated with the following symbols: + + create + +Terraform will perform the following actions: + ++ null_resource.simple + id: +Plan: 1 to add, 0 to change, 0 to destroy. + +``` + +* To **discard** this plan click [here](lock-url). + diff --git a/server/testfixtures/test-repos/simple/exp-output-merge.txt b/server/testfixtures/test-repos/simple/exp-output-merge.txt new file mode 100644 index 000000000..c09b916bd --- /dev/null +++ b/server/testfixtures/test-repos/simple/exp-output-merge.txt @@ -0,0 +1,3 @@ +Locks and plans deleted for the projects and workspaces modified in this pull request: + +- path: `runatlantis/atlantis-tests/.` workspace: `default` \ No newline at end of file diff --git a/server/testfixtures/test-repos/simple/main.tf b/server/testfixtures/test-repos/simple/main.tf index 648c412e1..028fbb213 100644 --- a/server/testfixtures/test-repos/simple/main.tf +++ b/server/testfixtures/test-repos/simple/main.tf @@ -1,3 +1,11 @@ resource "null_resource" "simple" { count = 1 +} + +variable "var" { + default = "default" +} + +output "this" { + value = "${var.var}" } \ No newline at end of file