@@ -2973,6 +2973,34 @@ func TestGetTaskProtection(t *testing.T) {
2973
2973
},
2974
2974
})
2975
2975
})
2976
+ t .Run ("more than one ecs failure" , func (t * testing.T ) {
2977
+ testTMDSRequest (t , TMDSTestCase [agentapi.TaskProtectionResponse ]{
2978
+ path : path ,
2979
+ setStateExpectations : happyStateExpectations ,
2980
+ setCredentialsManagerExpectations : happyCredentialsManagerExpectations ,
2981
+ setTaskProtectionClientFactoryExpectations : taskProtectionClientFactoryExpectations (
2982
+ & ecs.GetTaskProtectionOutput {
2983
+ Failures : []* ecs.Failure {
2984
+ {
2985
+ Arn : aws .String (taskARN ),
2986
+ Reason : aws .String ("ecs failure 1" ),
2987
+ },
2988
+ {
2989
+ Arn : aws .String (taskARN ),
2990
+ Reason : aws .String ("ecs failure 2" ),
2991
+ },
2992
+ },
2993
+ }, nil ),
2994
+ expectedStatusCode : http .StatusInternalServerError ,
2995
+ expectedResponseBody : agentapi.TaskProtectionResponse {
2996
+ Error : & agentapi.ErrorResponse {
2997
+ Arn : taskARN ,
2998
+ Code : ecs .ErrCodeServerException ,
2999
+ Message : "Unexpected error occurred" ,
3000
+ },
3001
+ },
3002
+ })
3003
+ })
2976
3004
t .Run ("happy case" , func (t * testing.T ) {
2977
3005
testTMDSRequest (t , TMDSTestCase [agentapi.TaskProtectionResponse ]{
2978
3006
path : path ,
@@ -3204,6 +3232,32 @@ func TestUpdateTaskProtection(t *testing.T) {
3204
3232
},
3205
3233
},
3206
3234
}))
3235
+ t .Run ("more than on ecs failure" , runTest (t , TMDSTestCase [agentapi.TaskProtectionResponse ]{
3236
+ requestBody : happyReqBody ,
3237
+ setStateExpectations : happyStateExpectations ,
3238
+ setCredentialsManagerExpectations : happyCredentialsManagerExpectations ,
3239
+ setTaskProtectionClientFactoryExpectations : taskProtectionClientFactoryExpectations (
3240
+ & ecs.UpdateTaskProtectionOutput {
3241
+ Failures : []* ecs.Failure {
3242
+ {
3243
+ Arn : aws .String (taskARN ),
3244
+ Reason : aws .String ("ecs failure 1" ),
3245
+ },
3246
+ {
3247
+ Arn : aws .String (taskARN ),
3248
+ Reason : aws .String ("ecs failure 2" ),
3249
+ },
3250
+ },
3251
+ }, nil ),
3252
+ expectedStatusCode : http .StatusInternalServerError ,
3253
+ expectedResponseBody : agentapi.TaskProtectionResponse {
3254
+ Error : & agentapi.ErrorResponse {
3255
+ Arn : taskARN ,
3256
+ Code : ecs .ErrCodeServerException ,
3257
+ Message : "Unexpected error occurred" ,
3258
+ },
3259
+ },
3260
+ }))
3207
3261
t .Run ("empty request" , runTest (t , TMDSTestCase [agentapi.TaskProtectionResponse ]{
3208
3262
requestBody : map [string ]string {},
3209
3263
setStateExpectations : happyStateExpectations ,
0 commit comments