summaryrefslogtreecommitdiff
path: root/roles/sane_debian_system/subplot.py
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2020-10-10 14:56:50 +0300
committerLars Wirzenius <liw@liw.fi>2020-10-10 18:08:19 +0300
commita1525abd6b3db65f5ebe3a6f7dbb2a9f749eb1a6 (patch)
treeb53cfbaffd7973ff1f00307c1874ed38ca74ae2e /roles/sane_debian_system/subplot.py
parentbba8e8809d05f809ef353568305d69214186dced (diff)
downloaddebian-ansible-a1525abd6b3db65f5ebe3a6f7dbb2a9f749eb1a6.tar.gz
test(sane_debian_system): add subplot scenarios
Diffstat (limited to 'roles/sane_debian_system/subplot.py')
-rw-r--r--roles/sane_debian_system/subplot.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/roles/sane_debian_system/subplot.py b/roles/sane_debian_system/subplot.py
new file mode 100644
index 0000000..8262479
--- /dev/null
+++ b/roles/sane_debian_system/subplot.py
@@ -0,0 +1,29 @@
+def host_has_package_installed(ctx, package=None):
+ assert_eq = globals()["assert_eq"]
+ qemu = ctx["qemu"]
+ output, exit = qemu.ssh(["dpkg", "--status", package])
+ assert_eq(exit, 0)
+ installed = False
+ for line in output.decode("UTF8").splitlines():
+ if line.startswith("Status:") and " installed" in line:
+ installed = True
+ break
+ assert installed
+
+
+def host_directory_is_empty(ctx, pathname=None):
+ assert_eq = globals()["assert_eq"]
+ qemu = ctx["qemu"]
+ output, exit = qemu.ssh(["find", "/etc/apt/sources.list.d"])
+ assert_eq(exit, 0)
+ for line in output.decode("UTF8").splitlines():
+ assert "/etc/apt/sources.list.d/" not in line
+
+
+def host_hostname_is(ctx, hostname=None):
+ assert_eq = globals()["assert_eq"]
+ qemu = ctx["qemu"]
+ output, exit = qemu.ssh(["hostname"])
+ assert_eq(exit, 0)
+ actual = output.decode("UTF8").splitlines()[-1]
+ assert_eq(actual, hostname)