Test for acquisition errors in crowdsec -t (#2629)

This commit is contained in:
mmetc 2023-12-04 23:09:42 +01:00 committed by GitHub
parent 23968e472d
commit 0c4093dcca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -227,3 +227,16 @@ teardown() {
assert_stderr --partial "crowdsec init: while loading acquisition config: no datasource enabled"
}
@test "crowdsec -t (error in acquisition file)" {
# we can verify the acquisition configuration without running crowdsec
ACQUIS_YAML=$(config_get '.crowdsec_service.acquisition_path')
config_set "$ACQUIS_YAML" 'del(.filenames)'
rune -1 wait-for "${CROWDSEC}"
assert_stderr --partial "failed to configure datasource file: no filename or filenames configuration provided"
config_set "$ACQUIS_YAML" '.filenames=["file.log"]'
config_set "$ACQUIS_YAML" '.meh=3'
rune -1 wait-for "${CROWDSEC}"
assert_stderr --partial "field meh not found in type fileacquisition.FileConfiguration"
}