#!/bin/bash

#   BAREOS® - Backup Archiving REcovery Open Sourced
#
#   Copyright (C) 2019-2026 Bareos GmbH & Co. KG
#
#   This program is Free Software; you can redistribute it and/or
#   modify it under the terms of version three of the GNU Affero General Public
#   License as published by the Free Software Foundation and included
#   in the file LICENSE.
#
#   This program is distributed in the hope that it will be useful, but
#   WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
#   Affero General Public License for more details.
#
#   You should have received a copy of the GNU Affero General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
#   02110-1301, USA.

set -e
set -o pipefail
set -u
#trap read debug

#shellcheck source=../../environment.in
. ./environment
#shellcheck source=../../scripts/functions
. "${BAREOS_SCRIPTS_DIR}"/functions

TestName="$(get_test_name "$0")"
export TestName
export estat

export temporary_config_file="${config_directory_dir_additional_test_config}/new_empty_job_definition.conf"
export bconsole_command_file="${tmp}/bconsole_reload_command"
export console_logfile="${tmp}/console.log"

############################################
start_test
############################################

remove_console_logfile

setup_config
#reload modified config
add_empty_job_to_config
test_reload_will_not_crash_director
find_error_string_in_console_log 'Config error: Name not specified for resource'

############################################
end_test
############################################
