MCPcopy
hub / github.com/grafana/tempo / newStore

Function newStore

modules/blockbuilder/blockbuilder_test.go:946–962  ·  view source on GitHub ↗
(ctx context.Context, t testing.TB)

Source from the content-addressed store, hash-verified

944func (o *ownEverythingSharder) Owns(string) bool { return true }
945
946func 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
964func newStoreWithLogger(ctx context.Context, t testing.TB, log log.Logger, skipNoCompactBlocks bool) storage.Store {
965 tmpDir := t.TempDir()

Calls 3

newStoreWithLoggerFunction · 0.70
testLoggerFunction · 0.70
ShutdownMethod · 0.65

Tested by

no test coverage detected