1
0
Fork 0
mirror of synced 2024-11-13 21:18:57 -05:00
yadm/test/007_unit_query_distro.bats
2017-07-03 16:21:27 -05:00

49 lines
842 B
Bash

load common
load_fixtures
@test "Query distro (lsb_release present)" {
echo "
Use value of lsb_release -si
"
#shellcheck source=/dev/null
YADM_TEST=1 source "$T_YADM"
status=0
{ output=$( query_distro ); } || {
status=$?
true
}
expected="${T_DISTRO}"
echo "output=$output"
echo "expect=$expected"
[ "$status" == 0 ]
[ "$output" = "$expected" ]
}
@test "Query distro (lsb_release missing)" {
echo "
Empty value if lsb_release is missing
"
#shellcheck source=/dev/null
YADM_TEST=1 source "$T_YADM"
LSB_RELEASE_PROGRAM="missing_lsb_release"
echo "Using $LSB_RELEASE_PROGRAM as lsb_release"
status=0
{ output=$( query_distro ); } || {
status=$?
true
}
expected=""
echo "output=$output"
echo "expect=$expected"
[ "$status" == 0 ]
[ "$output" = "$expected" ]
}