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

Function newTestIngester

pkg/ingester/pushstream_security_test.go:68–81  ·  view source on GitHub ↗

newTestIngester creates an ingester instance for PushStream security tests.

(t *testing.T)

Source from the content-addressed store, hash-verified

66
67// newTestIngester creates an ingester instance for PushStream security tests.
68func newTestIngester(t *testing.T) *Ingester {
69 t.Helper()
70 cfg := defaultIngesterTestConfig(t)
71 ing, err := prepareIngesterWithBlocksStorage(t, cfg, prometheus.NewRegistry())
72 require.NoError(t, err)
73 require.NoError(t, services.StartAndAwaitRunning(context.Background(), ing))
74 t.Cleanup(func() {
75 _ = services.StopAndAwaitTerminated(context.Background(), ing)
76 })
77 test.Poll(t, time.Second, ring.ACTIVE, func() any {
78 return ing.lifecycler.GetState()
79 })
80 return ing
81}
82
83// TestPushStream_TenantImpersonation reproduces the tenant impersonation vulnerability
84// and verifies it is blocked after the fix is applied.

Calls 6

StartAndAwaitRunningFunction · 0.92
StopAndAwaitTerminatedFunction · 0.92
PollFunction · 0.92
GetStateMethod · 0.45

Tested by

no test coverage detected