Skip to content

Commit

Permalink
Remove unnecessary test case for start BHP fault
Browse files Browse the repository at this point in the history
  • Loading branch information
mye956 committed Oct 3, 2024
1 parent 9bfafac commit 71d516e
Showing 1 changed file with 0 additions and 25 deletions.
25 changes: 0 additions & 25 deletions ecs-agent/tmds/handlers/fault/v1/handlers/handlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ const (
awsvpcNetworkMode = "awsvpc"
deviceName = "eth0"
invalidNetworkMode = "invalid"
iptablesChainAlreadyExistError = "iptables: Chain already exists."
iptablesChainNotFoundError = "iptables: Bad rule (does a matching rule exist in that chain?)."
tcLatencyFaultExistsCommandOutput = `[{"kind":"netem","handle":"10:","parent":"1:1","options":{"limit":1000,"delay":{"delay":123456789,"jitter":4567,"correlation":0},"ecn":false,"gap":0}}]`
tcLossFaultExistsCommandOutput = `[{"kind":"netem","handle":"10:","dev":"eth0","parent":"1:1","options":{"limit":1000,"loss-random":{"loss":0.06,"correlation":0},"ecn":false,"gap":0}}]`
Expand Down Expand Up @@ -576,30 +575,6 @@ func generateStartBlackHolePortFaultTestCases() []networkFaultInjectionTestCase
)
},
},
{
name: fmt.Sprintf("%s fail duplicate chain", startNetworkBlackHolePortTestPrefix),
expectedStatusCode: 500,
requestBody: happyBlackHolePortReqBody,
expectedResponseBody: types.NewNetworkFaultInjectionErrorResponse(internalError),
setAgentStateExpectations: func(agentState *mock_state.MockAgentState, netConfigClient *netconfig.NetworkConfigClient) {
agentState.EXPECT().GetTaskMetadataWithTaskNetworkConfig(endpointId, netConfigClient).
Return(happyTaskResponse, nil).
Times(1)
},
setExecExpectations: func(exec *mock_execwrapper.MockExec, ctrl *gomock.Controller) {
ctx, cancel := context.WithTimeout(context.Background(), requestTimeoutDuration)
cmdExec := mock_execwrapper.NewMockCmd(ctrl)
gomock.InOrder(
exec.EXPECT().NewExecContextWithTimeout(gomock.Any(), gomock.Any()).Times(1).Return(ctx, cancel),
exec.EXPECT().CommandContext(gomock.Any(), gomock.Any(), gomock.Any()).Times(1).Return(cmdExec),
cmdExec.EXPECT().CombinedOutput().Times(1).Return([]byte(iptablesChainNotFoundError), errors.New("exit status 1")),
exec.EXPECT().ConvertToExitError(gomock.Any()).Times(1).Return(nil, true),
exec.EXPECT().GetExitCode(gomock.Any()).Times(1).Return(1),
exec.EXPECT().CommandContext(gomock.Any(), gomock.Any(), gomock.Any()).Times(1).Return(cmdExec),
cmdExec.EXPECT().CombinedOutput().Times(1).Return([]byte(iptablesChainAlreadyExistError), errors.New("exit status 1")),
)
},
},
{
name: fmt.Sprintf("%s fail append rule to chain", startNetworkBlackHolePortTestPrefix),
expectedStatusCode: 500,
Expand Down

0 comments on commit 71d516e

Please sign in to comment.