This repository has been archived on 2025-05-04. You can view files and clone it, but cannot push or open issues or pull requests.
Files
micro-wrapper-requestid/requestid_test.go
Vasiliy Tolstov 702442d9a0
All checks were successful
test / test (push) Successful in 2m48s
move to v4
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2025-03-03 23:47:17 +03:00

34 lines
597 B
Go

package requestid
import (
"context"
"testing"
"go.unistack.org/micro/v4/metadata"
)
func TestDefaultMetadataFunc(t *testing.T) {
ctx := context.TODO()
nctx, err := DefaultMetadataFunc(ctx)
if err != nil {
t.Fatalf("%v", err)
}
imd, ok := metadata.FromIncomingContext(nctx)
if !ok {
t.Fatalf("md missing in incoming context")
}
omd, ok := metadata.FromOutgoingContext(nctx)
if !ok {
t.Fatalf("md missing in outgoing context")
}
_, iok := imd.Get(DefaultMetadataKey)
_, ook := omd.Get(DefaultMetadataKey)
if !iok || !ook {
t.Fatalf("missing metadata key value")
}
}