Skip to content

Commit

Permalink
fix: lint and ut
Browse files Browse the repository at this point in the history
Signed-off-by: xu.zhu <[email protected]>
  • Loading branch information
xuzhu-591 committed Sep 18, 2023
1 parent 8fd26be commit 3565113
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 12 deletions.
6 changes: 4 additions & 2 deletions core/controller/pipelinerun/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ type Controller interface {
Cancel(ctx context.Context, pipelinerunID uint) error

ListCheckRuns(ctx context.Context, q *q.Query) ([]*prmodels.CheckRun, error)
CreateCheckRun(ctx context.Context, pipelineRunID uint, request *CreateOrUpdateCheckRunRequest) (*prmodels.CheckRun, error)
CreateCheckRun(ctx context.Context, pipelineRunID uint,
request *CreateOrUpdateCheckRunRequest) (*prmodels.CheckRun, error)
ListPRMessages(ctx context.Context, pipelineRunID uint, q *q.Query) (int, []*PrMessage, error)
CreatePRMessage(ctx context.Context, pipelineRunID uint, request *CreatePrMessageRequest) (*prmodels.PRMessage, error)
}
Expand Down Expand Up @@ -336,7 +337,8 @@ func (c *controller) CreateCheck(ctx context.Context, check *prmodels.Check) (*p
return c.prMgr.Check.Create(ctx, check)
}

func (c *controller) UpdateCheckRunByID(ctx context.Context, checkRunID uint, request *CreateOrUpdateCheckRunRequest) error {
func (c *controller) UpdateCheckRunByID(ctx context.Context, checkRunID uint,
request *CreateOrUpdateCheckRunRequest) error {
const op = "pipelinerun controller: update check run"
defer wlog.Start(ctx, op).StopPrint()

Expand Down
2 changes: 1 addition & 1 deletion core/http/api/v2/cluster/routers.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func (api *API) RegisterRoute(engine *gin.Engine) {
HandlerFunc: api.DeleteFavorite,
}, {
Method: http.MethodPost,
Pattern: fmt.Sprintf("/clusters/:%v/pipelinerun", common.ParamClusterID),
Pattern: fmt.Sprintf("/clusters/:%v/pipelineruns", common.ParamClusterID),
HandlerFunc: api.CreatePipelineRun,
},
}
Expand Down
1 change: 0 additions & 1 deletion core/http/api/v2/pipelinerun/apis.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ func (a *API) ListCheckRuns(c *gin.Context) {
return
}
response.SuccessWithData(c, checkRuns)

}

