1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
#!/bin/bash
### Configure shell and bootstrap
#
set -e
set -u
. `dirname $BASH_SOURCE`/_bootstrap.sh
### Get data
#
VAL_SNOOPY=`$SNOOPY_TEST_CLI run datasource domain`
# Getting domain is tricky on some hosts (Travis CI build boxes return empty string)
# Therefore try multiple sources.
VAL_REAL=`hostname -d`
if [ "$VAL_REAL" == "" ]; then
SNOOPY_HOSTNAME=`hostname`
VAL_REAL=`cat /etc/hosts | sed -e 's/#.*//' | grep -Eo "$SNOOPY_HOSTNAME\.[-_.a-z0-9]+" | sed -e "s/$SNOOPY_HOSTNAME\.//" | head -n1`
fi
### Adjust data
#
if [ "$VAL_REAL" == "(none)" ]; then
VAL_REAL=""
fi
if [ "$VAL_SNOOPY" == "(none)" ]; then
VAL_SNOOPY=""
fi
### Evaluate
#
snoopy_test_compareValues "$VAL_SNOOPY" "$VAL_REAL"
|