@@ -125,6 +125,15 @@ func TestWorkspaceActivityBump(t *testing.T) {
125125}
126126
127127var updatedAfter time.Time
128+ // waitedFor is purely for debugging failed tests. If a test fails,
129+ // it helps to know how long it took for the deadline bump to be
130+ // detected. The longer this takes, the more likely time drift will
131+ // affect the results.
132+ waitedFor := time .Now ()
133+ // lastChecked is for logging within the Eventually loop.
134+ // Debouncing log lines to every second to prevent spam.
135+ lastChecked := time .Now ()
136+
128137// The Deadline bump occurs asynchronously.
129138require .Eventuallyf (t ,
130139func ()bool {
@@ -133,14 +142,25 @@ func TestWorkspaceActivityBump(t *testing.T) {
133142updatedAfter = dbtime .Now ()
134143if workspace .LatestBuild .Deadline .Time .Equal (firstDeadline ) {
135144updatedAfter = time .Now ()
145+ if time .Since (lastChecked )> time .Second {
146+ t .Logf ("deadline still not updated, will continue to check: deadline=%v" ,workspace .LatestBuild .Deadline .Time )
147+ lastChecked = time .Now ()
148+ }
136149return false
137150}
138151return true
139152},
140- testutil .WaitLong ,testutil .IntervalFast ,
153+ testutil .WaitMedium ,testutil .IntervalFast ,
141154"deadline %v never updated" ,firstDeadline ,
142155)
143156
157+ // This log line helps establish how long it took for the deadline
158+ // to be detected as bumped.
159+ t .Logf ("deadline bump detected: %v, waited for %s" ,
160+ workspace .LatestBuild .Deadline .Time ,
161+ time .Since (waitedFor ),
162+ )
163+
144164require .Greater (t ,workspace .LatestBuild .Deadline .Time ,updatedAfter )
145165
146166// If the workspace has a max deadline, the deadline must not exceed
@@ -156,7 +176,7 @@ func TestWorkspaceActivityBump(t *testing.T) {
156176firstDeadline ,workspace .LatestBuild .Deadline .Time ,now ,
157177now .Sub (workspace .LatestBuild .Deadline .Time ),
158178)
159- require .WithinDuration (t ,dbtime . Now () .Add (ttl ),workspace .LatestBuild .Deadline .Time ,testutil .WaitShort )
179+ require .WithinDuration (t ,now .Add (ttl ),workspace .LatestBuild .Deadline .Time ,testutil .WaitShort )
160180}
161181}
162182