Return-Path: From: Wang Mingyu Date: Wed, 28 Nov 2018 07:47:42 -0800 Message-ID: <1543420064-1823-5-git-send-email-wangmy@cn.fujitsu.com> In-Reply-To: <1543420064-1823-1-git-send-email-wangmy@cn.fujitsu.com> References: <1543420064-1823-1-git-send-email-wangmy@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Fuego] [PATCH] Add test cases of service mdmonitor, multipathd. List-Id: Mailing list for the Fuego test framework List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: fuego@lists.linuxfoundation.org Signed-off-by: Wang Mingyu --- engine/tests/Functional.demo/tests/demo_mdadm.sh | 63 ++++++++++++++++++++++ .../tests/Functional.demo/tests/demo_multipathd.sh | 63 ++++++++++++++++++++++ 2 files changed, 126 insertions(+) create mode 100644 engine/tests/Functional.demo/tests/demo_mdadm.sh create mode 100644 engine/tests/Functional.demo/tests/demo_multipathd.sh diff --git a/engine/tests/Functional.demo/tests/demo_mdadm.sh b/engine/tests/Functional.demo/tests/demo_mdadm.sh new file mode 100644 index 0000000..b465867 --- /dev/null +++ b/engine/tests/Functional.demo/tests/demo_mdadm.sh @@ -0,0 +1,63 @@ +#!/bin/sh + +# In the target start mdadm, and confirm the process condition by command ps. + +test="mdadm" + +. ./fuego_board_function_lib.sh + +set_init_manager + +if [ -f /etc/mdadm.conf ] +then + cp /etc/mdadm.conf /etc/mdadm.conf_bak +fi + +if [ -f /etc/mdadm.conf.sample ] +then + cp -f /etc/mdadm.conf.sample /etc/mdadm.conf +fi + +restore_target() { + if [ -f /etc/mdadm.conf_bak ] + then + mv /etc/mdadm.conf_bak /etc/mdadm.conf + else + rm -f /etc/mdadm.conf + fi +} + +exec_service_on_target mdmonitor stop + +if exec_service_on_target mdmonitor start +then + echo " -> start of mdmonitor succeeded." +else + echo " -> start of mdmonitor failed." + echo " -> $test: TEST-FAIL" + restore_target + exit +fi + +sleep 5 + +if ps aux | grep "[/]sbin/mdadm" +then + echo " -> get the process of mdadm." +else + echo " -> can't get the process of mdadm." + echo " -> $test: TEST-FAIL" + exec_service_on_target mdmonitor stop + restore_target + exit +fi + +exec_service_on_target mdmonitor stop + +if ps aux | grep "[/]sbin/mdadm" +then + echo " -> $test: TEST-FAIL" +else + echo " -> $test: TEST-PASS" +fi +restore_target diff --git a/engine/tests/Functional.demo/tests/demo_multipathd.sh b/engine/tests/Functional.demo/tests/demo_multipathd.sh new file mode 100644 index 0000000..d057288 --- /dev/null +++ b/engine/tests/Functional.demo/tests/demo_multipathd.sh @@ -0,0 +1,63 @@ +#!/bin/sh + +# In the target start multipathd, and confirm the process condition by command ps. + +test="multipathd" + +. ./fuego_board_function_lib.sh + +set_init_manager + +if [ -f /etc/multipath.conf ] +then + cp /etc/multipath.conf /etc/multipath.conf_bak +fi + +if [ -f /etc/multipath.conf.example ] +then + cp /etc/multipath.conf.example /etc/multipath.conf +fi + +restore_target() { + if [ -f /etc/multipath.conf_bak ] + then + mv /etc/multipath.conf_bak /etc/multipath.conf + else + rm -f /etc/multipath.conf + fi +} + +exec_service_on_target multipathd stop + +if exec_service_on_target multipathd start +then + echo " -> start of multipathd succeeded." +else + echo " -> start of multipathd failed." + echo " -> $test: TEST-FAIL" + restore_target + exit +fi + +sleep 5 + +if ps aux | grep "[/]sbin/multipathd" +then + echo " -> get the process of multipathd." +else + echo " -> can't get the process of multipathd." + echo " -> $test: TEST-FAIL" + exec_service_on_target multipathd stop + restore_target + exit +fi + +exec_service_on_target multipathd stop + +if ps aux | grep "[/]sbin/multipathd" +then + echo " -> $test: TEST-FAIL" +else + echo " -> $test: TEST-PASS" +fi +restore_target -- 1.8.3.1