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"
testing.assertEquals(
name: "streamEquality",
got: got,
want: want
)
The testing.assertEquals()
function can be used to perform in-line tests in a query.
Parameters
name
Unique name given to the assertion.
Data type: String
got
The stream containing data to test.
Defaults to piped-forward data (<-
).
Data type: Record
want
The stream that contains the expected data to test against.
Data type: Record
Examples
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)
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for InfluxDB and this documentation. To find support, the following resources are available:
InfluxDB Cloud and InfluxDB Enterprise customers can contact InfluxData Support.