source code: py/umpire/server/e2e_test/README.md
Integration tests for Umpire docker¶
This test should be run by cros_docker.sh umpire test.
cros_docker.sh is in directory setup/ under root directory of factory
repository (in ../../../../setup relative to this directory.)
Terminology¶
Host: The machine where source tree is located.
Test Docker: The docker where main test script
e2e_test.pyis run.Umpire Docker: The Umpire docker instance to be tested, created by the main test script.
Directory structure in source tree¶
In directory py/umpire/server/e2e_test:
e2e_test.py: The main test script.Dockerfile: Dockerfile to build Test Docker.requirements.txt: Dependencies of main test script, would be installed in Test Docker.testdata/umpire: Data that would be mounted on/var/db/factory/umpirein Umpire Docker.testdata/cros_docker: Data that would be mounted on/mntin Umpire Docker.testdata/config: Testdata used by main test script.
In directory setup:
cros_docker.sh: Shell script used to control factory server services, in particular, Umpire.
Test flow¶
The test flow is as follows when cros_docker.sh umpire test is executed.
Build the factory server docker image. (Same as
cros_docker.sh build)Build Test Docker from
Dockerfilein this directory, which copiespy/, py_pkg/, bin/, setup/cros_docker.shinto/usr/local/factoryin Test Docker.Start a new Test Docker instance, with a temporary folder on Host stored in environment variable
TMPDIR, and mounted on same path inside Test Docker.Inside Test Docker, for each set of test, a new Umpire Docker is created on setUpClass, and destroyed on tearDownClass.
Inside Test Docker, when creating a new Umpire Docker, copy
testdata/cros_dockerinto${TMPDIR}/cros_docker/,testdata/umpireinto${TMPDIR}/cros_docker/umpire/${PROJECT}/, and setHOST_SHARED_DIRenvironment variable to${TMPDIR}/cros_dockerwhen callingcros_docker.sh umpire runinside main test script.The docker service on Host would then create Umpire Docker, mount
${TMPDIR}/cros_dockerto/mntin Umpire Docker,${TMPDIR}/cros_docker/umpire/${PROJECT}to/var/db/factory/umpirein Umpire Docker.Test is executed by calling other
cros_docker.shcommands, and interact with Umpire Docker.