move hooks
Some checks failed
lint / lint (pull_request) Failing after 1m52s
test / test (pull_request) Successful in 4m37s
coverage / build (pull_request) Failing after 6m59s

This commit is contained in:
2025-04-22 09:41:22 +03:00
parent fa636ef6a9
commit ae63d44866
5 changed files with 536 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
package requestid
import (
"context"
"testing"
"go.unistack.org/micro/v3/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")
}
}