Skip to content

Commit

Permalink
fix(database/logs): consistency between drivers
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrockopp committed Jul 11, 2023
1 parent 95ed34b commit 387eed0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions database/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -539,8 +539,8 @@ func testLogs(t *testing.T, db Interface, resources *Resources) {
if int(count) != len(resources.Logs) {
t.Errorf("ListLogsForBuild() is %v, want %v", count, len(resources.Logs))
}
if !reflect.DeepEqual(list, []*library.Log{resources.Logs[2], resources.Logs[3], resources.Logs[0], resources.Logs[1]}) {
t.Errorf("ListLogsForBuild() is %v, want %v", list, []*library.Log{resources.Logs[2], resources.Logs[3], resources.Logs[0], resources.Logs[1]})
if !reflect.DeepEqual(list, resources.Logs) {
t.Errorf("ListLogsForBuild() is %v, want %v", list, resources.Logs)
}
counter++

Expand Down
1 change: 1 addition & 0 deletions database/log/list_build.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func (e *engine) ListLogsForBuild(b *library.Build, page, perPage int) ([]*libra
err = e.client.
Table(constants.TableLog).
Where("build_id = ?", b.GetID()).
Order("service_id ASC NULLS LAST").
Order("step_id ASC").
Limit(perPage).
Offset(offset).
Expand Down
2 changes: 1 addition & 1 deletion database/log/list_build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestLog_Engine_ListLogsForBuild(t *testing.T) {
AddRow(1, 1, 1, 1, 0, []byte{}).AddRow(2, 1, 1, 0, 1, []byte{})

// ensure the mock expects the query
_mock.ExpectQuery(`SELECT * FROM "logs" WHERE build_id = $1 ORDER BY step_id ASC LIMIT 10`).WithArgs(1).WillReturnRows(_rows)
_mock.ExpectQuery(`SELECT * FROM "logs" WHERE build_id = $1 ORDER BY service_id ASC NULLS LAST,step_id ASC LIMIT 10`).WithArgs(1).WillReturnRows(_rows)

_sqlite := testSqlite(t)
defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }()
Expand Down

0 comments on commit 387eed0

Please sign in to comment.