@@ -1166,62 +1166,62 @@ func TestDockerWaitUntilRunning(t *testing.T) {
1166
1166
mockDockerClient .AssertExpectations (t )
1167
1167
})
1168
1168
1169
- t .Run ("FailFastOnExited" , func (t * testing.T ) {
1170
- // If the container is immediately exited, we should fail fast instead of waiting.
1171
- mockDockerClient := new (MockDockerClient )
1172
- // Always return non-running, exited state
1173
- mockDockerClient .On ("ContainerInspect" , mock .Anything , containerID ).Return (types.ContainerJSON {
1174
- ContainerJSONBase : & types.ContainerJSONBase {
1175
- State : & types.ContainerState {
1176
- Status : "exited" ,
1177
- Running : false ,
1178
- ExitCode : 137 ,
1179
- },
1180
- },
1181
- }, nil )
1182
-
1183
- err := dockerWaitUntilRunning (ctx , mockDockerClient , containerID , pollingInterval )
1184
- require .Error (t , err )
1185
- require .Contains (t , err .Error (), "terminal state" )
1186
- mockDockerClient .AssertExpectations (t )
1187
- })
1188
-
1189
- t .Run ("FailFastOnDead" , func (t * testing.T ) {
1190
- mockDockerClient := new (MockDockerClient )
1191
- mockDockerClient .On ("ContainerInspect" , mock .Anything , containerID ).Return (types.ContainerJSON {
1192
- ContainerJSONBase : & types.ContainerJSONBase {
1193
- State : & types.ContainerState {
1194
- Status : "dead" ,
1195
- Running : false ,
1196
- Error : "killed" ,
1197
- },
1198
- },
1199
- }, nil )
1200
-
1201
- err := dockerWaitUntilRunning (ctx , mockDockerClient , containerID , pollingInterval )
1202
- require .Error (t , err )
1203
- require .Contains (t , err .Error (), "container entered terminal state" )
1204
- mockDockerClient .AssertExpectations (t )
1205
- })
1206
-
1207
- t .Run ("FailFastOnExitCodeNonZeroWithoutRestarting" , func (t * testing.T ) {
1208
- mockDockerClient := new (MockDockerClient )
1209
- mockDockerClient .On ("ContainerInspect" , mock .Anything , containerID ).Return (types.ContainerJSON {
1210
- ContainerJSONBase : & types.ContainerJSONBase {
1211
- State : & types.ContainerState {
1212
- Status : "created" ,
1213
- Running : false ,
1214
- Restarting : false ,
1215
- ExitCode : 1 ,
1216
- },
1217
- },
1218
- }, nil )
1219
-
1220
- err := dockerWaitUntilRunning (ctx , mockDockerClient , containerID , pollingInterval )
1221
- require .Error (t , err )
1222
- require .Contains (t , err .Error (), "exited before running" )
1223
- mockDockerClient .AssertExpectations (t )
1224
- })
1169
+ t .Run ("FailFastOnExited" , func (t * testing.T ) {
1170
+ // If the container is immediately exited, we should fail fast instead of waiting.
1171
+ mockDockerClient := new (MockDockerClient )
1172
+ // Always return non-running, exited state
1173
+ mockDockerClient .On ("ContainerInspect" , mock .Anything , containerID ).Return (types.ContainerJSON {
1174
+ ContainerJSONBase : & types.ContainerJSONBase {
1175
+ State : & types.ContainerState {
1176
+ Status : "exited" ,
1177
+ Running : false ,
1178
+ ExitCode : 137 ,
1179
+ },
1180
+ },
1181
+ }, nil )
1182
+
1183
+ err := dockerWaitUntilRunning (ctx , mockDockerClient , containerID , pollingInterval )
1184
+ require .Error (t , err )
1185
+ require .Contains (t , err .Error (), "terminal state" )
1186
+ mockDockerClient .AssertExpectations (t )
1187
+ })
1188
+
1189
+ t .Run ("FailFastOnDead" , func (t * testing.T ) {
1190
+ mockDockerClient := new (MockDockerClient )
1191
+ mockDockerClient .On ("ContainerInspect" , mock .Anything , containerID ).Return (types.ContainerJSON {
1192
+ ContainerJSONBase : & types.ContainerJSONBase {
1193
+ State : & types.ContainerState {
1194
+ Status : "dead" ,
1195
+ Running : false ,
1196
+ Error : "killed" ,
1197
+ },
1198
+ },
1199
+ }, nil )
1200
+
1201
+ err := dockerWaitUntilRunning (ctx , mockDockerClient , containerID , pollingInterval )
1202
+ require .Error (t , err )
1203
+ require .Contains (t , err .Error (), "container entered terminal state" )
1204
+ mockDockerClient .AssertExpectations (t )
1205
+ })
1206
+
1207
+ t .Run ("FailFastOnExitCodeNonZeroWithoutRestarting" , func (t * testing.T ) {
1208
+ mockDockerClient := new (MockDockerClient )
1209
+ mockDockerClient .On ("ContainerInspect" , mock .Anything , containerID ).Return (types.ContainerJSON {
1210
+ ContainerJSONBase : & types.ContainerJSONBase {
1211
+ State : & types.ContainerState {
1212
+ Status : "created" ,
1213
+ Running : false ,
1214
+ Restarting : false ,
1215
+ ExitCode : 1 ,
1216
+ },
1217
+ },
1218
+ }, nil )
1219
+
1220
+ err := dockerWaitUntilRunning (ctx , mockDockerClient , containerID , pollingInterval )
1221
+ require .Error (t , err )
1222
+ require .Contains (t , err .Error (), "exited before running" )
1223
+ mockDockerClient .AssertExpectations (t )
1224
+ })
1225
1225
}
1226
1226
1227
1227
func TestHwGPU (t * testing.T ) {
0 commit comments