| 1 |
|
| 2 |
set -e |
| 3 |
|
| 4 |
source hack/make/.integration-test-helpers |
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
: "${DOCKER_PY_COMMIT:=7.1.0}" |
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
: "${PY_TEST_OPTIONS:=--junitxml=${DEST}/junit-report.xml --deselect=tests/integration/api_container_test.py::AttachContainerTest::test_attach_no_stream --deselect=tests/integration/api_container_test.py::AttachContainerTest::test_run_container_reading_socket_ws --deselect=tests/integration/models_containers_test.py::ContainerCollectionTest::test_run_with_networking_config}" |
| 19 |
|
| 20 |
|
| 21 |
if [ -n "$TEST_INTEGRATION_USE_SNAPSHOTTER" ]; then |
| 22 |
PY_TEST_OPTIONS="$PY_TEST_OPTIONS --deselect=tests/integration/api_build_test.py::BuildTest::test_build_squash" |
| 23 |
fi |
| 24 |
|
| 25 |
|
| 26 |
PY_TEST_OPTIONS="$PY_TEST_OPTIONS --deselect=tests/integration/api_build_test.py::BuildTest::test_build_container_with_target" |
| 27 |
|
| 28 |
|
| 29 |
PY_TEST_OPTIONS="$PY_TEST_OPTIONS --deselect=tests/integration/api_image_test.py::CommitTest::test_commit" |
| 30 |
PY_TEST_OPTIONS="$PY_TEST_OPTIONS --deselect=tests/integration/api_image_test.py::CommitTest::test_commit_with_changes" |
| 31 |
|
| 32 |
|
| 33 |
PY_TEST_OPTIONS="$PY_TEST_OPTIONS --deselect=tests/integration/models_containers_test.py::ContainerTest::test_exec_run_failed" |
| 34 |
( |
| 35 |
bundle .integration-daemon-start |
| 36 |
|
| 37 |
docker_host_scheme=$(echo "${DOCKER_HOST}" | cut -d: -f1 -) |
| 38 |
|
| 39 |
case "${docker_host_scheme}" in |
| 40 |
unix) |
| 41 |
|
| 42 |
run_opts="--mount type=bind,src=${DOCKER_HOST#unix://},dst=/var/run/docker.sock" |
| 43 |
;; |
| 44 |
|
| 45 |
tcp) |
| 46 |
|
| 47 |
|
| 48 |
run_opts="--network=host -e DOCKER_HOST=${DOCKER_HOST}" |
| 49 |
;; |
| 50 |
|
| 51 |
*) |
| 52 |
echo "WARN: Skipping test-docker-py: connecting to docker daemon using ${docker_host_scheme} (${DOCKER_HOST}) not supported" |
| 53 |
bundle .integration-daemon-stop |
| 54 |
return 0 |
| 55 |
;; |
| 56 |
esac |
| 57 |
|
| 58 |
docker_py_image="docker-sdk-python3:${DOCKER_PY_COMMIT}" |
| 59 |
if ! docker image inspect "dockerPyImage" &> /dev/null; then |
| 60 |
echo INFO: Building ${docker_py_image}... |
| 61 |
( |
| 62 |
[ -n "${TESTDEBUG}" ] && set -x |
| 63 |
[ -z "${TESTDEBUG}" ] && build_opts="--quiet" |
| 64 |
[ -f /.dockerenv ] || build_opts="${build_opts} --network=host" |
| 65 |
|
| 66 |
|
| 67 |
exec docker build ${build_opts} -t "${docker_py_image}" --build-arg VERSION="${DOCKER_PY_COMMIT}" -f tests/Dockerfile "https://github.com/docker/docker-py.git#${DOCKER_PY_COMMIT}" |
| 68 |
) |
| 69 |
fi |
| 70 |
|
| 71 |
echo INFO: Starting docker-py tests... |
| 72 |
( |
| 73 |
[ -n "${TESTDEBUG}" ] && set -x |
| 74 |
|
| 75 |
exec docker run --rm ${run_opts} --mount type=bind,"src=${ABS_DEST}","dst=/src/${DEST}" "${docker_py_image}" pytest ${PY_TEST_OPTIONS} tests/integration |
| 76 |
) |
| 77 |
bundle .integration-daemon-stop |
| 78 |
) &> >(tee -a "$DEST/test.log") |