From: Peter Korsgaard <peter@korsgaard.com>
To: buildroot@buildroot.org
Cc: james.hilliard1@gmail.com, Christian Stewart <christian@aperture.us>
Subject: [Buildroot] [PATCH 2/2] support/testing: add python-docker test
Date: Fri, 16 Jun 2023 08:04:20 +0200 [thread overview]
Message-ID: <20230616060421.3606283-2-peter@korsgaard.com> (raw)
In-Reply-To: <20230616060421.3606283-1-peter@korsgaard.com>
Python-docker needs a working docker setup to do anything useful, so add it
to the existing docker_compose (which tests docker and docker-compose)
rather than adding a completely new test.
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
---
.../testing/tests/package/sample_python_docker.py | 12 ++++++++++++
support/testing/tests/package/test_docker_compose.py | 10 +++++++++-
2 files changed, 21 insertions(+), 1 deletion(-)
create mode 100644 support/testing/tests/package/sample_python_docker.py
diff --git a/support/testing/tests/package/sample_python_docker.py b/support/testing/tests/package/sample_python_docker.py
new file mode 100644
index 0000000000..a69097b412
--- /dev/null
+++ b/support/testing/tests/package/sample_python_docker.py
@@ -0,0 +1,12 @@
+import docker
+
+client = docker.from_env()
+info = client.info()
+images = client.images.list()
+
+assert len(images) > 0
+
+print('Version:', info['ServerVersion'])
+print('Images:')
+for i in images:
+ print(i.tags[0])
diff --git a/support/testing/tests/package/test_docker_compose.py b/support/testing/tests/package/test_docker_compose.py
index 38b669fc6d..16027c9c3a 100644
--- a/support/testing/tests/package/test_docker_compose.py
+++ b/support/testing/tests/package/test_docker_compose.py
@@ -4,6 +4,8 @@ import infra.basetest
class TestDockerCompose(infra.basetest.BRTest):
+ scripts = ["conf/docker-compose.yml",
+ "tests/package/sample_python_docker.py"]
config = \
"""
BR2_x86_64=y
@@ -18,6 +20,8 @@ class TestDockerCompose(infra.basetest.BRTest):
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.19.262"
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="{}"
+ BR2_PACKAGE_PYTHON3=y
+ BR2_PACKAGE_PYTHON_DOCKER=y
BR2_PACKAGE_CA_CERTIFICATES=y
BR2_PACKAGE_DOCKER_CLI=y
BR2_PACKAGE_DOCKER_COMPOSE=y
@@ -27,7 +31,7 @@ class TestDockerCompose(infra.basetest.BRTest):
# BR2_TARGET_ROOTFS_TAR is not set
""".format(
infra.filepath("tests/package/copy-sample-script-to-target.sh"),
- infra.filepath("conf/docker-compose.yml"),
+ " ".join([infra.filepath(i) for i in scripts]),
infra.filepath("conf/docker-compose-kernel.config"))
def wait_for_dockerd(self):
@@ -46,6 +50,9 @@ class TestDockerCompose(infra.basetest.BRTest):
self.assertRunOk('wget -q -O /tmp/busybox http://127.0.0.1/busybox', 120)
self.assertRunOk('cmp /bin/busybox /tmp/busybox', 120)
+ def python_docker_test(self):
+ self.assertRunOk('python3 ./sample_python_docker.py', 120)
+
def test_run(self):
kernel = os.path.join(self.builddir, "images", "bzImage")
rootfs = os.path.join(self.builddir, "images", "rootfs.ext2")
@@ -62,3 +69,4 @@ class TestDockerCompose(infra.basetest.BRTest):
self.wait_for_dockerd()
self.docker_test()
self.docker_compose_test()
+ self.python_docker_test()
--
2.30.2
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next prev parent reply other threads:[~2023-06-16 6:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-16 6:04 [Buildroot] [PATCH 1/2] package/python-docker: needs python-packaging after bump to 6.0.1 Peter Korsgaard
2023-06-16 6:04 ` Peter Korsgaard [this message]
2023-06-16 19:40 ` [Buildroot] [PATCH 2/2] support/testing: add python-docker test Christian Stewart via buildroot
2023-06-17 16:53 ` Peter Korsgaard
2023-07-06 8:35 ` Peter Korsgaard
2023-06-16 8:28 ` [Buildroot] [PATCH 1/2] package/python-docker: needs python-packaging after bump to 6.0.1 Peter Korsgaard
2023-06-16 9:30 ` Peter Korsgaard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230616060421.3606283-2-peter@korsgaard.com \
--to=peter@korsgaard.com \
--cc=buildroot@buildroot.org \
--cc=christian@aperture.us \
--cc=james.hilliard1@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox