mirror of
https://github.com/Oxalide/vsphere-influxdb-go.git
synced 2023-10-10 13:36:51 +02:00
18 lines
455 B
Go
18 lines
455 B
Go
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)
|
|
}
|
|
}
|