aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSebastian Pipping <sebastian@pipping.org>2017-02-19 17:18:06 +0100
committerSebastian Pipping <sebastian@pipping.org>2017-02-19 17:21:46 +0100
commitb0a743617b5c314a005c4645d95a7157c7337328 (patch)
treef2f92a3ebcfd7159eaddef6b172781b4aca0b6f5 /test
parentAllow overriding ${DATE} for testibility (diff)
downloadporticron-b0a743617b5c314a005c4645d95a7157c7337328.tar.gz
porticron-b0a743617b5c314a005c4645d95a7157c7337328.tar.bz2
porticron-b0a743617b5c314a005c4645d95a7157c7337328.zip
Add simple suite of system tests based on BATS
Diffstat (limited to 'test')
-rw-r--r--test/data/date-r-output.txt1
-rw-r--r--test/data/emerge-deep-update-pretend-output.txt14
-rw-r--r--test/data/expected-porticron-v-output-fresh.txt10
-rw-r--r--test/data/expected-porticron-v-output-unchanged.txt9
-rw-r--r--test/data/expected-sendmail-input.txt41
-rwxr-xr-xtest/mocks/emerge14
6 files changed, 89 insertions, 0 deletions
diff --git a/test/data/date-r-output.txt b/test/data/date-r-output.txt
new file mode 100644
index 0000000..e4357ff
--- /dev/null
+++ b/test/data/date-r-output.txt
@@ -0,0 +1 @@
+Sun, 19 Feb 2017 16:50:56 +0100
diff --git a/test/data/emerge-deep-update-pretend-output.txt b/test/data/emerge-deep-update-pretend-output.txt
new file mode 100644
index 0000000..ceef1fd
--- /dev/null
+++ b/test/data/emerge-deep-update-pretend-output.txt
@@ -0,0 +1,14 @@
+[ebuild U ] app-text/libpaper-1.1.24_p5 [1.1.24-r2] ABI_X86="(64) -32 (-x32)"
+[ebuild U ] app-text/qpdf-6.0.0-r2 [6.0.0-r1] USE="static-libs -doc -examples -perl {-test}"
+[ebuild NS ] sys-kernel/vanilla-sources-4.9.10 [4.6.4, 4.9.9] USE="-build -symlink"
+[ebuild U ] dev-python/sip-4.19.1 [4.19] USE="-debug -doc" PYTHON_TARGETS="python2_7 python3_4 python3_5"
+[ebuild U ] net-misc/stunnel-5.40 [5.39] USE="ssl tcpd -ipv6 -libressl (-selinux) -stunnel3"
+[ebuild U ] net-print/cups-2.2.2-r3 [2.2.2-r2] USE="X acl dbus pam python ssl static-libs threads -debug -java -kerberos -lprng-compat (-selinux) -systemd -usb -xinetd -zeroconf" ABI_X86="32 (64) (-x32)" LINGUAS="-ca -cs -de -es -fr -it -ja -ru" PYTHON_TARGETS="python2_7"
+[ebuild U ] x11-drivers/xf86-video-intel-2.99.917_p20170216 [2.99.917_p20161206] USE="dri sna udev uxa -debug -dri3 -xvmc"
+[ebuild U ] net-print/cups-filters-1.13.4 [1.13.3-r2] USE="dbus foomatic jpeg pdf png postscript static-libs tiff -ldap -perl -zeroconf"
+[ebuild U ] sys-fs/eudev-3.2.1-r1 [3.2.1] USE="hwdb introspection kmod static-libs -rule-generator (-selinux) {-test}" ABI_X86="32 (64) (-x32)"
+[ebuild U ] sys-fs/lvm2-2.02.166-r2 [2.02.166-r1] USE="readline static-libs thin udev -clvm -cman -corosync -device-mapper-only -lvm1 -lvm2create_initrd -openais -sanlock (-selinux) -static -systemd"
+
+ * IMPORTANT: 7 news items need reading for repository 'gentoo'.
+ * Use eselect news read to view new items.
+
diff --git a/test/data/expected-porticron-v-output-fresh.txt b/test/data/expected-porticron-v-output-fresh.txt
new file mode 100644
index 0000000..40e090f
--- /dev/null
+++ b/test/data/expected-porticron-v-output-fresh.txt
@@ -0,0 +1,10 @@
+using PORTICRON_CONF=/dev/null, NOMAIL=0, VERBOSE=1
+running SYNC_CMD: test/mocks/emerge --sync
+running SYNC_OVERLAY_CMD: /bin/true
+running GLSA_AFFECTED: /bin/true --test --nocolor --verbose affected
+running GLSA_UPGRADES: /bin/true --nocolor --pretend affected
+running UPGRADE_CMD: test/mocks/emerge --deep --update --quiet --pretend world
+no previous hash file /var/tmp/porticron.UPGRADE_MSG exists
+creating hash file /var/tmp/porticron.UPGRADE_MSG
+no previous hash file /var/tmp/porticron.DIFF_MSG exists
+creating hash file /var/tmp/porticron.DIFF_MSG
diff --git a/test/data/expected-porticron-v-output-unchanged.txt b/test/data/expected-porticron-v-output-unchanged.txt
new file mode 100644
index 0000000..6e291f6
--- /dev/null
+++ b/test/data/expected-porticron-v-output-unchanged.txt
@@ -0,0 +1,9 @@
+using PORTICRON_CONF=/dev/null, NOMAIL=0, VERBOSE=1
+running SYNC_CMD: test/mocks/emerge --sync
+running SYNC_OVERLAY_CMD: /bin/true
+running GLSA_AFFECTED: /bin/true --test --nocolor --verbose affected
+running GLSA_UPGRADES: /bin/true --nocolor --pretend affected
+running UPGRADE_CMD: test/mocks/emerge --deep --update --quiet --pretend world
+hash matched for hash file /var/tmp/porticron.UPGRADE_MSG
+hash matched for hash file /var/tmp/porticron.DIFF_MSG
+no new upgrades found, exiting.
diff --git a/test/data/expected-sendmail-input.txt b/test/data/expected-sendmail-input.txt
new file mode 100644
index 0000000..0fac911
--- /dev/null
+++ b/test/data/expected-sendmail-input.txt
@@ -0,0 +1,41 @@
+To: root
+From: root@sevendust
+Subject: Gentoo package updates on sevendust [ ]
+Date: Sun, 19 Feb 2017 16:50:56 +0100
+
+porticron report [Sun, 19 Feb 2017 16:50:56 +0100]
+========================================================================
+
+porticron has detected that some packages need upgrading:
+
+ [ebuild U ] app-text/libpaper-1.1.24_p5 [1.1.24-r2] ABI_X86="(64) -32 (-x32)"
+ [ebuild U ] app-text/qpdf-6.0.0-r2 [6.0.0-r1] USE="static-libs -doc -examples -perl {-test}"
+ [ebuild NS ] sys-kernel/vanilla-sources-4.9.10 [4.6.4, 4.9.9] USE="-build -symlink"
+ [ebuild U ] dev-python/sip-4.19.1 [4.19] USE="-debug -doc" PYTHON_TARGETS="python2_7 python3_4 python3_5"
+ [ebuild U ] net-misc/stunnel-5.40 [5.39] USE="ssl tcpd -ipv6 -libressl (-selinux) -stunnel3"
+ [ebuild U ] net-print/cups-2.2.2-r3 [2.2.2-r2] USE="X acl dbus pam python ssl static-libs threads -debug -java -kerberos -lprng-compat (-selinux) -systemd -usb -xinetd -zeroconf" ABI_X86="32 (64) (-x32)" LINGUAS="-ca -cs -de -es -fr -it -ja -ru" PYTHON_TARGETS="python2_7"
+ [ebuild U ] x11-drivers/xf86-video-intel-2.99.917_p20170216 [2.99.917_p20161206] USE="dri sna udev uxa -debug -dri3 -xvmc"
+ [ebuild U ] net-print/cups-filters-1.13.4 [1.13.3-r2] USE="dbus foomatic jpeg pdf png postscript static-libs tiff -ldap -perl -zeroconf"
+ [ebuild U ] sys-fs/eudev-3.2.1-r1 [3.2.1] USE="hwdb introspection kmod static-libs -rule-generator (-selinux) {-test}" ABI_X86="32 (64) (-x32)"
+ [ebuild U ] sys-fs/lvm2-2.02.166-r2 [2.02.166-r1] USE="readline static-libs thin udev -clvm -cman -corosync -device-mapper-only -lvm1 -lvm2create_initrd -openais -sanlock (-selinux) -static -systemd"
+
+ * IMPORTANT: 7 news items need reading for repository 'gentoo'.
+ * Use eselect news read to view new items.
+
+========================================================================
+
+You can perform the upgrade by issuing the command:
+
+ emerge --deep --update world
+
+as root on sevendust
+
+It is recommended that you pretend the upgrade first to confirm that
+the actions that would be taken are reasonable. The upgrade may be
+pretended by issuing the command:
+
+ emerge --deep --update --pretend world
+
+
+--
+porticron
diff --git a/test/mocks/emerge b/test/mocks/emerge
new file mode 100755
index 0000000..ef1fc1b
--- /dev/null
+++ b/test/mocks/emerge
@@ -0,0 +1,14 @@
+#! /bin/bash
+# Copyright (C) 2017 Sebastian Pipping <sebastian@pipping.org>
+# Licensed under the 3-Clause BSD license
+
+set -e
+
+if [[ "$*" == '--sync' ]]; then
+ :
+elif [[ "$*" == '--deep --update --quiet --pretend world' ]]; then
+ cat test/data/emerge-deep-update-pretend-output.txt
+else
+ echo "ERROR: Unsupported invocation: $0 $*" >&2
+ exit 1
+fi