Atlas › Test

TestSetCallerInfo_WithPartialCallerInfo

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

Package
go.temporal.io/server/common/headers
Suite / test hierarchy
TestCallerInfoSuite/TestSetCallerInfo_WithPartialCallerInfo
Test
TestSetCallerInfo_WithPartialCallerInfo
Introduced at
TestSetCallerInfo_WithPartialCallerInfo Frontier kind: Test frontier
Covered ranges
6
Covered lines
20
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 10 covered LOC · 2 ranges

Open complete file

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.
139 ctx context.Context,
140 callerType string,
141 > ) context.Context { caller_info.go
142 > return setIncomingMD(ctx, map[string]string{CallerTypeHeaderName: callerType})
143 > }
144
145 // SetOrigin set call origin in the context.
go.temporal.io/server/common/headers/headers.go 10 covered LOC · 4 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{} headers.go
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 }