diff --git a/initscripts/testcase/initscripts-test.sh b/initscripts/testcase/initscripts-test.sh new file mode 100755 index 0000000000000000000000000000000000000000..a6148721d0e73ef3b1d50248ebaa7377d78a0372 --- /dev/null +++ b/initscripts/testcase/initscripts-test.sh @@ -0,0 +1,61 @@ +#!/bin/bash +############################################################################### +# @用例ID: 20230528-162414-748140887 +# @用例名称: initscripts-test +# @用例级别: 3 +# @用例标签: +# @用例类型: 功能 +############################################################################### +[ -z "$TST_TS_TOPDIR" ] && { + TST_TS_TOPDIR="$(realpath "$(dirname "$0")/..")" + export TST_TS_TOPDIR +} +source "${TST_TS_TOPDIR}/tst_common/lib/common.sh" || exit 1 +############################################################################### + +g_tmpdir="$(mktemp -d)" + +tc_setup() { + msg "this is tc_setup" + # @预置条件:系统正常运行,且已安装initscripts软件包,apache web(httpd)服务器软件包 + assert_true yum install -y initscripts + assert_true yum install -y httpd + return 0 +} + +do_test() { + msg "this is do_test" + + # @测试步骤:1:启动Apache Web服务器(httpd)服务 + # @预期结果:1:服务启动成功 + assert_true service httpd start + assert_true [ $? -eq 0 ] + + # @测试步骤:2:停止Apache Web服务器(httpd)服务 + # @预期结果:2:服务停止成功 + assert_true service httpd stop + assert_true [ $? -eq 0 ] + + # @测试步骤:3:重启Apache Web服务器(httpd)服务 + # @预期结果:3:服务重启成功 + assert_true service httpd restart + assert_true [ $? -eq 0 ] + + # @测试步骤:3:查询Apache Web服务器(httpd)服务状态 + # @预期结果:3:服务重启成功 + assert_true service httpd status + assert_true [ $? -eq 0 ] + + + return 0 +} + +tc_teardown() { + msg "this is tc_teardown" + rm -rfv "$g_tmpdir" || return 1 + return 0 +} + +############################################################################### +tst_main "$@" +###############################################################################