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

Function TestRunCheckerTraceNotReady

cmd/tempo-vulture/main_test.go:877–903  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

875}
876
877func TestRunCheckerTraceNotReady(t *testing.T) {
878 seed := time.Date(2008, 1, 1, 12, 0, 0, 0, time.UTC)
879
880 config := vultureConfiguration{
881 tempoOrgID: "orgID",
882 tempoWriteBackoffDuration: 10 * time.Hour, // Very long to ensure trace not ready
883 tempoLongWriteBackoffDuration: 20 * time.Hour,
884 }
885
886 logger = zap.NewNop()
887
888 ticker := time.NewTicker(time.Millisecond) // fires immediately
889
890 // Checker function that signals completion
891 var checkerCalled bool
892 checker := func(_ *util.TraceInfo, _ *zap.Logger) {
893 checkerCalled = true
894 }
895
896 selectPastTimestamp := func(_ time.Time) (newStart, ts time.Time, skip bool) {
897 return seed, seed, false
898 }
899 runChecker(ticker, config, selectPastTimestamp, checker, logger)
900 time.Sleep(5 * time.Millisecond)
901 // Ensure the checker was not called because trace is not ready
902 assert.False(t, checkerCalled)
903}
904
905func TestRunCheckerSuccess(t *testing.T) {
906 seed := time.Date(2008, 1, 1, 12, 0, 0, 0, time.UTC)

Callers

nothing calls this directly

Calls 2

runCheckerFunction · 0.85
SleepMethod · 0.65

Tested by

no test coverage detected