bump log level when overloading config file with .local
(#1646)
* bump log level Co-authored-by: Marco Mariani <marco@crowdsec.net>
This commit is contained in:
parent
37ada58f3a
commit
73f336363a
|
@ -60,7 +60,7 @@ func (p *Patcher) MergedPatchContent() ([]byte, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if err == nil {
|
if err == nil {
|
||||||
log.Debugf("Patching yaml: '%s' with '%s'", p.BaseFilePath, p.PatchFilePath)
|
log.Infof("Patching yaml: '%s' with '%s'", p.BaseFilePath, p.PatchFilePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
var patched *bytes.Buffer
|
var patched *bytes.Buffer
|
||||||
|
|
|
@ -33,22 +33,22 @@ teardown() {
|
||||||
|
|
||||||
@test "config.yaml.local - cscli (log_level)" {
|
@test "config.yaml.local - cscli (log_level)" {
|
||||||
config_set '.common.log_level="warning"'
|
config_set '.common.log_level="warning"'
|
||||||
run -0 cscli config show --key Config.Common.LogLevel
|
run -0 --separate-stderr cscli config show --key Config.Common.LogLevel
|
||||||
assert_output "warning"
|
assert_output "warning"
|
||||||
|
|
||||||
echo "{'common':{'log_level':'debug'}}" >"${CONFIG_YAML}.local"
|
echo "{'common':{'log_level':'debug'}}" >"${CONFIG_YAML}.local"
|
||||||
run -0 cscli config show --key Config.Common.LogLevel
|
run -0 --separate-stderr cscli config show --key Config.Common.LogLevel
|
||||||
assert_output "debug"
|
assert_output "debug"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "config.yaml.local - cscli (log_level - with envvar)" {
|
@test "config.yaml.local - cscli (log_level - with envvar)" {
|
||||||
config_set '.common.log_level="warning"'
|
config_set '.common.log_level="warning"'
|
||||||
run -0 cscli config show --key Config.Common.LogLevel
|
run -0 --separate-stderr cscli config show --key Config.Common.LogLevel
|
||||||
assert_output "warning"
|
assert_output "warning"
|
||||||
|
|
||||||
export CROWDSEC_LOG_LEVEL=debug
|
export CROWDSEC_LOG_LEVEL=debug
|
||||||
echo "{'common':{'log_level':'${CROWDSEC_LOG_LEVEL}'}}" >"${CONFIG_YAML}.local"
|
echo "{'common':{'log_level':'${CROWDSEC_LOG_LEVEL}'}}" >"${CONFIG_YAML}.local"
|
||||||
run -0 cscli config show --key Config.Common.LogLevel
|
run -0 --separate-stderr cscli config show --key Config.Common.LogLevel
|
||||||
assert_output "debug"
|
assert_output "debug"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ teardown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "profiles.yaml.local" {
|
@test "profiles.yaml.local" {
|
||||||
run -0 config_get '.api.server.profiles_path'
|
run -0 --separate-stderr config_get '.api.server.profiles_path'
|
||||||
refute_output null
|
refute_output null
|
||||||
PROFILES="${output}"
|
PROFILES="${output}"
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ teardown() {
|
||||||
fake_log >>"${tmpfile}"
|
fake_log >>"${tmpfile}"
|
||||||
sleep 1
|
sleep 1
|
||||||
rm -f -- "${tmpfile}"
|
rm -f -- "${tmpfile}"
|
||||||
run -0 cscli decisions list -o json
|
run -0 --separate-stderr cscli decisions list -o json
|
||||||
run -0 jq -c '.[].decisions[0] | [.value,.type]' <(output)
|
run -0 jq -c '.[].decisions[0] | [.value,.type]' <(output)
|
||||||
assert_output '["1.1.1.172","captcha"]'
|
assert_output '["1.1.1.172","captcha"]'
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue