From e136de2587169c6cecf4afe44673c553dedb159b Mon Sep 17 00:00:00 2001 From: root Date: Sun, 28 May 2023 16:36:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86initscripts=E8=BD=AF?= =?UTF-8?q?=E4=BB=B6=E5=8C=85=E7=9A=84=E8=87=AA=E5=8A=A8=E5=8C=96=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: root --- initscripts/testcase/initscripts-test.sh | 61 ++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100755 initscripts/testcase/initscripts-test.sh diff --git a/initscripts/testcase/initscripts-test.sh b/initscripts/testcase/initscripts-test.sh new file mode 100755 index 0000000..a614872 --- /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 "$@" +############################################################################### -- Gitee