Details
-
Bug
-
Resolution: Cannot Reproduce
-
P3: Somewhat important
-
None
-
master
-
None
Description
Executing a test in storage's thrift JSON reader/writer
src/storage/thrift_test.go
func TestSendAndReadThriftJSON(t *testing.T) { task := getTaskTemplate("3", "test/project", "test-sha1", "guru", "master", storagestructs.TaskState_Passed, 1550419099, true) buf := &bytes.Buffer{} w := bufio.NewWriter(buf) err := SendThriftAsJSON(w, &task) assert.Nil(t, err) r := bufio.NewReader(buf) newTask := storagestructs.Task{} err = ReadThriftFromJSON(r, &newTask) assert.Nil(t, err) assert.Equal(t, task, newTask)}
will result in failure
--- FAIL: TestSendAndReadThriftJSON (0.00s)
assertions.go:237:
Error Trace: thrift_test.go:120
Error: Expected nil, but got: &thrift.tProtocolException{typeId:1, message:"*storagestructs.Task read error: Expected '{' or null, but found '['"}
Printing the contents of the buffered object also gives strange result indicating that there might be something wrong with the encoding of JSON into the writer
>> fmt.Println(buf.String()) [1,"",0,0,{"2":{"i32":1},"3":{"str":"3"},"5":{"str":"test/project"},"6":{"str":"test-sha1"},"8":{"str":"master"},"10":{"i64":1550419099},"15":{"str":"guru"},"26":{"tf":1}}]