MCPcopy Create free account
hub / github.com/cortexproject/cortex / TestMultiResolver

Function TestMultiResolver

pkg/util/users/resolver_test.go:125–161  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

123}
124
125func TestMultiResolver(t *testing.T) {
126 r := NewMultiResolver()
127 for _, tc := range append(commonResolverTestCases, []resolverTestCase{
128 {
129 name: "multi-tenant",
130 headerValue: strptr("tenant-a|tenant-b"),
131 errTenantID: user.ErrTooManyOrgIDs,
132 tenantIDs: []string{"tenant-a", "tenant-b"},
133 },
134 {
135 name: "multi-tenant-wrong-order",
136 headerValue: strptr("tenant-b|tenant-a"),
137 errTenantID: user.ErrTooManyOrgIDs,
138 tenantIDs: []string{"tenant-a", "tenant-b"},
139 },
140 {
141 name: "multi-tenant-duplicate-order",
142 headerValue: strptr("tenant-b|tenant-b|tenant-a"),
143 errTenantID: user.ErrTooManyOrgIDs,
144 tenantIDs: []string{"tenant-a", "tenant-b"},
145 },
146 {
147 name: "multi-tenant-with-unsafe-path-segment(.)",
148 headerValue: strptr("tenant-a|tenant-b|."),
149 errTenantID: errTenantIDUnsafe,
150 errTenantIDs: errTenantIDUnsafe,
151 },
152 {
153 name: "multi-tenant-with-unsafe-path-segment(..)",
154 headerValue: strptr("tenant-a|tenant-b|.."),
155 errTenantID: errTenantIDUnsafe,
156 errTenantIDs: errTenantIDUnsafe,
157 },
158 }...) {
159 t.Run(tc.name, tc.test(r))
160 }
161}

Callers

nothing calls this directly

Calls 4

NewMultiResolverFunction · 0.85
strptrFunction · 0.85
testMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected