summaryrefslogtreecommitdiff
path: root/tests/unittests/test_distros/test_dragonflybsd.py
diff options
context:
space:
mode:
authorGonéri Le Bouder <goneri@lebouder.net>2021-06-14 15:39:05 -0400
committerGitHub <noreply@github.com>2021-06-14 14:39:05 -0500
commit59a848c5929cbfca45d95860eb60dfebd0786c94 (patch)
treea962355634c51c6cc03b56c0dceca8c2b345a550 /tests/unittests/test_distros/test_dragonflybsd.py
parent05b0e35026db3789c56ee9f8192d4a81067325e5 (diff)
downloadvyos-cloud-init-59a848c5929cbfca45d95860eb60dfebd0786c94.tar.gz
vyos-cloud-init-59a848c5929cbfca45d95860eb60dfebd0786c94.zip
add DragonFlyBSD support (#904)
- Mostly based on FreeBSD, the main exception is that `find_devs_with_on_freebsd` does not work. - Since we cannot get the CDROM or the partition labels, `find_devs_with_on_dragonflybsd()` has a more naive approach and returns all the block devices.
Diffstat (limited to 'tests/unittests/test_distros/test_dragonflybsd.py')
-rw-r--r--tests/unittests/test_distros/test_dragonflybsd.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/unittests/test_distros/test_dragonflybsd.py b/tests/unittests/test_distros/test_dragonflybsd.py
new file mode 100644
index 00000000..df2c00f4
--- /dev/null
+++ b/tests/unittests/test_distros/test_dragonflybsd.py
@@ -0,0 +1,25 @@
+#!/usr/bin/env python3
+
+
+import cloudinit.util
+from cloudinit.tests.helpers import mock
+
+
+def test_find_dragonflybsd_part():
+ assert cloudinit.util.find_dragonflybsd_part("/dev/vbd0s3") == "vbd0s3"
+
+
+@mock.patch("cloudinit.util.is_DragonFlyBSD")
+@mock.patch("cloudinit.subp.subp")
+def test_parse_mount(mock_subp, m_is_DragonFlyBSD):
+ mount_out = """
+vbd0s3 on / (hammer2, local)
+devfs on /dev (devfs, nosymfollow, local)
+/dev/vbd0s0a on /boot (ufs, local)
+procfs on /proc (procfs, local)
+tmpfs on /var/run/shm (tmpfs, local)
+"""
+
+ mock_subp.return_value = (mount_out, "")
+ m_is_DragonFlyBSD.return_value = True
+ assert cloudinit.util.parse_mount("/") == ("vbd0s3", "hammer2", "/")