func (a *API) CreateCheckRun(c *gin.Context) {
Expand Down
6 changes: 3 additions & 3 deletions core/http/api/v2/pipelinerun/routers.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func (api *API) RegisterRoute(engine *gin.Engine) {
},
{
Method: http.MethodGet,
Pattern: fmt.Sprintf("/checkruns"),
Pattern: "/checkruns",
HandlerFunc: api.ListCheckRuns,
},
{
Expand All @@ -86,12 +86,12 @@ func (api *API) RegisterRoute(engine *gin.Engine) {
},
{
Method: http.MethodGet,
Pattern: fmt.Sprintf("/pipelineruns/:%v/message", _pipelinerunIDParam),
Pattern: fmt.Sprintf("/pipelineruns/:%v/messages", _pipelinerunIDParam),
HandlerFunc: api.ListPrMessages,
},
{
Method: http.MethodPost,
Pattern: fmt.Sprintf("/pipelineruns/:%v/message", _pipelinerunIDParam),
Pattern: fmt.Sprintf("/pipelineruns/:%v/messages", _pipelinerunIDParam),
HandlerFunc: api.CreatePrMessage,
},
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/go-redis/redis/v8 v8.3.3
github.com/golang-jwt/jwt/v4 v4.4.3
github.com/golang/mock v1.6.0
github.com/google/go-containerregistry v0.1.3 // indirect
github.com/google/go-containerregistry v0.1.3
github.com/google/go-github/v41 v41.0.0
github.com/google/uuid v1.2.0
github.com/gorilla/mux v1.8.0
Expand Down
3 changes: 0 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1252,7 +1252,6 @@ github.com/matttproud/golang_protobuf_extensions v1.0.0/go.mod h1:D8He9yQNgCq6Z5
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI=
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
github.com/maxbrunsfeld/counterfeiter/v6 v6.2.2 h1:g+4J5sZg6osfvEfkRZxJ1em0VT95/UOZgi/l7zi1/oE=
github.com/maxbrunsfeld/counterfeiter/v6 v6.2.2/go.mod h1:eD9eIE7cdwcMi9rYluz88Jz2VyhSmden33/aXg4oVIY=
github.com/mbilski/exhaustivestruct v1.1.0/go.mod h1:OeTBVxQWoEmB2J2JCHmXWPJ0aksxSUOUy+nvtVEfzXc=
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4=
Expand Down Expand Up @@ -2588,7 +2587,6 @@ k8s.io/client-go v0.20.10 h1:TgAL2pqcNWMH4eZoS9Uw0BLh2lu5a2A4pmegjp5pmsk=
k8s.io/client-go v0.20.10/go.mod h1:fFg+aLoasv/R+xiVaWjxeqGFYltzgQcOQzkFaSRfnJ0=
k8s.io/cloud-provider v0.20.10/go.mod h1:8HQ0NgW661PiH+QK1BPYD0QorpaxOXQs1ZsMfOe3uc0=
k8s.io/cluster-bootstrap v0.20.10/go.mod h1:D+cqd8iJYeajaIUBUca4J3f/87L4qiFvMPzM5qs8x1o=
k8s.io/code-generator v0.20.10 h1:xENIQkVW8G2chwm0/HNwNIR3gcbF2XADK+jVS9/UCTE=
k8s.io/code-generator v0.20.10/go.mod h1:i6FmG+QxaLxvJsezvZp0q/gAEzzOz3U53KFibghWToU=
k8s.io/component-base v0.20.10 h1:QNlekT6M2zBb4feHHmZ+YHZHcDbhbrYS7xHHY+v+kOE=
k8s.io/component-base v0.20.10/go.mod h1:ZKOEin1xu68aJzxgzl5DZSp5J1IrjAOPlPN90/t6OI8=
Expand All @@ -2602,7 +2600,6 @@ k8s.io/gengo v0.0.0-20191108084044-e500ee069b5c/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8
k8s.io/gengo v0.0.0-20200205140755-e0e292d8aa12/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
k8s.io/gengo v0.0.0-20200428234225-8167cfdcfc14/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
k8s.io/gengo v0.0.0-20201113003025-83324d819ded h1:JApXBKYyB7l9xx+DK7/+mFjC7A9Bt5A93FPvFD0HIFE=
k8s.io/gengo v0.0.0-20201113003025-83324d819ded/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
k8s.io/heapster v1.2.0-beta.1/go.mod h1:h1uhptVXMwC8xtZBYsPXKVi8fpdlYkTs6k949KozGrM=
k8s.io/helm v2.17.0+incompatible h1:Bpn6o1wKLYqKM3+Osh8e+1/K2g/GsQJ4F4yNF2+deao=
Expand Down
2 changes: 1 addition & 1 deletion pkg/eventhandler/wlgenerator/wlgenerator.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ func (w *WebhookLogGenerator) Process(ctx context.Context, events []*models.Even
} else if !ok {
continue
}
log.Debugf(ctx, "event %d matches webhook %d", event.ID, webhook.URL)
log.Debugf(ctx, "event %d matches webhook %s", event.ID, webhook.URL)
// 3.2 add webhook to the list
if _, ok := conditionsToCreate[event.ID]; !ok {
conditionsToCreate[event.ID] = map[uint]messageDependency{}
Expand Down

0 comments on commit 3565113

Please sign in to comment.