influxdata/line-protocol

test failure: split field overflow differences in encoder vs writer

Closed this issue · 0 comments

The encoder_test.go case:

	{
		name:     "split_fields_overflow",
		maxBytes: 43,
		input: NewMockMetric(
			"cpu",
			map[string]string{},
			map[string]interface{}{
				"abc": 123,
				"def": 456,
				"ghi": 789,
				"jkl": 123,
			},
			time.Unix(1519194109, 42),
		),
		output: []byte("cpu abc=123i,def=456i 1519194109000000042\ncpu ghi=789i,jkl=123i 1519194109000000042\n"),
	},

Fails in testing the writer with:

--- FAIL: TestWriter (0.00s)
    --- FAIL: TestWriter/split_fields_overflow (0.00s)
        encoder_test.go:537: expected output cpu abc=123i,def=456i 1519194109000000042
            cpu ghi=789i,jkl=123i 1519194109000000042
            , but got cpu abc=123i,def=456i 1519194109000000042
            cpu ghi=789i 1519194109000000042
            cpu jkl=123i 1519194109000000042

However, if I "fix" the test by changing the expectations the encoder test then fails.

It looks like there is significant overlap between the encoder and the writer in the code; the encoder / writer tests use the same input. However, there is something different between the two. Should it be the same code?