Documentation

testing.load() function

The testing.load() function loads tests data from a stream of tables.

Function type: Test

import "testing"

testing.load()

Parameters

tables

Input data. Default is piped-forward data (<-).

Examples

Load a raw stream of tables in a test case

The following test uses array.from() to create two streams of tables to compare in the test.

import "testing"
import "array"

got = array.from(rows: [
  {_time: 2021-01-01T00:00:00Z, _measurement: "m", _field: "t", _value: 1.2},
  {_time: 2021-01-01T01:00:00Z, _measurement: "m", _field: "t", _value: 0.8},
  {_time: 2021-01-01T02:00:00Z, _measurement: "m", _field: "t", _value: 3.2}
])

want = array.from(rows: [
  {_time: 2021-01-01T00:00:00Z, _measurement: "m", _field: "t", _value: 1.2},
  {_time: 2021-01-01T01:00:00Z, _measurement: "m", _field: "t", _value: 0.8},
  {_time: 2021-01-01T02:00:00Z, _measurement: "m", _field: "t", _value: 3.1}
])

testing.diff(got, 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: