aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Pipping <sebastian@pipping.org>2017-02-19 18:17:52 +0100
committerSebastian Pipping <sebastian@pipping.org>2017-02-19 18:18:30 +0100
commit662820fa0c9e5cebf23829bdf16bd15af81908c2 (patch)
treeb019c55afeed4a482ca7cbcf08d95ca76c00c501
parentBypass portageq in test suite for testing on Ubuntu (diff)
downloadporticron-662820fa0c9e5cebf23829bdf16bd15af81908c2.tar.gz
porticron-662820fa0c9e5cebf23829bdf16bd15af81908c2.tar.bz2
porticron-662820fa0c9e5cebf23829bdf16bd15af81908c2.zip
Test suite: Fix hostname
-rwxr-xr-xbin/porticron4
-rwxr-xr-xtest.bats2
-rw-r--r--test/data/expected-sendmail-input.txt6
3 files changed, 7 insertions, 5 deletions
diff --git a/bin/porticron b/bin/porticron
index dba785e..a9d9abd 100755
--- a/bin/porticron
+++ b/bin/porticron
@@ -114,8 +114,8 @@ fi
# detect some common variables
SCRIPT_NAME=$(basename $0)
-FQDN=$(hostname --fqdn)
-HOST=$(hostname -s)
+: ${FQDN:=$(hostname --fqdn)}
+: ${HOST:=$(hostname -s)}
IP=$(dig +short ${FQDN} | tr '\n' ' ')
: ${DATE:=$(date -R)}
: ${PORTDIR:=$(portageq get_repo_path $(portageq envvar EROOT) gentoo)}
diff --git a/test.bats b/test.bats
index 81a0e88..9b5101d 100755
--- a/test.bats
+++ b/test.bats
@@ -19,6 +19,8 @@ PORTICRON() {
PORTDIR=/usr/portage \
GLSA_CHECK=/bin/true \
SENDMAIL=${SENDMAIL:-/bin/true} \
+ HOST=testbox \
+ FQDN=testbox.example.org \
bin/porticron \
-c /dev/null \
"$@"
diff --git a/test/data/expected-sendmail-input.txt b/test/data/expected-sendmail-input.txt
index 0fac911..1bed225 100644
--- a/test/data/expected-sendmail-input.txt
+++ b/test/data/expected-sendmail-input.txt
@@ -1,6 +1,6 @@
To: root
-From: root@sevendust
-Subject: Gentoo package updates on sevendust [ ]
+From: root@testbox.example.org
+Subject: Gentoo package updates on testbox.example.org [ ]
Date: Sun, 19 Feb 2017 16:50:56 +0100
porticron report [Sun, 19 Feb 2017 16:50:56 +0100]
@@ -28,7 +28,7 @@ You can perform the upgrade by issuing the command:
emerge --deep --update world
-as root on sevendust
+as root on testbox.example.org
It is recommended that you pretend the upgrade first to confirm that
the actions that would be taken are reasonable. The upgrade may be