Docker - in CI/CDYou want to run tests inside a container but only for Python files changed in your Git branch. Which approach is best?AManually copy changed files into container before testingBRun pytest on all files inside container ignoring Git changesCRun tests outside container only on changed filesDUse a script to list changed files, then run pytest on those inside the containerCheck Answer
Step-by-Step SolutionSolution:Step 1: Identify selective testing methodListing changed files via Git and passing them to pytest inside container runs only needed tests.Step 2: Evaluate other optionsRunning all tests wastes time, manual copying is error-prone, and running outside container loses environment consistency.Final Answer:Use a script to list changed files, then run pytest on those inside the container -> Option DQuick Check:Selective testing = script + container pytest [OK]Quick Trick: Filter changed files with Git, then run tests inside container [OK]Common Mistakes:Testing all files unnecessarilyCopying files manually instead of mountingRunning tests outside container losing environment
Master "in CI/CD" in Docker9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More Docker Quizzes Docker Security - Why container security matters - Quiz 6medium Docker Swarm - Overlay networks in Swarm - Quiz 14medium Docker Swarm - Overlay networks in Swarm - Quiz 5medium Docker Swarm - Deploying services in Swarm - Quiz 7medium Docker in CI/CD - Docker layer caching in CI - Quiz 12easy Docker in CI/CD - Building images in CI pipeline - Quiz 6medium Logging and Monitoring - Prometheus for Docker monitoring - Quiz 6medium Logging and Monitoring - Prometheus for Docker monitoring - Quiz 8hard Production Patterns - Canary deployment pattern - Quiz 9hard Production Patterns - Why production patterns matter - Quiz 9hard