-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Added flag --silence-fork-pr-errors #885
Added flag --silence-fork-pr-errors #885
Conversation
Codecov Report
@@ Coverage Diff @@
## master #885 +/- ##
==========================================
+ Coverage 71.83% 71.85% +0.02%
==========================================
Files 65 65
Lines 5247 5252 +5
==========================================
+ Hits 3769 3774 +5
Misses 1191 1191
Partials 287 287
Continue to review full report at Codecov.
|
@@ -68,6 +68,7 @@ const ( | |||
RepoWhitelistFlag = "repo-whitelist" | |||
RequireApprovalFlag = "require-approval" | |||
RequireMergeableFlag = "require-mergeable" | |||
SilenceForkPRErrorsFlag = "silence-fork-pr-errors" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks great! just need to update the tests in server_test.go
look for each instance of the whitelist flag and then put your flag in there too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless I'm missing it, it doesn't look like SilenceWhitelistErrorsFlag
is tested in server_test.go
. I can add tests for both Silence flags if you would like.
Two questions about the tests (I am new to testing in go).
diff --git a/server/events/command_runner_test.go b/server/events/command_runner_test.go
index 0f6d9b71..dc7ba0fc 100644
--- a/server/events/command_runner_test.go
+++ b/server/events/command_runner_test.go
@@ -157,7 +157,7 @@ func TestRunCommentCommand_ForkPRDisabled_SilenceEnabled(t *testing.T) {
t.Log("if a command is run on a forked pull request and forks are disabled and we are silencing errors do not comment with error")
vcsClient := setup(t)
ch.AllowForkPRs = false // by default it's false so don't need to reset
- ch.SilenceForkPRErrors = true
+ ch.SilenceForkPRErrors = false
var pull github.PullRequest
modelPull := models.PullRequest{State: models.OpenPullState}
When(githubGetter.GetPullRequest(fixtures.GithubRepo, fixtures.Pull.Num)).ThenReturn(&pull, nil) to purposefully make my added test fail, it results in a panic: https://gist.github.com/kinghrothgar/b36386b70645e80326df6fe27e0bae0b. Is this expected or did I do something wrong? |
9d3791c
to
49cb12e
Compare
(Force push was just to get the go.mod and go.sum tiddy into it's own commit) |
@lkysow How does it look now? |
This adds flag to handle #884