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

Method test

pkg/util/users/resolver_test.go:24–48  ·  view source on GitHub ↗
(r Resolver)

Source from the content-addressed store, hash-verified

22}
23
24func (tc *resolverTestCase) test(r Resolver) func(t *testing.T) {
25 return func(t *testing.T) {
26
27 ctx := context.Background()
28 if tc.headerValue != nil {
29 ctx = user.InjectOrgID(ctx, *tc.headerValue)
30 }
31
32 tenantID, err := r.TenantID(ctx)
33 if tc.errTenantID != nil {
34 assert.Equal(t, tc.errTenantID, err)
35 } else {
36 assert.NoError(t, err)
37 assert.Equal(t, tc.tenantID, tenantID)
38 }
39
40 tenantIDs, err := r.TenantIDs(ctx)
41 if tc.errTenantIDs != nil {
42 assert.Equal(t, tc.errTenantIDs, err)
43 } else {
44 assert.NoError(t, err)
45 assert.Equal(t, tc.tenantIDs, tenantIDs)
46 }
47 }
48}
49
50var commonResolverTestCases = []resolverTestCase{
51 {

Callers 2

TestSingleResolverFunction · 0.80
TestMultiResolverFunction · 0.80

Calls 3

TenantIDMethod · 0.65
EqualMethod · 0.65
TenantIDsMethod · 0.65

Tested by

no test coverage detected