Skip to content

Commit

Permalink
Rename the new field
Browse files Browse the repository at this point in the history
  • Loading branch information
xxx0624 committed Aug 15, 2024
1 parent acc5e02 commit 5e8ed27
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions ecs-agent/tmds/handlers/v4/handlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,10 @@ func taskResponse() *state.TaskResponse {
}
}

// taskResponseWithFISEnabled returns a standard agent task response
func taskResponseWithFISEnabled() *state.TaskResponse {
// taskResponseWithFaultInjectionEnabled returns a standard agent task response with FaultInjection enabled
func taskResponseWithFaultInjectionEnabled() *state.TaskResponse {
taskResponse := taskResponse()
taskResponse.FISEnabled = true
taskResponse.FaultInjectionEnabled = true
return taskResponse
}

Expand Down Expand Up @@ -296,12 +296,12 @@ func TestTaskMetadata(t *testing.T) {
})
})

t.Run("happy case with FIS enabled", func(t *testing.T) {
metadata := taskResponseWithFISEnabled()
expectedTaskResponse := taskResponseWithFISEnabled()
expectedTaskResponse.CredentialsID = "" // credentials ID not expected
expectedTaskResponse.TaskNetworkConfig = nil // TaskNetworkConfig is not expected and would be used internally
expectedTaskResponse.FISEnabled = false // FISEnabled is not expected and would be used internally
t.Run("happy case with FaultInjection enabled", func(t *testing.T) {
metadata := taskResponseWithFaultInjectionEnabled()
expectedTaskResponse := taskResponseWithFaultInjectionEnabled()
expectedTaskResponse.CredentialsID = "" // credentials ID not expected
expectedTaskResponse.TaskNetworkConfig = nil // TaskNetworkConfig is not expected and would be used internally
expectedTaskResponse.FaultInjectionEnabled = false // FaultInjectionEnabled is not expected and would be used internally

handler, _, agentState, _ := setup(t)
agentState.EXPECT().
Expand Down
2 changes: 1 addition & 1 deletion ecs-agent/tmds/handlers/v4/state/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type TaskResponse struct {
EphemeralStorageMetrics *EphemeralStorageMetrics `json:"EphemeralStorageMetrics,omitempty"`
CredentialsID string `json:"-"`
TaskNetworkConfig *TaskNetworkConfig `json:"-"`
FISEnabled bool `json:"-"`
FaultInjectionEnabled bool `json:"-"`
}

// TaskNetworkConfig contains required network configurations for network faults injection.
Expand Down

0 comments on commit 5e8ed27

Please sign in to comment.