Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consume updated TaskResponse in network fault injection handlers #4302

Merged
merged 1 commit into from
Aug 27, 2024

Conversation

mye956
Copy link
Contributor

@mye956 mye956 commented Aug 19, 2024

Summary

This PR will consume the TaskResponse changes that were introduced in #4285 and #4273 within the shared fault injection handlers. We will also be validating that the obtained task metadata for the corresponding incoming request for the following:

  • Is the task FaultInjectionEnabled ?
  • Using either host or awsvpc network mode
  • Does not have any null/empty values

Implementation details

  • ecs-agent/tmds/handlers/fault/v1/handlers/handlers.go
    • Modified getTaskMetadataForFault to validate the obtained task metadata from GetTaskMetadata if it satisfy the 3 checks above
  • agent/api/task/task.go
    • Added new fields NetworkNamespace and FaultInjectionEnabled with corresponding getter methods. (Note: There will be a follow up PR to initialize/set these fields)
  • agent/handlers/v4/tmdsstate.go
    • Modified getTaskMetadata to initialize FaultInjectionEnabled and a TaskNetworkConfig for the TaskResponse object to be returned if the corresponding FaultInjectionEnabled field of the Task struct is true

Testing

  • Added new test cases to ecs-agent/tmds/handlers/fault/v1/handlers/handlers_test.go for all three network fault injection handlers if:
    • FaultInjectionEnabled of TaskResponse is set to false
    • TaskNetworkConfigof TaskResponse is empty
    • NetworkMode of TaskNetworkConfig is set to an invalid value
  • Added new test cases to agent/handlers/task_server_setup_test.go for all three network fault injection if:
    • FaultInjectionEnabled of Task is set to false
    • NetworkMode of Task is set to an invalid value

New tests cover the changes: Yes

Description for the changelog

  • Feature: Consume updated TaskResponse changes to network fault injection handlers

Additional Information

Does this PR include breaking model changes? If so, Have you added transformation functions?

Does this PR include the addition of new environment variables in the README?

Licensing

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@mye956 mye956 requested a review from a team as a code owner August 19, 2024 23:49
@mye956 mye956 force-pushed the bhp-taskresponse branch 3 times, most recently from 951e8be to 0d00215 Compare August 20, 2024 00:57
@mye956 mye956 changed the title WIP DO NOT REVIEW Consume updated TaskResponse in network blackhole port tmds handler Aug 20, 2024
@mye956 mye956 requested a review from xxx0624 August 20, 2024 01:06
@mye956 mye956 force-pushed the bhp-taskresponse branch 2 times, most recently from 10de83f to 4c3e41f Compare August 20, 2024 19:28
@mye956 mye956 requested review from amogh09 and harishxr August 20, 2024 19:58
xxx0624
xxx0624 previously approved these changes Aug 20, 2024
@mye956 mye956 force-pushed the bhp-taskresponse branch 2 times, most recently from ae1fe16 to 8a595c4 Compare August 20, 2024 20:57
xxx0624
xxx0624 previously approved these changes Aug 20, 2024
@mye956 mye956 force-pushed the bhp-taskresponse branch 2 times, most recently from f7b4cc0 to ed4fcf1 Compare August 27, 2024 17:59
xxx0624
xxx0624 previously approved these changes Aug 27, 2024
agent/handlers/task_server_setup_test.go Show resolved Hide resolved
@mye956 mye956 force-pushed the bhp-taskresponse branch 2 times, most recently from 49b31c8 to 456137e Compare August 27, 2024 18:43
@mye956 mye956 changed the title Consume updated TaskResponse in network blackhole port tmds handler Consume updated TaskResponse in network fault injection handlers Aug 27, 2024
@mye956 mye956 requested a review from tshan2001 August 27, 2024 19:12
@mye956 mye956 merged commit fec74a8 into aws:dev Aug 27, 2024
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants