Skip to content

Commit

Permalink
Fix the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
M. Mert Yildiran committed May 8, 2022
1 parent 01d399c commit c66c4e1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions client/go/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,11 @@ func TestFetch(t *testing.T) {
data, firstMeta, lastMeta, err := Fetch(HOST, PORT, fmt.Sprintf("%024d", 100), -1, `chevy`, 20, 20*time.Second)
assert.Nil(t, err)

assert.Equal(t, fmt.Sprintf(`{"current":1,"total":15000,"numberOfWritten":0,"leftOff":"%s","truncatedTimestamp":0,"noMoreData":false}`, fmt.Sprintf("%024d", 98)), string(firstMeta))
assert.Equal(t, fmt.Sprintf(`{"current":20,"total":15000,"numberOfWritten":19,"leftOff":"%s","truncatedTimestamp":0,"noMoreData":false}`, fmt.Sprintf("%024d", 79)), string(lastMeta))
assert.Equal(t, fmt.Sprintf(`{"current":1,"total":15000,"numberOfWritten":0,"leftOff":"%s","truncatedTimestamp":0,"noMoreData":false}`, fmt.Sprintf("%024d", 99)), string(firstMeta))
assert.Equal(t, fmt.Sprintf(`{"current":20,"total":15000,"numberOfWritten":19,"leftOff":"%s","truncatedTimestamp":0,"noMoreData":false}`, fmt.Sprintf("%024d", 80)), string(lastMeta))

i := 0
for id := 99; id > 80; id-- {
for id := 100; id > 80; id-- {
expected := fmt.Sprintf(`{"brand":{"name":"Chevrolet"},"id":"%s","model":"Camaro","year":"%s"}`, fmt.Sprintf("%024d", id-1), REDACTED)
assert.JSONEq(t, expected, string(data[i]))
i++
Expand Down
12 changes: 6 additions & 6 deletions server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -451,19 +451,19 @@ func TestServerProtocolFetchMode(t *testing.T) {
break
}

if row.direction < 0 {
index--
} else {
index++
}

if index >= total || index < 0 {
return
}

expected := fmt.Sprintf(`{"brand":{"name":"Chevrolet"},"id":"%s","model":"Camaro","year":2021}`, basenine.IndexToID(index))
assert.JSONEq(t, expected, string(bytes))

if row.direction < 0 {
index--
} else {
index++
}

counter++

if counter >= row.expected {
Expand Down

0 comments on commit c66c4e1

Please sign in to comment.