amazon-ecs-agent icon indicating copy to clipboard operation
amazon-ecs-agent copied to clipboard

Integration testing for container restart policy

Open danehlim opened this issue 7 months ago • 0 comments

Summary

Add integration testing to ensure that as part of introducing container restart policy feature to ECS Agent:

  • Agent can synchronize container state related to container restart policy feature via on Agent restart
  • Agent does not restart containers unexpectedly
  • Agent can get restart stats for a container via the stats engine

Implementation details

  • Modify TestEngineSynchronize such that the container has fields related to container restart policy feature populated
  • Introduce TestContainerDoesNotRestartWhenShouldNotRestart which includes the following 4 test cases:
    1. container does not restart when policy disabled
    2. container does not restart when policy not configured
    3. container does not restart when policy enabled and container exits with ignored exit code
    4. container does not restart when policy enabled and container exits before AttemptResetPeriod
  • Introduce TestRestartStats - this test is similar to existing test TestStorageStats

Testing

New tests cover the changes: yes (or N/A, since only integration tests are changed as part of this pull request)

Description for the changelog

N/A (Enhancement: Integration testing for container restart policy)

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

No

Licensing

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

danehlim avatar Jul 02 '24 20:07 danehlim