Interview Prep/Python for DevOps/Concurrency, async, tests, services & containers

A moto-based test expects old snapshots to be flagged, but `describe_snapshots` always shows `StartTime` as now.

IntermediateTroubleshootingConcurrency, async, tests, services & containers
Answer

Likely causes → moto stamps resources with the current time and does not let you set creation timestamps through the API.

Diagnose → Print StartTime in the test.

Fix → Test the age logic with a stub (unittest.mock.MagicMock paginator or botocore Stubber) returning controlled timestamps, or freeze/travel time (time-machine) so "now" during the check is far in the future relative to creation.

Prevent → Separate the "is it old?" rule into a pure function that takes now as a parameter.

All Python for DevOps questions Roadmap: Python for automation

More on Concurrency, async, tests, services & containers