testing.benchmark() function

The testing.benchmark() function executes a test case without comparing test output with the expected test output. This lets you accurately benchmark a test case without the added overhead of comparing test output that occurs in

Function type: Test

import "testing"

  case: exampleTestCase



Test case to benchmark.

Data type: Function


Define and benchmark a test case

The following script defines a test case for the sum() function and enables profilers to measure query performance.

import "testing"
import "profiler"

option profiler.enabledProfilers = ["query", "operator"]

inData = "

outData = "

t_sum = (table=<-) =>
    |> range(start:2021-01-01T00:00:00Z, stop:2021-01-03T01:00:00Z)
    |> sum())

test _sum = () =>
  ({input: testing.loadStorage(csv: inData), want: testing.loadMem(csv: outData), fn: t_sum})

testing.benchmark(case: _sum)

Cloud or OSS?

InfluxDB OSS 2.0 now generally available!

InfluxDB OSS 2.0 is now generally available and ready for production use. See the InfluxDB OSS 2.0 release notes.

For information about upgrading to InfluxDB OSS 2.0, see: