docs-v2/content/flux/v0.x/stdlib/testing/loadstorage.md

1.4 KiB

title description menu aliases weight flux/v0.x/tags introduced
testing.loadStorage() function The `testing.loadStorage()` function loads annotated CSV test data as if it were queried from InfluxDB. This function ensures tests behave correctly in both the Flux and InfluxDB test suites.
flux_0_x_ref
name parent
testing.loadStorage testing
/influxdb/v2.0/reference/flux/stdlib/testing/loadstorage/
/influxdb/cloud/reference/flux/stdlib/testing/loadstorage/
301
tests
inputs
0.20.0

The testing.loadStorage() function loads annotated CSV test data as if it were queried from InfluxDB. This function ensures tests behave correctly in both the Flux and InfluxDB test suites. Test data requires the following columns:

  • _field
  • _measurement
  • _time
import "testing"

testing.loadStorage(csv: csvData)

Parameters

csv

Annotated CSV data to load.

Examples

import "testing"

csvData = "
#datatype,string,long,string,dateTime:RFC3339,string,double
#group,false,false,true,false,true,false
#default,_result,,,,,
,result,table,_measurement,_time,_field,_value
,,0,m,2021-01-01T00:00:00Z,t,1.2
,,0,m,2021-01-02T00:00:00Z,t,1.4
,,0,m,2021-01-03T00:00:00Z,t,2.2
"

testing.loadStorage(csv: csvData)