Documentation

Flux testing package

Flux 0.112.0+

The Flux testing package provide functions for testing Flux operations. Import the testing package:

import "testing"

Options

The testing package includes the following options:

import "testing"

option testing.load = (tables=<-) => tables
option testing.loadMem = (csv) => c.from(csv: csv)
option testing.loadStorage = (csv) => c.from(csv: csv)
    |> range(start: 1800-01-01T00:00:00Z, stop: 2200-12-31T11:59:59Z)
    |> map(
        fn: (r) => ({r with
            _field: if exists r._field then r._field else die(msg: "test input table does not have _field column"),
            _measurement: if exists r._measurement then r._measurement else die(msg: "test input table does not have _measurement column"),
            _time: if exists r._time then r._time else die(msg: "test input table does not have _time column"),
        }),
    )

load

Function option that loads tests data from a stream of tables. Default is:

(tables=<-) => tables

loadMem

Function option that loads annotated CSV test data from memory to emulate query results returned by Flux. Default is:

(csv) => c.from(csv: csv)

loadStorage

Function option that loads annotated CSV test data as if queried from InfluxDB. Ensures tests behave correctly in both the Flux and InfluxDB test suites. Default is:

(csv) => c.from(csv: csv)
    |> range(start: 1800-01-01T00:00:00Z, stop: 2200-12-31T11:59:59Z)
    |> map(
        fn: (r) => ({r with
            _field: if exists r._field then r._field else die(msg: "test input table does not have _field column"),
            _measurement: if exists r._measurement then r._measurement else die(msg: "test input table does not have _measurement column"),
            _time: if exists r._time then r._time else die(msg: "test input table does not have _time column"),
        }),
    )

Functions


Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.