line-protocol-corpus

command module
v0.0.0-...-aa28ccf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2021 License: MIT Imports: 9 Imported by: 0

README

Line-protocol corpus

This repository holds a corpus of data for testing InfluxDB line-protocol codec implementations.

The primary data is stored in CUE format, but the corpus.json file holds the exported data in JSON format.

The schema.cue file defines the format of the data. In brief, the corpus data has two top level fields, decode and encode, which hold inputs and expected results for decoding and encoding respectively.

The various inputs-*.cue files hold test inputs that have derived from different sources.

When there's an error, an explicit error string is given so that it's clear what kind of error is expected, but implementations would not be expected to reproduce that exact error.

The corpus results are intended correspond with the proposed standardised syntax proposal.

Using the corpus

To use this corpus to run against your own codec, you don't need to install CUE, as all the relevant data is exported into the corpus.json file. You'll need to write some code to translate from the unmarshaled JSON to the data structures that your own code provides, then check that the results are as expected.

Adding test cases

The corpus*.cue files are generated by running the corpus input data through the "reference" Go implementation at github.com/influxdata/line-protocol/v2/influxdata by running the generate program (use make to run it).

If there's a test case that's considered to be wrong, rather than just editing the CUE file, the reference implementation should be fixed before regenerating the files.

To add a new test case, add it to either inputs-decode-custom.cue or inputs-encode-custom.cue as appropriate, then regenerate the corpus by running make.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package lpcodecs contains various Go implementations of line-protocol codecs shoehorned into a consistent interface.
Package lpcodecs contains various Go implementations of line-protocol codecs shoehorned into a consistent interface.
Package lpcorpus provides Go support for reading the line-protocol corpus.
Package lpcorpus provides Go support for reading the line-protocol corpus.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL