Atlas › Test

wildcard_matches_any_experiment

Exact test identity: go.temporal.io/server/common/headers/TestIsExperimentRequested/wildcard_matches_any_experiment

Package
go.temporal.io/server/common/headers
Suite / test hierarchy
TestIsExperimentRequested/wildcard_matches_any_experiment
Test
wildcard_matches_any_experiment
Introduced at
headers.go ×1 Frontier kind: Joint frontier
Covered ranges
3
Covered lines
11
Covered files
1

Co-introduced tests

5 other tests enter at the same concept.

Covered source

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

go.temporal.io/server/common/headers/headers.go 11 covered LOC · 3 ranges

Open complete file

104 // Returns true if the experiment is explicitly listed or if "*" (wildcard) is present.
105 // Headers exceeding a length of 100 will be skipped.
106 > func IsExperimentRequested(ctx context.Context, experiment string) bool { headers.go
107 > experimentalValues := metadata.ValueFromIncomingContext(ctx, ExperimentHeaderName)
108 >
109 > for _, headerValue := range experimentalValues {
110 > // limit value size to prevent misuse headers.go
111 > if len(headerValue) > 100 {
112 continue
113 }
114 > for requested := range strings.SplitSeq(headerValue, ",") { headers.go
115 > requested = strings.TrimSpace(requested)
116 > if requested == "*" || requested == experiment {
117 > return true
118 > }
119 }
120 }