ETExamTower
Q26Infrastructure and Automation

A container that runs a Python script fails when it reaches the integration-testing stage of the CI/CD process. The code has been thoroughly reviewed, and the build process succeeds for this container; all other containers pass unit and integration tests. What should be verified to fix the issue?

← → navigate · a answer
Community votes
B
50% (5)
A
30% (3)
C
20% (2)
D
0% (0)
Discussion · 18
14
I pick A
11
A: does not make sense since the docker file does not expose the ports. The purpose of the EXPOSE command in the docker file is only for documentation. The port exposure happens at runtime with the -p argument. https://docs.docker.com/engine/reference/builder/#expose "The EXPOSE instruction does not actually publish the port. It functions as a type of documentation between the person who builds the image and the person who runs the container, about which ports are intended to be published. To actually publish the port when running the container, use the -p flag on docker run to publish and map one or more ports, or the -P flag to publish all exposed ports and map them to high-order ports."
3
Agreed with fechao, only wrong port exposure can lead to a successful build, the other choices would make the build fail first
3
pretty much all answers could be right depending on how the integration phase/script/environment was set up
A 3
Selected Answer: A I would pick A if the integration phase is being handled by another device/software outside the container, and B if it is not. It depends on how the environment is deployed and the question doesn't make that clear.
2
agree with fechao and endermao, Integration tests are there to make sure access to external systems works as expected. Database writes and reads, API calls, and basically every I/O operation your application is doing.
2
I agree with A. But your reason is not correct. The build could still succeed with other errors. The question implies Unit Test has passed but it failed at Integration Test. The rest is the same as thinkingape.
A 2
Selected Answer: A Correct answer: A Build succeeds. Other answers: build would fail.
2
IMO is A unit tests passed so B is out, I would also say C, including reviews (which can be valid for all at the same time) A is because you don't have to use EXPOSE word in Dockerfile, but you can expose the wrong port by starting the app
B 2
Selected Answer: B In the context of a container running a Python script that fails during the integration testing phase of the CI/CD process, verifying that the required modules and packages are installed on build is essential.
1
I agree that B is the answer.
B 1
Selected Answer: B I'm going with B, since the issue is happening in the integration testing phase. The script might rely on packages that are not available in build
B 1
Selected Answer: B The other options are less likely to be causing the issue. Option A, checking that the correct port is exposed in the Dockerfile, is unlikely to be the problem because the container is passing unit and integration testing. Option C, checking that the script is running from the right directory, is also unlikely to be the issue because the code has been reviewed thoroughly. Option D, checking that the Python version of the container image is correct, is also unlikely to be the issue because all other containers are passing unit and integration testing.
1
Correct answer is C: To fix the issue of a container running a Python script failing during the integration testing phase, you should verify option: C. that the script is running from the right directory. Integration tests can depend on the working directory where the script is executed, and if the script is not running from the correct directory, it can cause failures. Make sure the script is running in the proper directory with the necessary files and dependencies available. While the other options may also matter in some cases, such as checking the exposed port or verifying that the required modules are installed, the issue described in the question is tied to script execution and directory context. Therefore, verifying that the script is running from the correct directory is the most relevant step to take in this context
C 1
Selected Answer: C The build process succeded on this container, so B and D are ruled out. A is ruled out because the container had the correct port exposed on it during standalone testing, so the dockerfile has the port exposed properly. Only C remains
B 1
Selected Answer: B the python code usually doesn't handle networking concerns.
A 1
Selected Answer: A It looks like unit testing is fine. But integration tests are failing. So it doesn't have the needed connection to the other components.
C 1
Selected Answer: C i choose C. rationale: Answer C points to a problem with the script. it can't be the build process, because the prompt says it works. it's not the code itself, since the prompt says the code was reviewed thoroughly. the integration test could fail because the right port wasn't open from the container, but as others have mentioned, EXPOSE doesn't actually EXPOSE the ports. so, the one choice left is to run the script from the right location.