Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
Signed-off-by: AvivGuiser <[email protected]>
  • Loading branch information
KyriosGN0 committed Oct 3, 2024
1 parent 934054c commit ade1c76
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
4 changes: 1 addition & 3 deletions pkg/vcs/github_client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"fmt"
"io"
"net/http"
"net/url"
"regexp"
"strconv"
"strings"
Expand Down Expand Up @@ -193,8 +192,7 @@ func (c *Client) buildRepoFromComment(context context.Context, comment *github.I
owner := comment.GetIssue().GetRepository().GetOwner().GetName()
repo := comment.GetIssue().GetRepository().GetName()
prNumber := comment.GetIssue().GetNumber()
if err != nil {
log.Error().Msgf("failed to convert prNumber: %s", err)
if prNumber == 0 || repo == "" || owner == "" {
return nilPr
}
pr, ghStatus, err := c.googleClient.PullRequests.Get(context, owner, repo, prNumber)
Expand Down
13 changes: 9 additions & 4 deletions pkg/vcs/github_client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,14 @@ func TestClient_buildRepoFromComment(t *testing.T) {
context: context.TODO(),
comment: &github.IssueCommentEvent{
Issue: &github.Issue{
URL: github.String("https://github.com/zapier/kubechecks/pull/250"),
URL: github.String("https://github.com/zapier/kubechecks/pull/250"),
Number: github.Int(250),
Repository: &github.Repository{
Name: github.String("prguy"),
Owner: &github.User{
Name: github.String("zapier;"),
},
},
},
Repo: &github.Repository{
DefaultBranch: github.String("main"),
Expand Down Expand Up @@ -488,9 +495,7 @@ func TestClient_buildRepoFromComment(t *testing.T) {
args: args{
context: context.TODO(),
comment: &github.IssueCommentEvent{
Issue: &github.Issue{
URL: nil,
},
Issue: nil,
Repo: &github.Repository{
DefaultBranch: github.String("main"),
Name: github.String("prguy"),
Expand Down

0 comments on commit ade1c76

Please sign in to comment.