kumquat-buildroot/support/testing/tests/package/test_docker_compose.py

66 lines
2.7 KiB
Python
Raw Normal View History

import os
import infra.basetest
class TestDockerCompose(infra.basetest.BRTest):
config = \
"""
BR2_x86_64=y
BR2_x86_core2=y
BR2_TOOLCHAIN_BUILDROOT_GLIBC=y
BR2_KERNEL_HEADERS_4_19=y
package/docker-compose: bump version to 1.24.1 Fixes https://gitlab.com/buildroot.org/buildroot/-/jobs/332656041 The recent bump of a number of python packages broke docker-compose, as docker-compose specifies both minimum and maximum versions for (most of) its dependencies: Dependencies of docker-compse 1.20.1 (! = unmet): cached-property: < 2 (currently 1.51) docopt: < 0.7 (currently 0.6.2) ! pyyaml: < 4.0, patched to < 4.3 (currently 5.1.2) requests: < 2.19, patched to < 3 (currently 2.22.0) ! texttable: < 0.10 (currently 1.6.2) websocket-client: < 1.0 (currently 0.56.0) ! docker: < 4.0 (currently 4.1.0) dockerpty: < 0.5 (currently 0.4.1) six: < 2 (currently 1.12.0) jsonschema: < 3 (currently 2.5.1) enum34: < 2 (currently 1.1.6) backports.ssl-match-hostname: >= 3.5 (currently 3.7.0.1) ipaddress: >= 1.0.16 (currently 1.0.23) To fix this, bump docker-compose to the most recent release (1.24.1). This is unfortunately not enough, as our docker, pyyaml, requests and texttable packages are too new, so add 3 patches from upstream to relax the version checks of dependencies. Notice that patch 0003 is from https://github.com/docker/compose/pull/6623 and has not been merged yet. Discussions around the problem of these maximum versions of the dependencies and the fact that all downstream users have to patch it is ongoing here: https://github.com/docker/compose/issues/6756 docker-compose 1.24.1 added a requirement for ssh support in python-docker in: https://github.com/docker/compose/commit/7b82b2e8c721010b73f664e9d4657746a1fcd92b So add a dependency for python-paramiko and update the toolchain dependency for C++ (from python-paramiko -> python-cryptography) and adjust the toolchain configuration of the runtime test to match. Signed-off-by: Peter Korsgaard <peter@korsgaard.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2019-10-26 16:05:24 +02:00
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_SYSTEM_DHCP="eth0"
BR2_ROOTFS_POST_BUILD_SCRIPT="{}"
BR2_ROOTFS_POST_SCRIPT_ARGS="{}"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.19"
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="{}"
BR2_PACKAGE_CA_CERTIFICATES=y
BR2_PACKAGE_DOCKER_CLI=y
BR2_PACKAGE_DOCKER_COMPOSE=y
BR2_PACKAGE_DOCKER_ENGINE=y
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_SIZE="512M"
# BR2_TARGET_ROOTFS_TAR is not set
""".format(
infra.filepath("tests/package/copy-sample-script-to-target.sh"),
infra.filepath("conf/docker-compose.yml"),
infra.filepath("conf/docker-compose-kernel.config"))
def wait_for_dockerd(self):
# dockerd takes a while to start up
_, _ = self.emulator.run('while [ ! -e /var/run/docker.sock ]; do sleep 1; done', 120)
def docker_test(self):
# will download container if not available, which may take some time
self.assertRunOk('docker run --rm -p 8888:8888 busybox:latest /bin/true', 120)
def docker_compose_test(self):
# will download container if not available, which may take some time
self.assertRunOk('docker-compose up -d', 120)
# container may take some time to start
self.assertRunOk('while ! docker inspect root_busybox_1 2>&1 >/dev/null; do sleep 1; done', 120)
self.assertRunOk('wget -O /tmp/busybox http://127.0.0.1/busybox', 120)
self.assertRunOk('cmp /bin/busybox /tmp/busybox', 120)
def test_run(self):
kernel = os.path.join(self.builddir, "images", "bzImage")
rootfs = os.path.join(self.builddir, "images", "rootfs.ext2")
self.emulator.boot(arch="x86_64",
kernel=kernel,
kernel_cmdline=["root=/dev/vda", "console=ttyS0"],
options=["-cpu", "core2duo",
"-m", "512M",
"-device", "virtio-rng-pci",
"-drive", "file={},format=raw,if=virtio".format(rootfs),
"-net", "nic,model=virtio",
"-net", "user"])
self.emulator.login()
self.wait_for_dockerd()
self.docker_test()
self.docker_compose_test()