Merge pull request #14463 from fpetkovski/customize-acceptance-tests

Allow built-in tests to be customized
This commit is contained in:
Bryan Boreham 2024-07-15 10:04:41 +01:00 committed by GitHub
commit bb241d7960
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -55,6 +55,11 @@ const (
DefaultMaxSamplesPerQuery = 10000
)
type TBRun interface {
testing.TB
Run(string, func(*testing.T)) bool
}
var testStartTime = time.Unix(0, 0).UTC()
// LoadedStorage returns storage with generated data using the provided load statements.
@ -89,7 +94,7 @@ func NewTestEngine(enablePerStepStats bool, lookbackDelta time.Duration, maxSamp
}
// RunBuiltinTests runs an acceptance test suite against the provided engine.
func RunBuiltinTests(t *testing.T, engine promql.QueryEngine) {
func RunBuiltinTests(t TBRun, engine promql.QueryEngine) {
t.Cleanup(func() { parser.EnableExperimentalFunctions = false })
parser.EnableExperimentalFunctions = true