mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix(coderd): ensure agent timings are non-zero on insert (#18065)
Relates to https://github.com/coder/coder/issues/15432 Ensures that no workspace build timings with zero values for started_at or ended_at are inserted into the DB or returned from the API.
This commit is contained in:
@@ -144,6 +144,12 @@ func TestScriptReportsTiming(t *testing.T) {
|
||||
|
||||
timing := timings[0]
|
||||
require.Equal(t, int32(0), timing.ExitCode)
|
||||
if assert.True(t, timing.Start.IsValid(), "start time should be valid") {
|
||||
require.NotZero(t, timing.Start.AsTime(), "start time should not be zero")
|
||||
}
|
||||
if assert.True(t, timing.End.IsValid(), "end time should be valid") {
|
||||
require.NotZero(t, timing.End.AsTime(), "end time should not be zero")
|
||||
}
|
||||
require.GreaterOrEqual(t, timing.End.AsTime(), timing.Start.AsTime())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user