crowdsec/test/bats-detect/lemonldap-rpm.bats
mmetc a19748ae35
Rename directory "tests" to "test" (#2094)
If you use a ./test/local directory, you need to create it again:
$ make clean bats-build bats-fixture
2023-03-03 15:54:49 +01:00

50 lines
1.2 KiB
Bash

#!/usr/bin/env bats
# vim: ft=bats:list:ts=8:sts=4:sw=4:et:ai:si:
set -u
setup_file() {
load "../lib/setup_file.sh"
load "${BATS_TEST_DIRNAME}/lib/setup_file_detect.sh"
}
teardown_file() {
load "../lib/teardown_file.sh"
rpm-remove lemonldap-ng
}
setup() {
if ! command -v dnf >/dev/null; then
skip 'not a redhat-like system'
fi
load "../lib/setup.sh"
load "../lib/bats-file/load.bash"
./instance-data load
skip 'WIP'
}
#----------
@test "lemonldap: detect unit (fail)" {
run -0 cscli setup detect
run -0 jq -r '.setup | .[].detected_service' <(output)
refute_line 'lemonldap-ng-systemd'
}
@test "lemonldap: install" {
run -0 rpm-install 'dnf-command(copr)'
run -0 sudo dnf -q -y copr enable xavierb/lemonldap-ng
run -0 rpm-install lemonldap-ng
run -0 sudo systemctl enable lemonldap-ng-fastcgi-server.service
}
@test "lemonldap: detect unit (succeed)" {
run -0 cscli setup detect
run -0 jq -r '.setup | .[].detected_service' <(output)
assert_line 'lemonldap-ng-systemd'
}
@test "lemonldap: install detected collection" {
run -0 cscli setup detect
run -0 cscli setup install-hub <(output)
}