Atlas › Test

TestSetCallerInfo_PreserveOtherValues

Exact test identity: go.temporal.io/server/common/headers/TestCallerInfoSuite/TestSetCallerInfo_PreserveOtherValues

Package
go.temporal.io/server/common/headers
Suite / test hierarchy
TestCallerInfoSuite/TestSetCallerInfo_PreserveOtherValues
Test
TestSetCallerInfo_PreserveOtherValues
Introduced at
caller_info.go ×1 Frontier kind: Joint frontier
Covered ranges
5
Covered lines
22
Covered files
2

Covered source

Expand a file to inspect source; the > gutter marks covered lines.

go.temporal.io/server/common/headers/caller_info.go 14 covered LOC · 2 ranges

Open complete file

66 callerType string,
67 callOrigin string,
68 > ) CallerInfo { caller_info.go
69 > return CallerInfo{
70 > CallerName: callerName,
71 > CallerType: callerType,
72 > CallOrigin: callOrigin,
73 > }
74 > }
75
76 // NewBackgroundHighCallerInfo creates a new CallerInfo with BackgroundHigh callerType
117 ctx context.Context,
118 info CallerInfo,
119 > ) context.Context { caller_info.go
120 > return setIncomingMD(ctx, map[string]string{
121 > CallerNameHeaderName: info.CallerName,
122 > CallerTypeHeaderName: info.CallerType,
123 > CallOriginHeaderName: info.CallOrigin,
124 > })
125 > }
126
127 // SetCallerName set caller name in the context.
go.temporal.io/server/common/headers/headers.go 8 covered LOC · 3 ranges

Open complete file

154 // setIncomingMD sets the key-value pairs in the incoming metadata.
155 // Empty values are ignored.
156 > func setIncomingMD(ctx context.Context, kv map[string]string) context.Context { headers.go
157 > mdIncoming, ok := metadata.FromIncomingContext(ctx)
158 > if !ok {
159 mdIncoming = metadata.MD{}
160 }
161 > for k, v := range kv { headers.go
162 > if v != "" {
163 > mdIncoming.Set(k, v)
164 > }
165 }
166 > return metadata.NewIncomingContext(ctx, mdIncoming) headers.go
167 }