newTestIngester creates an ingester instance for PushStream security tests.
(t *testing.T)
| 66 | |
| 67 | // newTestIngester creates an ingester instance for PushStream security tests. |
| 68 | func 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. |
no test coverage detected