testing.assertEmpty() function

Warning! This page documents an earlier version of Flux, which is no longer actively developed. Flux v0.65 is the most recent stable version of Flux.

The testing.assertEmpty() function tests if an input stream is empty. If not empty, the function returns an error.

Function type: Test

import "testing"


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


Check if there is a difference between streams

This example uses the testing.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)
  |> testing.diff(want: want)
  |> testing.assertEmpty()