From 662820fa0c9e5cebf23829bdf16bd15af81908c2 Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Sun, 19 Feb 2017 18:17:52 +0100 Subject: Test suite: Fix hostname --- bin/porticron | 4 ++-- test.bats | 2 ++ test/data/expected-sendmail-input.txt | 6 +++--- 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 -- cgit v1.2.3-65-gdbad