How would you write an integration test that runs your Docker image against moto in CI?
AdvancedScenarioTesting, CI/CD, packaging & services
Answer
Situation read → Test the packaged artifact end to end without AWS.
What I'd do →
- Start moto as a server:
docker run -d -p 5000:5000 motoserver/motoas a service container. - Seed resources with boto3 pointed at
endpoint_url="http://localhost:5000". - Run the image with
-e AWS_ENDPOINT_URL=http://host:5000 -e AWS_ACCESS_KEY_ID=x -e AWS_SECRET_ACCESS_KEY=x -e AWS_DEFAULT_REGION=us-east-1; recent boto3 honoursAWS_ENDPOINT_URLwithout code changes. - Assert exit code and report content.
Why → Catches packaging bugs (missing modules, wrong entrypoint) that unit tests cannot.
Interview tip → Mention AWS_ENDPOINT_URL; it removes the need for test-only code paths.
More on Testing, CI/CD, packaging & services
You join a team whose Python automation repo has no tests. Where do you start?BeginnerYour pytest suite takes 12 minutes. How do you speed it up?IntermediateA test passes locally but fails in CI only when run with the rest of the suite. What do you suspect?IntermediateYou want a reusable CI pipeline for 15 Python tool repos. What goes in it?IntermediateYour Python Docker image is 1.1 GB. How do you shrink it?IntermediateYou want to distribute an internal CLI to 200 engineers. What are your options?Intermediate