Skip to content

Commit af2007a

Browse files
committed
feat: add test
1 parent bdcd8b5 commit af2007a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

server/service_inline_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ func mockHandler(ctx context.Context, handler, args, result interface{}) error {
107107
return fmt.Errorf("set metainfo backward fail")
108108
}
109109

110+
if v, ok := ctx.Value(consts.SERVICE_INLINE_CUSTOM_CTX_KEY).(string); !ok || v != "custom_ctx_key" {
111+
return fmt.Errorf("custom ctx key mismatch: expected custom_ctx_key, got %s", v)
112+
}
113+
110114
return nil
111115
}
112116

@@ -119,6 +123,8 @@ func TestServiceInline(t *testing.T) {
119123
cliCtx := context.Background()
120124
cliRPCInfo := constructClientRPCInfo()
121125
cliCtx = context.WithValue(cliCtx, consts.SERVICE_INLINE_RPCINFO_KEY, unsafe.Pointer(&cliRPCInfo))
126+
cliCtx = context.WithValue(cliCtx, consts.SERVICE_INLINE_CUSTOM_CTX_KEY, "custom_ctx_key")
127+
122128
eps := iface.BuildServiceInlineInvokeChain()
123129
// metainfo check
124130
cliCtx = metainfo.WithBackwardValues(cliCtx)

0 commit comments

Comments
 (0)