~charles/logquery

fc1cb173fc50dc7f76084873c5e34f07a84c258a — Charles Daniels 3 years ago e9a8326 master
fix flaky CSV test

verified with  go test -run=Test_CSV -count=1000 ./

The fix was simply to explicitly specify the order of columns in the
SELECT query.
1 files changed, 2 insertions(+), 4 deletions(-)

M logquery_test.go
M logquery_test.go => logquery_test.go +2 -4
@@ 78,14 78,12 @@ event=error code=456 msg="something went wrong" timestamp="1970-01-01 18:56" fla
}

func Test_CSV(t *testing.T) {
	// TODO: this test is flaky because the keys can be in potentially any
	// order.

	input := "c1=5 c2=true c3=3.4\nc1=3 c2=false c3=5.1"
	inputReader := strings.NewReader(input)
	buf := bytes.NewBufferString("")

	err := RunQuery(inputReader, buf, "SELECT * FROM log;", CSV)
	// We use an explicit list of columns so as to guarantee their order.
	err := RunQuery(inputReader, buf, "SELECT c1,c2,c3 FROM log;", CSV)
	assert.Nil(t, err)

	assert.Equal(t, "c1,c2,c3\n5,true,3.4\n3,false,5.1\n", buf.String())