Documentation

testing.load() function

testing.load() loads test data from a stream of tables.

Function type signature
(<-tables: A) => A
For more information, see Function type signatures.

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.load(tables: got)
    |> testing.diff(want: want)

Was this page helpful?

Thank you for your feedback!


Introducing InfluxDB 3.0

The new core of InfluxDB built with Rust and Apache Arrow. Available today in InfluxDB Cloud Dedicated.

Learn more

State of the InfluxDB Cloud Serverless documentation

The new documentation for InfluxDB Cloud Serverless is a work in progress. We are adding new information and content almost daily. Thank you for your patience!

If there is specific information you’re looking for, please submit a documentation issue.