osbuild-service-maintenance: Rely on the db's timezone in tests
Avoid calculating the new expire date on the test host, because differences in timezones can yield unexpected failures.
This commit is contained in:
parent
69d4429e8f
commit
fa18206918
1 changed files with 1 additions and 3 deletions
|
|
@ -6,7 +6,6 @@ import (
|
|||
"context"
|
||||
"encoding/json"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/osbuild/osbuild-composer/pkg/jobqueue/dbjobqueue"
|
||||
|
|
@ -36,8 +35,7 @@ func TestDBJobQueueMaintenance(t *testing.T) {
|
|||
}
|
||||
|
||||
func setExpired(t *testing.T, d db, id uuid.UUID) {
|
||||
expires := time.Now().Add(-time.Second)
|
||||
_, err := d.Conn.Exec(context.Background(), "UPDATE jobs SET expires_at = $1 WHERE id = $2", expires, id)
|
||||
_, err := d.Conn.Exec(context.Background(), "UPDATE jobs SET expires_at = NOW() - INTERVAL '1 SECOND' WHERE id = $1", id)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue