forked from evolix/evobackup
tests clarifications
This commit is contained in:
parent
2ef20df5ca
commit
86111acfea
|
@ -2,20 +2,19 @@
|
||||||
|
|
||||||
load test_helper
|
load test_helper
|
||||||
|
|
||||||
@test "init-filesystem" {
|
@test "Filesystem type" {
|
||||||
inode=$(stat --format=%i /backup)
|
if is_btrfs "/backup"; then
|
||||||
if [ "${inode}" -eq 256 ]; then
|
|
||||||
# On a btrfs filesystem, the jail should be a btrfs volume
|
# On a btrfs filesystem, the jail should be a btrfs volume
|
||||||
run stat --format=%i "${JAILPATH}"
|
run is_btrfs "${JAILPATH}"
|
||||||
[ "${output}" -eq 256 ]
|
assert_success
|
||||||
else
|
else
|
||||||
# On an ext4 filesystem, the jail should be a regular directory
|
# On an ext4 filesystem, the jail should be a regular directory
|
||||||
run test -d "${JAILPATH}"
|
run test -d "${JAILPATH}"
|
||||||
[ "${status}" -eq 0 ]
|
assert_success
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "start" {
|
@test "A jail should be able to be started" {
|
||||||
/usr/lib/bkctld/bkctld-start "${JAILNAME}"
|
/usr/lib/bkctld/bkctld-start "${JAILNAME}"
|
||||||
pid=$(cat "${JAILPATH}/${SSHD_PID}")
|
pid=$(cat "${JAILPATH}/${SSHD_PID}")
|
||||||
# A started jail should have an SSH pid file
|
# A started jail should have an SSH pid file
|
||||||
|
@ -23,7 +22,7 @@ load test_helper
|
||||||
assert_success
|
assert_success
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "stop" {
|
@test "A jail should be able to be stopped" {
|
||||||
/usr/lib/bkctld/bkctld-start "${JAILNAME}"
|
/usr/lib/bkctld/bkctld-start "${JAILNAME}"
|
||||||
pid=$(cat "${JAILPATH}/${SSHD_PID}")
|
pid=$(cat "${JAILPATH}/${SSHD_PID}")
|
||||||
/usr/lib/bkctld/bkctld-stop "${JAILNAME}"
|
/usr/lib/bkctld/bkctld-stop "${JAILNAME}"
|
||||||
|
@ -32,7 +31,7 @@ load test_helper
|
||||||
assert_failure
|
assert_failure
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "reload" {
|
@test "A jail should be able to be reloaded" {
|
||||||
/usr/lib/bkctld/bkctld-start "${JAILNAME}"
|
/usr/lib/bkctld/bkctld-start "${JAILNAME}"
|
||||||
/usr/lib/bkctld/bkctld-reload "${JAILNAME}"
|
/usr/lib/bkctld/bkctld-reload "${JAILNAME}"
|
||||||
# A reloaded jail should mention the restart in the authlog
|
# A reloaded jail should mention the restart in the authlog
|
||||||
|
@ -40,7 +39,7 @@ load test_helper
|
||||||
assert_success
|
assert_success
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "restart" {
|
@test "A jail should be able to be restarted" {
|
||||||
/usr/lib/bkctld/bkctld-start "${JAILNAME}"
|
/usr/lib/bkctld/bkctld-start "${JAILNAME}"
|
||||||
pid_before=$(cat "${JAILPATH}/${SSHD_PID}")
|
pid_before=$(cat "${JAILPATH}/${SSHD_PID}")
|
||||||
|
|
||||||
|
@ -51,12 +50,12 @@ load test_helper
|
||||||
refute_equal "${pid_before}" "${pid_after}"
|
refute_equal "${pid_before}" "${pid_after}"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "status" {
|
@test "Status should return information" {
|
||||||
run /usr/lib/bkctld/bkctld-status "${JAILNAME}"
|
run /usr/lib/bkctld/bkctld-status "${JAILNAME}"
|
||||||
assert_success
|
assert_success
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "is-on" {
|
@test "ON/OFF status can be retrived with 'is-on'" {
|
||||||
/usr/lib/bkctld/bkctld-start "${JAILNAME}"
|
/usr/lib/bkctld/bkctld-start "${JAILNAME}"
|
||||||
# A started jail should report to be ON
|
# A started jail should report to be ON
|
||||||
run /usr/lib/bkctld/bkctld-is-on "${JAILNAME}"
|
run /usr/lib/bkctld/bkctld-is-on "${JAILNAME}"
|
||||||
|
|
|
@ -13,8 +13,6 @@ setup() {
|
||||||
PORT=$(awk -v min=2222 -v max=2999 'BEGIN{srand(); print int(min+rand()*(max-min+1))}')
|
PORT=$(awk -v min=2222 -v max=2999 'BEGIN{srand(); print int(min+rand()*(max-min+1))}')
|
||||||
INC_NAME=$(date +"%Y-%m-%d-%H")
|
INC_NAME=$(date +"%Y-%m-%d-%H")
|
||||||
|
|
||||||
inode=$(stat --format=%i /backup)
|
|
||||||
|
|
||||||
/usr/lib/bkctld/bkctld-init "${JAILNAME}"
|
/usr/lib/bkctld/bkctld-init "${JAILNAME}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +25,7 @@ is_btrfs() {
|
||||||
|
|
||||||
inode=$(stat --format=%i "${path}")
|
inode=$(stat --format=%i "${path}")
|
||||||
|
|
||||||
test $inode -eq 256
|
test ${inode} -eq 256
|
||||||
}
|
}
|
||||||
|
|
||||||
flunk() {
|
flunk() {
|
||||||
|
|
Loading…
Reference in a new issue