Files
b14d228ace feat: limit recent queries (#5682)
* add adjustRangeWare

Signed-off-by: Joe Elliott <[email protected]>

* improve code and added more tests

* fixes in the tests

* remove strict validation for now

* move the logic to the frontend

* fix integration tets

* add values explicitly

* fix query range tests

* fix unit tests

* fix more tests

* fix more tests

* disable for tags

* revert last commit

* do not apply when the start and end are missing for now

* try to fix more tests

* fix more tests

* fix more tests

* fix more tests

* bring back empty start end handling

* fix more tests

* fix multitenant tests

* fix https test

* fix api tests

* fix deployment tests

* simplify tests

* fix query range test

* fix another test

* remove commented code

* disable test

* fix search propagates

* fix search shard test

* fix another test

* last one?

* test querybackend after

* Update modules/livestore/config.go

Co-authored-by: Joe Elliott <[email protected]>

* Update modules/frontend/frontend.go

Co-authored-by: Joe Elliott <[email protected]>

* fmt

* Remove the new default start query parameter and
default to the query_backend_after

* remove precission since its not used

* cleanup test configs

* move config one level up

* changelog

* remove validation

* defaulted to 0

* manifest

* add more cutoff

---------

Signed-off-by: Joe Elliott <[email protected]>
Co-authored-by: Joe Elliott <[email protected]>
Co-authored-by: Joe Elliott <[email protected]>
2025-11-03 16:39:48 +00:00

42 lines
1.3 KiB
Go

package pipeline
import (
"bytes"
"context"
"io"
"net/http"
"testing"
"github.com/grafana/tempo/modules/frontend/combiner"
"github.com/stretchr/testify/require"
)
func DoRequest(t *testing.T, url string, rt AsyncRoundTripper[combiner.PipelineResponse]) int {
req, _ := http.NewRequest(http.MethodGet, url, nil)
resp, _ := rt.RoundTrip(NewHTTPRequest(req))
httpResponse, _, err := resp.Next(context.Background())
require.NoError(t, err)
return httpResponse.HTTPResponse().StatusCode
}
func GetRoundTripperFunc() AsyncRoundTripperFunc[combiner.PipelineResponse] {
next := AsyncRoundTripperFunc[combiner.PipelineResponse](func(_ Request) (Responses[combiner.PipelineResponse], error) {
return NewHTTPToAsyncResponse(&http.Response{
StatusCode: 200,
Body: io.NopCloser(bytes.NewReader([]byte{})),
}), nil
})
return next
}
func GetRoundTripperFuncWithAsserts(t *testing.T, assert func(t *testing.T, r Request)) AsyncRoundTripperFunc[combiner.PipelineResponse] {
next := AsyncRoundTripperFunc[combiner.PipelineResponse](func(req Request) (Responses[combiner.PipelineResponse], error) {
assert(t, req)
return NewHTTPToAsyncResponse(&http.Response{
StatusCode: 200,
Body: io.NopCloser(bytes.NewReader([]byte{})),
}), nil
})
return next
}