[Debian-ha-commits] [crmsh] 03/03: d/tests: add tests for package management scripts

Valentin Vidic vvidic-guest at moszumanska.debian.org
Sun Nov 20 09:12:10 UTC 2016


This is an automated email from the git hooks/post-receive script.

vvidic-guest pushed a commit to branch master
in repository crmsh.

commit 1816676ba43371a87073095fe6e39ce7b5eb124b
Author: Valentin Vidic <Valentin.Vidic at CARNet.hr>
Date:   Sun Nov 20 09:57:35 2016 +0100

    d/tests: add tests for package management scripts
    
    Check status, install and remove a package.
    Test if clean script removes files and directories.
---
 debian/tests/control  |  4 ++++
 debian/tests/utils.sh | 30 ++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/debian/tests/control b/debian/tests/control
index 2944608..a5c6b47 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -10,6 +10,10 @@ Test-Command: crm --version
 Depends: @
 Restrictions: needs-root
 
+Tests: utils.sh
+Depends: @
+Restrictions: needs-root, allow-stderr
+
 Tests: pacemaker-basic-resource.sh
 Depends: @, pacemaker, corosync
 Restrictions: needs-root, allow-stderr, isolation-container
diff --git a/debian/tests/utils.sh b/debian/tests/utils.sh
new file mode 100644
index 0000000..038ed19
--- /dev/null
+++ b/debian/tests/utils.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+set -ex
+
+PKG=less
+
+# package not installed
+/usr/share/crmsh/utils/crm_rpmcheck.py $PKG | grep error
+
+# install
+/usr/share/crmsh/utils/crm_pkg.py -n $PKG -s present | grep Unpacking
+/usr/share/crmsh/utils/crm_rpmcheck.py $PKG | grep status
+dpkg --status $PKG
+
+# upgrade
+/usr/share/crmsh/utils/crm_pkg.py -n $PKG -s latest | grep false
+
+# purge
+/usr/share/crmsh/utils/crm_pkg.py -n $PKG -s removed | grep Purging
+/usr/share/crmsh/utils/crm_rpmcheck.py $PKG | grep error
+
+# clean
+cd $AUTOPKGTEST_TMP
+mkdir dir
+touch dir/file
+cp /usr/share/crmsh/utils/crm_clean.py .
+$PWD/crm_clean.py $PWD/crm_clean.py $PWD/dir
+if ls | grep .; then
+    exit 1
+fi

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-ha/crmsh.git



More information about the Debian-HA-Commits mailing list