added explicit `_regexp` filters for logs
This commit is contained in:
parent
b64eb7517f
commit
fa1f3b005e
|
@ -45,9 +45,8 @@ function _show_complete_mail_log() {
|
|||
#
|
||||
# @param ${1} = service name
|
||||
# @param ${2} = string to filter by
|
||||
# @param ${3} = container name [OPTIONAL]
|
||||
function _service_log_should_contain_string() {
|
||||
_filter_service_log "${@}"
|
||||
_filter_service_log "${1}" "${2}" --fixed-strings
|
||||
assert_success
|
||||
}
|
||||
|
||||
|
@ -55,9 +54,28 @@ function _service_log_should_contain_string() {
|
|||
#
|
||||
# @param ${1} = service name
|
||||
# @param ${2} = string to filter by
|
||||
# @param ${3} = container name [OPTIONAL]
|
||||
function _service_log_should_not_contain_string() {
|
||||
_filter_service_log "${@}"
|
||||
_filter_service_log "${1}" "${2}" --fixed-strings
|
||||
assert_failure
|
||||
}
|
||||
|
||||
# Like `_filter_service_log` but asserts that the string was found. Uses regular expressions
|
||||
# under the hood for pattern matching.
|
||||
#
|
||||
# @param ${1} = service name
|
||||
# @param ${2} = regular expression to filter by
|
||||
function _service_log_should_contain_string_regexp() {
|
||||
_filter_service_log "${1}" "${2}" --extended-regexp
|
||||
assert_success
|
||||
}
|
||||
|
||||
# Like `_filter_service_log` but asserts that the string was not found. Uses regular expressions
|
||||
# under the hood for pattern matching.
|
||||
#
|
||||
# @param ${1} = service name
|
||||
# @param ${2} = regular expression to filter by
|
||||
function _service_log_should_not_contain_string_regexp() {
|
||||
_filter_service_log "${1}" "${2}" --extended-regexp
|
||||
assert_failure
|
||||
}
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ function teardown_file() { _default_teardown ; }
|
|||
}
|
||||
|
||||
@test 'service log exist and contains proper content' {
|
||||
_service_log_should_contain_string 'rspamd' 'rspamd .* is loading configuration'
|
||||
_service_log_should_contain_string_regexp 'rspamd' 'rspamd .* is loading configuration'
|
||||
_service_log_should_contain_string 'rspamd' 'lua module clickhouse is disabled in the configuration'
|
||||
_service_log_should_contain_string 'rspamd' 'lua module elastic is disabled in the configuration'
|
||||
_service_log_should_contain_string 'rspamd' 'lua module neural is disabled in the configuration'
|
||||
|
|
|
@ -205,7 +205,7 @@ function teardown_file() { _default_teardown ; }
|
|||
}
|
||||
|
||||
@test "system: amavis decoders installed and available" {
|
||||
_service_log_should_contain_string 'mail' '.*(Internal decoder|Found decoder) for\s+\..*' '-E'
|
||||
_service_log_should_contain_string_regexp 'mail' '.*(Internal decoder|Found decoder) for\s+\..*'
|
||||
run bash -c "grep -Eo '(mail|Z|gz|bz2|xz|lzma|lrz|lzo|lz4|rpm|cpio|tar|deb|rar|arj|arc|zoo|doc|cab|tnef|zip|kmz|7z|jar|swf|lha|iso|exe)' <<< '${output}' | sort | uniq"
|
||||
assert_success
|
||||
# Support for doc and zoo removed in buster
|
||||
|
|
Loading…
Reference in New Issue