Skip to content

Commit

Permalink
Change rbac_engine_test context to context with timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
hasson82 committed Jun 19, 2024
1 parent 912de44 commit 150515f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions internal/xds/rbac/rbac_engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"net/url"
"reflect"
"testing"
"time"

v1xdsudpatypepb "github.com/cncf/xds/go/udpa/type/v1"
v3xdsxdstypepb "github.com/cncf/xds/go/xds/type/v3"
Expand All @@ -48,6 +49,8 @@ import (
"google.golang.org/protobuf/types/known/wrapperspb"
)

const defaultTestTimeout = 10 * time.Second

type s struct {
grpctest.Tester
}
Expand Down Expand Up @@ -1748,8 +1751,8 @@ func (s) TestChainEngine(t *testing.T) {
// information to represent incoming RPC's. This will be how a
// user uses this API. A user will have to put MD, PeerInfo, and
// the connection the RPC is sent on in the context.
ctx := metadata.NewIncomingContext(context.Background(), data.rpcData.md)

ctx, cancel := context.WithTimeout(metadata.NewIncomingContext(context.Background(), data.rpcData.md), defaultTestTimeout)
defer cancel()
// Make a TCP connection with a certain destination port. The
// address/port of this connection will be used to populate the
// destination ip/port in RPCData struct. This represents what
Expand Down

0 comments on commit 150515f

Please sign in to comment.