source "${OET_PATH}/libs/locallibs/common_lib.sh"
function pre_test() {
LOG_INFO "Start environmental preparation."
DNF_INSTALL "python-twisted"
mkdir -p ./ftp_data
touch ./ftp_data/testfile.txt
LOG_INFO "End of environmental preparation!"
}
function run_test() {
LOG_INFO "Start to run test."
twistd --help | grep "ftp"
CHECK_RESULT $? 0 0 "twistd --help does not contain ftp command"
twistd ftp --help | grep "usage"
CHECK_RESULT $? 0 0 "twistd ftp --help does not contain usage information"
twistd -n ftp --port 2121 --root ./ftp_data
CHECK_RESULT $? 0 0 "twistd ftp command failed to start"
test -f twistd.pid
CHECK_RESULT $? 0 0 "twistd.pid file not found"
kill `cat twistd.pid`
rm twistd.pid
LOG_INFO "End of the test."
}
function post_test() {
LOG_INFO "start environment cleanup."
DNF_REMOVE "python-twisted"
rm -rf ./ftp_data
LOG_INFO "End of environment cleanup!"
}
main "$@"