MCPcopy
hub / github.com/dapr/dapr / TestDirectorErrorIsPropagated

Method TestDirectorErrorIsPropagated

pkg/api/grpc/proxy/handler_test.go:250–261  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

248}
249
250func (s *proxyTestSuite) TestDirectorErrorIsPropagated() {
251 ctx, cancel := s.ctx()
252 defer cancel()
253 // See SetupSuite where the StreamDirector has a special case.
254 ctx = metadata.NewOutgoingContext(ctx, metadata.Pairs(rejectingMdKey, "true"))
255 _, err := s.testClient.Ping(ctx, &pb.PingRequest{Value: "foo"})
256 s.Require().Error(err, "Director should reject this RPC")
257 st, ok := status.FromError(err)
258 s.Require().True(ok, "must get status from error")
259 s.Equal(codes.PermissionDenied, st.Code())
260 s.Equal("testing rejection", st.Message())
261}
262
263func (s *proxyTestSuite) TestPingStream_FullDuplexWorks() {
264 ctx, cancel := context.WithTimeout(context.Background(), time.Minute)

Callers

nothing calls this directly

Calls 5

ctxMethod · 0.95
PingMethod · 0.65
ErrorMethod · 0.45
EqualMethod · 0.45
MessageMethod · 0.45

Tested by

no test coverage detected