mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2025-04-05 00:27:25 +00:00
Try resetting nsd restart count to avoid errors in mgmt tests
This commit is contained in:
parent
80fc86f6c1
commit
e56084d682
12
.travis.yml
12
.travis.yml
@ -13,15 +13,27 @@ before_install:
|
||||
- echo "==== DUMP ENVIRONMENT ===="
|
||||
- env | sort
|
||||
- echo "UMASK=$(umask)"
|
||||
#
|
||||
- echo "==== DUMP AppArmor Status ===="
|
||||
- (sudo aa-status; true)
|
||||
#
|
||||
- echo "==== System update ===="
|
||||
# Do not run 'upgrade'
|
||||
- sudo apt-get update
|
||||
#
|
||||
- echo "==== Install QA/test data ===="
|
||||
# python3-dnspython is used by the python scripts in 'tests'
|
||||
- sudo apt-get -y install python3-dnspython
|
||||
# avoid the lengthy generation of DH params by copying in a prebuilt file
|
||||
- sudo mkdir -p /home/user-data/ssl
|
||||
- sudo cp ./tests/assets/ssl/dh2048.pem /home/user-data/ssl
|
||||
#
|
||||
- echo "==== Add the PRIMARY_HOSTNAME to /etc/hosts ===="
|
||||
# The PRIMARY_HOSTNAME should point to the interface address not
|
||||
# loopback. That is because of the way MiaB resolves - the local
|
||||
# resolver is bind9, which requires valid NS records, which would
|
||||
# point back to the local nsd authoritative name server for the
|
||||
# domain. We don't have those in QA, so we need the hosts entry.
|
||||
- echo "$(source setup/functions.sh; get_default_privateip 4) $PRIMARY_HOSTNAME" > /tmp/hosts_add.tmp
|
||||
- sudo $SHELL -c 'cat /tmp/hosts_add.tmp >>/etc/hosts'
|
||||
|
||||
|
@ -105,6 +105,7 @@ detect_syslog_error() {
|
||||
!/postfix\/qmgr/ && /warning:/ { exit 1 }
|
||||
/(fatal|reject|error):/ { exit 1 }
|
||||
/Error in / { exit 1 }
|
||||
/Exception on / { exit 1 }
|
||||
/named\[\d+\]:.* verify failed/ { exit 1 }
|
||||
' \
|
||||
>>$TEST_OF 2>&1 <<< "$line"
|
||||
|
@ -80,10 +80,21 @@ mgmt_rest() {
|
||||
return 0
|
||||
}
|
||||
|
||||
systemctl_reset() {
|
||||
local service="${1:-nsd.service}"
|
||||
# for travis-ci: reset nsd to avoid "nsd.service: Start request
|
||||
# repeated too quickly", which occurs inside kick() of the
|
||||
# management flask app when "system restart nsd" is called on
|
||||
# detection of a new mail domain
|
||||
record "[systemctl reset-failed $service]"
|
||||
systemctl reset-failed $service 2>&1 >>$TEST_OF
|
||||
}
|
||||
|
||||
mgmt_create_user() {
|
||||
local email="$1"
|
||||
local pass="${2:-$email}"
|
||||
local delete_first="${3:-yes}"
|
||||
local rc=0
|
||||
|
||||
# ensure the user is deleted (clean test run)
|
||||
if [ "$delete_first" == "yes" ]; then
|
||||
@ -91,7 +102,11 @@ mgmt_create_user() {
|
||||
fi
|
||||
record "[create user $email]"
|
||||
mgmt_rest POST /admin/mail/users/add "email=$email" "password=$pass"
|
||||
return $?
|
||||
rc=$?
|
||||
if echo "$REST_OUTPUT" | grep "updated DNS:" >/dev/null; then
|
||||
systemctl_reset
|
||||
fi
|
||||
return $rc
|
||||
}
|
||||
|
||||
mgmt_assert_create_user() {
|
||||
|
Loading…
Reference in New Issue
Block a user