source "${OET_PATH}/libs/locallibs/common_lib.sh"
function pre_test() {
LOG_INFO "Start environmental preparation."
DNF_INSTALL "nmstate"
cat <<EOF > ./test_state.yaml
interfaces:
- name: eth0
type: ethernet
state: up
EOF
LOG_INFO "End of environmental preparation!"
}
function run_test() {
LOG_INFO "Start to run test."
nmstatectl set ./test_state.yaml
CHECK_RESULT $? 0 0 "nmstatectl set failed"
nmstatectl set --no-verify ./test_state.yaml
CHECK_RESULT $? 0 0 "nmstatectl set --no-verify failed"
nmstatectl set --no-commit ./test_state.yaml
CHECK_RESULT $? 0 0 "nmstatectl set --no-commit failed"
nmstatectl set --timeout 60 ./test_state.yaml
CHECK_RESULT $? 0 0 "nmstatectl set --timeout failed"
nmstatectl set --memory-only ./test_state.yaml
CHECK_RESULT $? 0 0 "nmstatectl set --memory-only failed"
nmstatectl set --no-verify --no-commit --timeout 60 --memory-only ./test_state.yaml
CHECK_RESULT $? 0 0 "nmstatectl set with multiple parameters failed"
LOG_INFO "End of the test."
}
function post_test() {
LOG_INFO "start environment cleanup."
DNF_REMOVE "nmstate"
rm -f ./test_state.yaml
LOG_INFO "End of environment cleanup!"
}
main "$@"