Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Better determine number of expected comments and webhooks in e2e test #3907

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 29 additions & 3 deletions server/controllers/events/events_controller_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,28 @@ func TestGitHubWorkflow(t *testing.T) {
ExpAllowResponseCommentBack bool
// ExpParseFailedCount represents how many times test sends invalid commands
ExpParseFailedCount int
// ExpNoLocksToDelete whether we expect that there are no locks at the end to delete
ExpNoLocksToDelete bool
}{
{
Description: "no comment or change",
RepoDir: "simple",
ModifiedFiles: []string{},
Comments: []string{},
ExpReplies: [][]string{},
ExpNoLocksToDelete: true,
},
{
Description: "no comment",
RepoDir: "simple",
ModifiedFiles: []string{"main.tf"},
Comments: []string{},
ExpReplies: [][]string{
{"exp-output-autoplan.txt"},
{"exp-output-merge.txt"},
},
ExpAutoplan: true,
},
{
Description: "simple",
RepoDir: "simple",
Expand Down Expand Up @@ -208,6 +229,7 @@ func TestGitHubWorkflow(t *testing.T) {
},
ExpAllowResponseCommentBack: true,
ExpParseFailedCount: 1,
ExpNoLocksToDelete: true,
},
{
Description: "simple with atlantis.yaml",
Expand Down Expand Up @@ -618,9 +640,13 @@ func TestGitHubWorkflow(t *testing.T) {

// Now we're ready to verify Atlantis made all the comments back (or
// replies) that we expect. We expect each plan to have 1 comment,
// and apply have 1 for each comment plus one for the locks deleted at the
// end.
expNumReplies := len(c.Comments) + 1 - c.ExpParseFailedCount
// and apply have 1 for each comment
expNumReplies := len(c.Comments)

// If there are locks to delete at the end, that will take a comment
if !c.ExpNoLocksToDelete {
expNumReplies++
}

if c.ExpAutoplan {
expNumReplies++
Expand Down