Skip to content

Commit

Permalink
Fix flakey tests in getjobs_test + improve JobRuntime tests (#3654)
Browse files Browse the repository at this point in the history
Signed-off-by: JamesMurkin <jamesmurkin@hotmail.com>
  • Loading branch information
JamesMurkin committed Jun 5, 2024
1 parent 05b211a commit 0785656
Show file tree
Hide file tree
Showing 2 changed files with 121 additions and 110 deletions.
4 changes: 3 additions & 1 deletion internal/lookoutv2/repository/getjobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type GetJobsRepository interface {
type SqlGetJobsRepository struct {
db *pgxpool.Pool
lookoutTables *LookoutTables
clock clock.Clock
}

type GetJobsResult struct {
Expand Down Expand Up @@ -54,6 +55,7 @@ func NewSqlGetJobsRepository(db *pgxpool.Pool) *SqlGetJobsRepository {
return &SqlGetJobsRepository{
db: db,
lookoutTables: NewTables(),
clock: clock.RealClock{},
}
}

Expand Down Expand Up @@ -121,7 +123,7 @@ func (r *SqlGetJobsRepository) getJobs(ctx *armadacontext.Context, filters []*mo
job.Node = lastRun.Node
job.Cluster = lastRun.Cluster
job.ExitCode = lastRun.ExitCode
job.RuntimeSeconds = calculateJobRuntime(lastRun.Started, lastRun.Finished, clock.RealClock{})
job.RuntimeSeconds = calculateJobRuntime(lastRun.Started, lastRun.Finished, r.clock)
}
jobs = append(jobs, job)
}
Expand Down
Loading

0 comments on commit 0785656

Please sign in to comment.