testing.assertEquals() function

The testing.assertEquals() function tests whether two streams have identical data. If equal, the function outputs the tested data stream unchanged. If unequal, the function returns an error.

import "testing"

  name: "streamEquality",
  got: got,
  want: want

The testing.assertEquals() function can be used to perform in-line tests in a query.



Unique name given to the assertion.

Data type: String


The stream containing data to test. Defaults to piped-forward data (<-).

Data type: Record


The stream that contains the expected data to test against.

Data type: Record


Assert of separate streams
import "testing"

want = from(bucket: "backup-example-bucket")
  |> range(start: -5m)

got = from(bucket: "example-bucket")
  |> range(start: -5m)

testing.assertEquals(got: got, want: want)
Inline assertion
import "testing"

want = from(bucket: "backup-example-bucket")
  |> range(start: -5m)

from(bucket: "example-bucket")
  |> range(start: -5m)
  |> testing.assertEquals(want: want)

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: