Skip to content

Commit

Permalink
pass input to log even if checkrequest times out
Browse files Browse the repository at this point in the history
Signed-off-by: Rudrakh Panigrahi <rudrakh97@gmail.com>
  • Loading branch information
rudrakhp authored and ashutosh-narkar committed Oct 24, 2023
1 parent 064d640 commit 63b3a29
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 4 additions & 4 deletions internal/internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,13 +384,13 @@ func (p *envoyExtAuthzGrpcServer) check(ctx context.Context, req interface{}) (*
return nil
}

if ctx.Err() != nil {
err = errors.Wrap(ctx.Err(), "check request timed out before query execution")
input, err = envoyauth.RequestToInput(req, logger, p.cfg.protoSet, p.cfg.SkipRequestBodyParse)
if err != nil {
return nil, stop, err
}

input, err = envoyauth.RequestToInput(req, logger, p.cfg.protoSet, p.cfg.SkipRequestBodyParse)
if err != nil {
if ctx.Err() != nil {
err = errors.Wrap(ctx.Err(), "check request timed out before query execution")
return nil, stop, err
}

Expand Down
4 changes: 4 additions & 0 deletions internal/internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,10 @@ func TestCheckContextTimeout(t *testing.T) {
if event.Error.Error() != expectedErrMsg {
t.Fatalf("Expected error message %v but got %v", expectedErrMsg, event.Error.Error())
}

if len((*event.Input).(map[string]interface{})) == 0 {
t.Fatalf("Expected non empty input but got %v", *event.Input)
}
}

func TestCheckIllegalDecisionWithLogger(t *testing.T) {
Expand Down

0 comments on commit 63b3a29

Please sign in to comment.