1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2026-03-04 15:54:48 +01:00

Try resetting nsd restart count to avoid errors in mgmt tests

This commit is contained in:
downtownallday
2020-06-02 14:48:26 -04:00
parent 80fc86f6c1
commit e56084d682
3 changed files with 29 additions and 1 deletions

View File

@@ -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"

View File

@@ -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() {