summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGonéri Le Bouder <goneri@lebouder.net>2020-05-04 16:58:35 -0400
committerGitHub <noreply@github.com>2020-05-04 14:58:35 -0600
commitf9b393bb4f15258de230884949e543e0f62f9abb (patch)
tree1993e292c7ebe7f659fe53b6798a7aee603766f5 /tests
parent59dd290ee7986f76247bfd26d18cbcc586777812 (diff)
downloadvyos-cloud-init-f9b393bb4f15258de230884949e543e0f62f9abb.tar.gz
vyos-cloud-init-f9b393bb4f15258de230884949e543e0f62f9abb.zip
bsd: upgrade support (#305)
Implement the upgrade support: - FreeBSD: using `pkg upgrade` - NetBSD: with `pkgin`
Diffstat (limited to 'tests')
-rw-r--r--tests/unittests/test_distros/test_netbsd.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/unittests/test_distros/test_netbsd.py b/tests/unittests/test_distros/test_netbsd.py
new file mode 100644
index 00000000..11a68d2a
--- /dev/null
+++ b/tests/unittests/test_distros/test_netbsd.py
@@ -0,0 +1,17 @@
+import cloudinit.distros.netbsd
+
+import pytest
+import unittest.mock as mock
+
+
+@pytest.mark.parametrize('with_pkgin', (True, False))
+@mock.patch("cloudinit.distros.netbsd.os")
+def test_init(m_os, with_pkgin):
+ print(with_pkgin)
+ m_os.path.exists.return_value = with_pkgin
+ cfg = {}
+
+ distro = cloudinit.distros.netbsd.NetBSD("netbsd", cfg, None)
+ expectation = ['pkgin', '-y', 'full-upgrade'] if with_pkgin else None
+ assert distro.pkg_cmd_upgrade_prefix == expectation
+ assert [mock.call('/usr/pkg/bin/pkgin')] == m_os.path.exists.call_args_list