Merge pull request #4188 from influxdata/flux-0.174

Flux 0.174 release notes
pull/4180/head^2
sunbryely-influxdata 2022-07-06 15:32:16 -07:00 committed by GitHub
commit b93e8161b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
48 changed files with 355 additions and 51 deletions

View File

@ -11,6 +11,31 @@ aliases:
---
## v0.174.0 [2022-07-05]
### Features
- Add coloring highlights to test outputs.
- Promote [`experimental.to()`](/flux/v0.x/stdlib/experimental/to/) to
[`influxdata.influxdb.wideTo()`](/flux/v0.x/stdlib/influxdata/influxdb/wideto/).
- Allow physical plan
[`attributes`](https://github.com/influxdata/flux/blob/master/plan/attributes.go)
to contribute to
[`formatter`](https://github.com/influxdata/flux/blob/master/plan/format.go)
details.
- Add tagging support to Flux tests.
- Add new function [`experimental.catch()`](/flux/v0.x/stdlib/experimental/catch/).
- Add new function [`testing.shouldError()`](flux/v0.x/stdlib/testing/shoulderror/).
### Bug fixes
- Update `httpWriter` struct to skip invalid floats.
- Update [`join()`](/flux/v0.x/stdlib/join/) to validate group keys.
- Fix unit tests for [`covariance()`](/flux/v0.x/stdlib/universe/covariance/).
- Update all Flux packages to additionally live as Go packages.
---
## v0.173.0 [2022-06-29]
### Breaking changes

View File

@ -22,7 +22,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L74-L74
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L75-L75
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -21,7 +21,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L490-L494
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L486-L490
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -10,7 +10,7 @@ menu:
weight: 201
introduced: 0.155.0
deprecated: 0.172.0
deprecated: 0.173.0
---
<!------------------------------------------------------------------------------

View File

@ -11,7 +11,7 @@ menu:
weight: 201
introduced: 0.155.0
deprecated: 0.172.0
deprecated: 0.173.0
---
<!------------------------------------------------------------------------------

View File

@ -11,7 +11,7 @@ menu:
weight: 201
introduced: 0.155.0
deprecated: 0.172.0
deprecated: 0.173.0
---
<!------------------------------------------------------------------------------

View File

@ -0,0 +1,65 @@
---
title: experimental.catch() function
description: >
`experimental.catch()` calls a function and returns any error as a string value.
If the function does not error the returned value is made into a string and returned.
menu:
flux_0_x_ref:
name: experimental.catch
parent: experimental
identifier: experimental/catch
weight: 101
introduced: 0.174.0
---
<!------------------------------------------------------------------------------
IMPORTANT: This page was generated from comments in the Flux source code. Any
edits made directly to this page will be overwritten the next time the
documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1317-L1317
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
------------------------------------------------------------------------------->
`experimental.catch()` calls a function and returns any error as a string value.
If the function does not error the returned value is made into a string and returned.
##### Function type signature
```js
(fn: () => A) => string
```
{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}
## Parameters
### fn
({{< req >}})
Function to call.
## Examples
### Catch an explicit error
```js
import "experimental"
experimental.catch(fn: () => die(msg: "error message"))// Returns "error message"
```

View File

@ -22,7 +22,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L445-L445
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L441-L441
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -21,7 +21,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L681-L681
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L677-L677
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -21,7 +21,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1042-L1042
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1038-L1038
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -21,7 +21,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1076-L1076
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1072-L1072
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -22,7 +22,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1100-L1100
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1096-L1096
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -20,7 +20,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L174-L174
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L175-L175
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -22,7 +22,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1257-L1261
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1253-L1257
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -22,7 +22,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L745-L749
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L741-L745
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -84,12 +84,12 @@ requests.peek(response: requests.get(url: "https://api.agify.io", params: ["name
Connection: keep-alive,
Content-Length: 41,
Content-Type: application/json; charset=utf-8,
Date: Wed, 29 Jun 2022 20:19:39 GMT,
Date: Tue, 05 Jul 2022 20:54:45 GMT,
Etag: W/"29-klDahUESBLxHyQ7NiaetCn2CvCI",
Server: nginx/1.16.1,
X-Rate-Limit-Limit: 1000,
X-Rate-Limit-Remaining: 998,
X-Rate-Reset: 13221
X-Rate-Reset: 11115
] | 200 |
{{% /expand %}}

View File

@ -21,7 +21,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L643-L647
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L639-L643
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -22,7 +22,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L399-L403
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L395-L399
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -196,10 +196,10 @@ array.from(
#### Output data
| id | color | pendingDuration |
| -------- | ------ | ---------------- |
| 15612462 | red | 3 |
| 15612462 | blue | 16 |
| pendingDuration | id | color |
| ---------------- | -------- | ------ |
| 3 | 15612462 | red |
| 16 | 15612462 | blue |
{{% /expand %}}
{{< /expand-wrapper >}}

View File

@ -22,7 +22,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1015-L1015
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1011-L1011
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -22,7 +22,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1124-L1124
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1120-L1120
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -22,7 +22,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1148-L1148
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1144-L1144
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -22,7 +22,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L773-L773
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L769-L769
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -22,7 +22,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1172-L1172
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1168-L1168
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -22,7 +22,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L807-L807
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L803-L803
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -21,7 +21,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L199-L199
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L200-L200
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -21,7 +21,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1291-L1291
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1287-L1287
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -22,7 +22,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L879-L884
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L875-L880
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -21,7 +21,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L243-L243
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L244-L244
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -22,7 +22,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L906-L906
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L902-L902
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -22,7 +22,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L928-L928
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L924-L924
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -22,7 +22,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L968-L968
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L964-L964
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -22,7 +22,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L133-L133
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L134-L134
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -21,7 +21,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L989-L989
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L985-L985
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -10,6 +10,7 @@ menu:
weight: 101
flux/v0.x/tags: [outputs]
introduced: 0.40.0
deprecated: 0.174.0
---
<!------------------------------------------------------------------------------
@ -21,7 +22,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L305-L315
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L311-L311
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -30,6 +31,9 @@ Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
`experimental.to()` writes _pivoted_ data to an InfluxDB 2.x or InfluxDB Cloud bucket.
**Deprecated**: `experimental.to()` is deprecated in favor of [`wideTo()`](https://docs.influxdata.com/flux/v0.x/stdlib/influxdata/influxdb/wideTo/),
which is an equivalent function.
#### Requirements and behavior
- Requires both a `_time` and a `_measurement` column.
- All columns in the group key (other than `_measurement`) are written as tags

View File

@ -21,7 +21,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1201-L1201
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1197-L1197
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -21,7 +21,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1299-L1302
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1295-L1298
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -21,7 +21,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L575-L590
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L571-L586
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -82,12 +82,12 @@ requests.peek(response: requests.get(url: "https://api.agify.io", params: ["name
Connection: keep-alive,
Content-Length: 41,
Content-Type: application/json; charset=utf-8,
Date: Wed, 29 Jun 2022 20:19:40 GMT,
Date: Tue, 05 Jul 2022 20:54:46 GMT,
Etag: W/"29-klDahUESBLxHyQ7NiaetCn2CvCI",
Server: nginx/1.16.1,
X-Rate-Limit-Limit: 1000,
X-Rate-Limit-Remaining: 996,
X-Rate-Reset: 13219
X-Rate-Reset: 11113
] | 200 |
{{% /expand %}}

View File

@ -0,0 +1,131 @@
---
title: influxdb.wideTo() function
description: >
`influxdb.wideTo()` writes wide data to an InfluxDB 2.x or InfluxDB Cloud bucket.
Wide data is _pivoted_ in that its fields are represented as columns making the table wider.
menu:
flux_0_x_ref:
name: influxdb.wideTo
parent: influxdata/influxdb
identifier: influxdata/influxdb/wideTo
weight: 201
flux/v0.x/tags: [outputs]
introduced: 0.174.0
---
<!------------------------------------------------------------------------------
IMPORTANT: This page was generated from comments in the Flux source code. Any
edits made directly to this page will be overwritten the next time the
documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/influxdata/influxdb/influxdb.flux#L440-L450
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
------------------------------------------------------------------------------->
`influxdb.wideTo()` writes wide data to an InfluxDB 2.x or InfluxDB Cloud bucket.
Wide data is _pivoted_ in that its fields are represented as columns making the table wider.
#### Requirements and behavior
- Requires both a `_time` and a `_measurement` column.
- All columns in the group key (other than `_measurement`) are written as tags
with the column name as the tag key and the column value as the tag value.
- All columns **not** in the group key (other than `_time`) are written as
fields with the column name as the field key and the column value as the field value.
If using the `from()` to query data from InfluxDB, use pivot() to transform
data into the structure `experimental.to()` expects.
##### Function type signature
```js
(
<-tables: stream[A],
?bucket: string,
?bucketID: string,
?host: string,
?org: string,
?orgID: string,
?token: string,
) => stream[A] where A: Record
```
{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}
## Parameters
### bucket
Name of the bucket to write to.
_`bucket` and `bucketID` are mutually exclusive_.
### bucketID
String-encoded bucket ID to to write to.
_`bucket` and `bucketID` are mutually exclusive_.
### host
URL of the InfluxDB instance to write to.
See [InfluxDB Cloud regions](https://docs.influxdata.com/influxdb/cloud/reference/regions/)
or [InfluxDB OSS URLs](https://docs.influxdata.com/influxdb/latest/reference/urls/).
`host` is required when writing to a remote InfluxDB instance.
If specified, `token` is also required.
### org
Organization name.
_`org` and `orgID` are mutually exclusive_.
### orgID
String-encoded organization ID to query.
_`org` and `orgID` are mutually exclusive_.
### token
InfluxDB API token.
**InfluxDB 1.x or Enterprise**: If authentication is disabled, provide an
empty string (`""`). If authentication is enabled, provide your InfluxDB
username and password using the `<username>:<password>` syntax.
`token` is required when writing to another organization or when `host`
is specified.
### tables
Input data. Default is piped-forward data (`<-`).
## Examples
### Pivot and write data to InfluxDB
```js
import "influxdata/influxdb"
import "influxdata/influxdb/schema"
from(bucket: "example-bucket")
|> range(start: -1h)
|> schema.fieldsAsCols()
|> wideTo(bucket: "example-target-bucket")
```

View File

@ -42,12 +42,23 @@ import "testing"
```js
option testing.load = (tables=<-) => tables
option testing.tags = []
```
### load
`load` loads test data from a stream of tables.
### tags
`tags` is a list of tags that will be applied to a test case.
The test harness allows filtering based on included tags.
Tags are expected to be overridden per test file and test case
using normal option semantics.
## Functions

View File

@ -21,7 +21,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/testing/testing.flux#L83-L83
https://github.com/influxdata/flux/blob/master/stdlib/testing/testing.flux#L92-L92
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -20,7 +20,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/testing/testing.flux#L52-L52
https://github.com/influxdata/flux/blob/master/stdlib/testing/testing.flux#L61-L61
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -21,7 +21,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/testing/testing.flux#L223-L225
https://github.com/influxdata/flux/blob/master/stdlib/testing/testing.flux#L232-L234
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -21,7 +21,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/testing/testing.flux#L143-L160
https://github.com/influxdata/flux/blob/master/stdlib/testing/testing.flux#L152-L169
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -21,7 +21,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/testing/testing.flux#L202-L202
https://github.com/influxdata/flux/blob/master/stdlib/testing/testing.flux#L211-L211
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -0,0 +1,68 @@
---
title: testing.shouldError() function
description: >
`testing.shouldError()` calls a function catches any error and checks that the error matches the expected value.
menu:
flux_0_x_ref:
name: testing.shouldError
parent: testing
identifier: testing/shouldError
weight: 101
flux/v0.x/tags: [tests]
introduced: 0.174.0
---
<!------------------------------------------------------------------------------
IMPORTANT: This page was generated from comments in the Flux source code. Any
edits made directly to this page will be overwritten the next time the
documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/testing/testing.flux#L256-L260
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
------------------------------------------------------------------------------->
`testing.shouldError()` calls a function catches any error and checks that the error matches the expected value.
##### Function type signature
```js
(fn: () => A, want: string) => stream[{v: string, _diff: string}]
```
{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}
## Parameters
### fn
({{< req >}})
Function to call.
### want
({{< req >}})
Expected error string.
## Examples
### Test die function errors
```js
import "testing"
testing.shouldError(fn: () => die(msg: "error message"), want: "error message")
```

View File

@ -129,14 +129,14 @@ union(tables: [t1, t2])
| _time | _value | tag |
| -------------------- | ------- | ---- |
| 2021-01-01T00:00:00Z | 0 | bar |
| 2021-01-02T00:00:00Z | -1 | bar |
| 2021-01-03T00:00:00Z | -2 | bar |
| 2021-01-04T00:00:00Z | -3 | bar |
| 2021-01-01T00:00:00Z | 1 | foo |
| 2021-01-02T00:00:00Z | 2 | foo |
| 2021-01-03T00:00:00Z | 3 | foo |
| 2021-01-04T00:00:00Z | 4 | foo |
| 2021-01-01T00:00:00Z | 0 | bar |
| 2021-01-02T00:00:00Z | -1 | bar |
| 2021-01-03T00:00:00Z | -2 | bar |
| 2021-01-04T00:00:00Z | -3 | bar |
{{% /expand %}}
{{< /expand-wrapper >}}