unit tests: add check_config with with the default kdump.conf

This test prevents the mistake of adding an option to kdump.conf
without changing check_config as is the case with commit 73ced7f
("introduce the auto_reset_crashkernel option to kdump.conf").

Reviewed-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Coiby Xu <coxu@redhat.com>
This commit is contained in:
Coiby Xu 2022-01-07 16:00:08 +08:00
parent e28a1399a3
commit 3d4cb38d96

View File

@ -174,4 +174,29 @@ Describe 'kdumpctl'
End
End
Describe 'parse_config()'
bad_kdump_conf=$(mktemp -t bad_kdump_conf.XXXXXXXXXX)
cleanup() {
rm -f "$bad_kdump_conf"
}
AfterAll 'cleanup'
It 'should not be happy with unkown option in kdump.conf'
KDUMP_CONFIG_FILE="$bad_kdump_conf"
echo blabla > "$bad_kdump_conf"
When call parse_config
The status should be failure
The stderr should include 'Invalid kdump config option blabla'
End
It 'should be happy with the default kdump.conf'
# shellcheck disable=SC2034
# override the KDUMP_CONFIG_FILE variable
KDUMP_CONFIG_FILE=./kdump.conf
When call parse_config
The status should be success
End
End
End