@@ -59,6 +59,7 @@ func TestOrchestrator(t *testing.T) {
5959 gracePeriod time.Duration
6060 timeout time.Duration
6161 additionalTasks []fakerunnerapi.Task
62+ cleanup func ()
6263
6364 wantError string
6465 wantTimeout bool
@@ -196,6 +197,32 @@ func TestOrchestrator(t *testing.T) {
196197 },
197198 },
198199 },
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+ },
199226 {
200227 name : "retryable error: an unsafe retry" ,
201228 config : Config {
@@ -252,6 +279,10 @@ func TestOrchestrator(t *testing.T) {
252279 t .Run (tt .name , func (t * testing.T ) {
253280 t .Setenv ("BE_TASK_AGENT" , "true" )
254281
282+ if tt .cleanup != nil {
283+ t .Cleanup (tt .cleanup )
284+ }
285+
255286 for k , v := range tt .env {
256287 t .Setenv (k , v )
257288 }
0 commit comments