975 B
975 B
title | description | menu | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
testing.assertEmpty() function | The testing.assertEmpty() function tests if an input stream is empty. |
|
The testing.assertEmpty()
function tests if an input stream is empty.
If not empty, the function outputs an error.
Function type: Test
import "testing"
testing.assertEmpty()
The testing.assertEmpty()
function can be used to perform in-line tests in a query.
Examples
Check if there is a difference between streams
This example uses the diff()
function
which outputs the diff for the two streams.
The .testing.assertEmpty()
function checks to see if the diff is empty.
import "testing"
got = from(bucket: "telegraf/autogen")
|> range(start: -15m)
want = from(bucket: "backup_telegraf/autogen")
|> range(start: -15m)
got
|> diff(want: want)
|> testing.assertEmpty()