If you use a ./test/local directory, you need to create it again: $ make clean bats-build bats-fixture
48 lines
1,012 B
Bash
48 lines
1,012 B
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 nginx
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
#----------
|
|
|
|
@test "nginx: detect unit (fail)" {
|
|
run -0 cscli setup detect
|
|
run -0 jq -r '.setup | .[].detected_service' <(output)
|
|
refute_line 'nginx-systemd'
|
|
}
|
|
|
|
@test "nginx: install" {
|
|
run -0 rpm-install nginx
|
|
run -0 sudo systemctl enable nginx.service
|
|
}
|
|
|
|
@test "nginx: detect unit (succeed)" {
|
|
run -0 cscli setup detect
|
|
run -0 jq -r '.setup | .[].detected_service' <(output)
|
|
assert_line 'nginx-systemd'
|
|
}
|
|
|
|
@test "nginx: install detected collection" {
|
|
run -0 cscli setup detect
|
|
run -0 cscli setup install-hub <(output)
|
|
}
|