Atlas › Test
TestSetCallerInfo_WithExistingCallerInfo
Exact test identity: go.temporal.io/server/common/headers/TestCallerInfoSuite/TestSetCallerInfo_WithExistingCallerInfo
- Package
go.temporal.io/server/common/headers
- Suite / test hierarchy
TestCallerInfoSuite/TestSetCallerInfo_WithExistingCallerInfo
- Test
TestSetCallerInfo_WithExistingCallerInfo
- Introduced at
- TestSetCallerInfo_WithExistingCallerInfo Frontier kind: Test frontier
- Covered ranges
- 8
- Covered lines
- 26
- 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 16 covered LOC · 4 ranges
Open complete file
117
ctx context.Context,
118
info CallerInfo,
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.
130
ctx context.Context,
131
callerName string,
133
>
return setIncomingMD(ctx, map[string]string{CallerNameHeaderName: callerName})
134
>
}
135
136
// SetCallerType set caller type in the context.
139
ctx context.Context,
140
callerType string,
142
>
return setIncomingMD(ctx, map[string]string{CallerTypeHeaderName: callerType})
143
>
}
144
145
// SetOrigin set call origin in the context.
148
ctx context.Context,
149
callOrigin string,
151
>
return setIncomingMD(ctx, map[string]string{CallOriginHeaderName: callOrigin})
152
>
}
153
154
// GetCallerInfo retrieves caller information from the context if exists. Empty value is returned
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 {
160
>
}
162
>
if v != "" {
163
>
mdIncoming.Set(k, v)
164
>
}
165
}
166
>
return metadata.NewIncomingContext(ctx, mdIncoming)
headers.go
167
}