@@ -59,6 +59,7 @@ func TestOrchestrator(t *testing.T) {
59
59
gracePeriod time.Duration
60
60
timeout time.Duration
61
61
additionalTasks []fakerunnerapi.Task
62
+ cleanup func ()
62
63
63
64
wantError string
64
65
wantTimeout bool
@@ -196,6 +197,32 @@ func TestOrchestrator(t *testing.T) {
196
197
},
197
198
},
198
199
},
200
+ {
201
+ name : "retryable error: service containers didn't become ready in time" ,
202
+ config : func () Config {
203
+ waitForReadinessTimeout = 1 * time .Millisecond
204
+ c := defaultConfig
205
+ c .ReadinessFilePath = "does-not-exist"
206
+ return c
207
+ }(),
208
+ cleanup : func () {
209
+ waitForReadinessTimeout = 10 * time .Minute
210
+ },
211
+ wantError : "error waiting for service containers to become ready: context deadline exceeded" ,
212
+ wantTaskUnclaims : []fakerunnerapi.TaskUnclaim {
213
+ {
214
+ Token : "testtoken" ,
215
+ },
216
+ },
217
+ wantTaskEvents : []fakerunnerapi.TaskEvent {
218
+ {
219
+ Allocation : defaultConfig .Allocation ,
220
+ TimestampMilli : time .Now ().UnixMilli (),
221
+ Message : []byte ("error waiting for service containers to become ready: context deadline exceeded: " +
222
+ "Check container logs for more details" ),
223
+ },
224
+ },
225
+ },
199
226
{
200
227
name : "retryable error: an unsafe retry" ,
201
228
config : Config {
@@ -252,6 +279,10 @@ func TestOrchestrator(t *testing.T) {
252
279
t .Run (tt .name , func (t * testing.T ) {
253
280
t .Setenv ("BE_TASK_AGENT" , "true" )
254
281
282
+ if tt .cleanup != nil {
283
+ t .Cleanup (tt .cleanup )
284
+ }
285
+
255
286
for k , v := range tt .env {
256
287
t .Setenv (k , v )
257
288
}
0 commit comments