File: points_internal_test.go

package info (click to toggle)
golang-github-influxdata-influxdb1-client 0.0~git20220302.a9ab567-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 380 kB
  • sloc: makefile: 2
file content (17 lines) | stat: -rw-r--r-- 455 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package models

import "testing"

func TestMarshalPointNoFields(t *testing.T) {
	points, err := ParsePointsString("m,k=v f=0i")
	if err != nil {
		t.Fatal(err)
	}

	// It's unclear how this can ever happen, but we've observed points that were marshalled without any fields.
	points[0].(*point).fields = []byte{}

	if _, err := points[0].MarshalBinary(); err != ErrPointMustHaveAField {
		t.Fatalf("got error %v, exp %v", err, ErrPointMustHaveAField)
	}
}