test_docker_compose.py: Test the volume mount feature
authorPeter Korsgaard <peter@korsgaard.com>
Thu, 13 May 2021 21:03:53 +0000 (23:03 +0200)
committerPeter Korsgaard <peter@korsgaard.com>
Fri, 14 May 2021 21:00:16 +0000 (23:00 +0200)
Extend docker_compose_test() to expose /bin on the host to the container
through a volume mount and verify that /bin/busybox can be downloaded and
contains the right data.

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
support/testing/conf/docker-compose.yml
support/testing/tests/package/test_docker_compose.py

index de33251dfd1bb1103081ca0dc99e7131e6e73dbc..ce89d79b594d05ee990ccd1561fdc963d9cc968e 100644 (file)
@@ -2,6 +2,8 @@ version: '3'
 services:
   busybox:
     image: "busybox:latest"
-    command: httpd -f -h /etc/
+    command: httpd -f -h /www/
     ports:
       - "80:80"
+    volumes:
+      - "/bin:/www"
index 364f75b5b0cc240e44f20c8815b546b5f9fc3ea4..737dbf393cb9a3e54bf0e02f0396b3b366894bc0 100644 (file)
@@ -45,7 +45,8 @@ class TestDockerCompose(infra.basetest.BRTest):
         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 http://127.0.0.1/resolv.conf', 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")