(ctx context.Context, t testing.TB)
| 944 | func (o *ownEverythingSharder) Owns(string) bool { return true } |
| 945 | |
| 946 | func newStore(ctx context.Context, t testing.TB) storage.Store { |
| 947 | // The store is never started as a dskit service, so StopAndAwaitTerminated |
| 948 | // transitions New→Terminated without calling stopping()/Shutdown(). cancel() |
| 949 | // signals the blocklist polling goroutine (started by EnablePolling) to |
| 950 | // exit, and store.Shutdown() blocks until it actually has. Both are needed: |
| 951 | // without cancel() the goroutine never exits; without Shutdown() we don't |
| 952 | // wait for it, and it races with t.TempDir() cleanup, writing tenant index |
| 953 | // files while os.RemoveAll runs. |
| 954 | ctx, cancel := context.WithCancel(ctx) |
| 955 | store := newStoreWithLogger(ctx, t, testLogger(t), false) |
| 956 | t.Cleanup(func() { |
| 957 | cancel() |
| 958 | store.Shutdown() |
| 959 | require.NoError(t, services.StopAndAwaitTerminated(context.Background(), store)) |
| 960 | }) |
| 961 | return store |
| 962 | } |
| 963 | |
| 964 | func newStoreWithLogger(ctx context.Context, t testing.TB, log log.Logger, skipNoCompactBlocks bool) storage.Store { |
| 965 | tmpDir := t.TempDir() |
no test coverage detected