testing.assertEquals() tests whether two streams of tables are identical.
If equal, the function outputs the tested data stream unchanged. If unequal, the function returns an error.
assertEquals can be used to perform in-line tests in a query.
Function type signature
(<-got: stream[A], name: string, want: stream[A]) => stream[A]
(Required) Unique assertion name.
Data to test. Default is piped-forward data (
(Required) Expected data to test against.
Test if streams of tables are different
import "sampledata" import "testing" want = sampledata.int() got = sampledata.float() |> toInt() testing.assertEquals(name: "test_equality", got: got, want: want)
Test if streams of tables are different mid-script
import "testing" want = from(bucket: "backup-example-bucket") |> range(start: -5m) from(bucket: "example-bucket") |> range(start: -5m) |> testing.assertEquals(want: want)
Was this page helpful?
Thank you for your feedback!
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for Flux and this documentation. To find support, use the following resources:
Customers with an annual or support contract can contact InfluxData Support.