[Fuego] [PATCH] demo: Add test cases of service uuidd, vsftpd, wpa_supplicant, xinetd, zabiix_agentd and zebra.

Wang Mingyu wangmy at cn.fujitsu.com
Wed Dec 12 08:05:58 UTC 2018


From: root <root at localhost.localdomain>

Signed-off-by: root <root at localhost.localdomain>
---
 engine/tests/Functional.demo/tests/demo_uuidd.sh   | 41 ++++++++++++
 engine/tests/Functional.demo/tests/demo_vsftpd.sh  | 39 +++++++++++
 .../Functional.demo/tests/demo_wpa_supplicant.sh   | 41 ++++++++++++
 engine/tests/Functional.demo/tests/demo_xinetd.sh  | 30 +++++++++
 .../Functional.demo/tests/demo_zabiix_agentd.sh    | 41 ++++++++++++
 engine/tests/Functional.demo/tests/demo_zebra.sh   | 76 ++++++++++++++++++++++
 6 files changed, 268 insertions(+)
 create mode 100644 engine/tests/Functional.demo/tests/demo_uuidd.sh
 create mode 100644 engine/tests/Functional.demo/tests/demo_vsftpd.sh
 create mode 100644 engine/tests/Functional.demo/tests/demo_wpa_supplicant.sh
 create mode 100644 engine/tests/Functional.demo/tests/demo_xinetd.sh
 create mode 100644 engine/tests/Functional.demo/tests/demo_zabiix_agentd.sh
 create mode 100644 engine/tests/Functional.demo/tests/demo_zebra.sh

diff --git a/engine/tests/Functional.demo/tests/demo_uuidd.sh b/engine/tests/Functional.demo/tests/demo_uuidd.sh
new file mode 100644
index 0000000..30ae2a3
--- /dev/null
+++ b/engine/tests/Functional.demo/tests/demo_uuidd.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+#  In the target start uuidd, and confirm the process condition by command ps.
+
+test="uuidd"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+if uuidd -p /tmp/uuidd.pid -s /tmp/uuidd.socket
+then
+    echo " -> create of uuidd succeeded."
+else
+    echo " -> create of uuidd failed."
+    echo " -> $test: TEST-FAIL"
+    exit
+fi
+
+sleep 5
+
+if ps aux | grep "[/]tmp/uuidd"
+then
+    echo " -> get the process of uuidd."
+else
+    echo " -> can't get the process of uuidd."
+    echo " -> $test: TEST-FAIL"
+    uuidd -d -r -n 5 -s /tmp/uuidd.socket
+    uuidd -d -k -s /tmp/uuidd.socket
+    exit
+fi
+
+uuidd -d -r -n 5 -s /tmp/uuidd.socket
+uuidd -d -k -s /tmp/uuidd.socket
+
+if ps aux | grep "[/]tmp/uuidd"
+then
+    echo " -> $test: TEST-FAIL"
+else
+    echo " -> $test: TEST-PASS"
+fi
diff --git a/engine/tests/Functional.demo/tests/demo_vsftpd.sh b/engine/tests/Functional.demo/tests/demo_vsftpd.sh
new file mode 100644
index 0000000..38518d4
--- /dev/null
+++ b/engine/tests/Functional.demo/tests/demo_vsftpd.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+#  In the target start vsftpd, and confirm the process condition by command ps.
+
+test="vsftpd"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+exec_service_on_target vsftpd stop
+
+if ps aux | grep "[/]usr/sbin/vsftpd"
+then
+    echo " -> $test: TEST-FAIL"
+    exit
+else
+    echo " -> no progress when service is shutdown"
+fi
+
+if exec_service_on_target vsftpd start
+then
+    echo " -> start of vsftpd succeeded."
+else
+    echo " -> start of vsftpd failed."
+    echo " -> $test: TEST-FAIL"
+    exit
+fi
+
+sleep 5
+
+if ps aux | grep "[/]usr/sbin/vsftpd"
+then
+    echo " -> get the process of vsftpd."
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> can't get the process of vsftpd."
+    echo " -> $test: TEST-FAIL"
+fi
diff --git a/engine/tests/Functional.demo/tests/demo_wpa_supplicant.sh b/engine/tests/Functional.demo/tests/demo_wpa_supplicant.sh
new file mode 100644
index 0000000..9817bee
--- /dev/null
+++ b/engine/tests/Functional.demo/tests/demo_wpa_supplicant.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+#  In the target start wpa_supplicant, and confirm the process condition by command ps.
+
+test="wpa_supplicant"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+exec_service_on_target wpa_supplicant stop
+
+if exec_service_on_target wpa_supplicant start
+then
+    echo " -> start of wpa_supplicant succeeded."
+else
+    echo " -> start of wpa_supplicant failed."
+    echo " -> $test: TEST-FAIL"
+    exit
+fi
+
+sleep 5
+
+if ps aux | grep "[/]usr/sbin/wpa_supplicant"
+then
+    echo " -> get the process of wpa_supplicant."
+else
+    echo " -> can't get the process of wpa_supplicant."
+    echo " -> $test: TEST-FAIL"
+    exec_service_on_target wpa_supplicant stop
+    exit
+fi
+
+exec_service_on_target wpa_supplicant stop
+
+if ps aux | grep "[/]usr/sbin/wpa_supplicant"
+then
+    echo " -> $test: TEST-FAIL"
+else
+    echo " -> $test: TEST-PASS"
+fi
diff --git a/engine/tests/Functional.demo/tests/demo_xinetd.sh b/engine/tests/Functional.demo/tests/demo_xinetd.sh
new file mode 100644
index 0000000..2bd7dee
--- /dev/null
+++ b/engine/tests/Functional.demo/tests/demo_xinetd.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+#  In the target start xinetd, and confirm the process condition by command ps.
+
+test="xinetd"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+if exec_service_on_target xinetd is-active
+then
+    echo " -> xinetd is active."
+else
+    echo " -> xinetd is not active."
+    echo " -> $test: TEST-FAIL"
+    exit
+fi
+
+sleep 5
+
+if ps aux | grep "[/]usr/sbin/xinetd"
+then
+    echo " -> get the process of xinetd."
+else
+    echo " -> can't get the process of xinetd."
+    echo " -> $test: TEST-FAIL"
+    exec_service_on_target xinetd stop
+    exit
+fi
diff --git a/engine/tests/Functional.demo/tests/demo_zabiix_agentd.sh b/engine/tests/Functional.demo/tests/demo_zabiix_agentd.sh
new file mode 100644
index 0000000..0bf31fa
--- /dev/null
+++ b/engine/tests/Functional.demo/tests/demo_zabiix_agentd.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+#  In the target start zabbix-agent, and confirm the process condition by command ps.
+
+test="zabbix-agentd"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+exec_service_on_target zabbix-agent stop
+
+if exec_service_on_target zabbix-agent start
+then
+    echo " -> start of zabbix-agent succeeded."
+else
+    echo " -> start of zabbix-agent failed."
+    echo " -> $test: TEST-FAIL"
+    exit
+fi
+
+sleep 5
+
+if ps aux | grep "[/]usr/sbin/zabbix_agentd"
+then
+    echo " -> get the process of zabbix-agent."
+else
+    echo " -> can't get the process of zabbix-agent."
+    echo " -> $test: TEST-FAIL"
+    exec_service_on_target zabbix-agent stop
+    exit
+fi
+
+exec_service_on_target zabbix-agent stop
+
+if ps aux | grep "[/]usr/sbin/zabbix_agentd"
+then
+    echo " -> $test: TEST-FAIL"
+else
+    echo " -> $test: TEST-PASS"
+fi
diff --git a/engine/tests/Functional.demo/tests/demo_zebra.sh b/engine/tests/Functional.demo/tests/demo_zebra.sh
new file mode 100644
index 0000000..40e4930
--- /dev/null
+++ b/engine/tests/Functional.demo/tests/demo_zebra.sh
@@ -0,0 +1,76 @@
+#!/bin/sh
+
+#  In the target start zebra, and confirm the process condition by command ps.
+
+test="zebra"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+if [ "$init_manager" = "systemd" ]
+then
+    exec_service_on_target zebra stop
+else
+    /etc/init.d/quagga stop zebra
+fi
+
+if [ -f /etc/quagga/zebra.conf ]
+then
+    cp /etc/quagga/zebra.conf /etc/quagga/zebra.conf_bak
+fi
+
+cp data/zebra.conf /etc/quagga/
+chwon quagga:quagga /etc/quagga/zebra.conf
+
+restore_target() {
+    if [ -f /etc/quagga/zebra.conf_bak ]
+    then
+        mv /etc/quagga/zebra.conf_bak /etc/quagga/zebra.conf
+    else
+        rm -f /etc/quagga/zebra.conf
+    fi
+}
+
+if [ "$init_manager" = "systemd" ]
+then
+    if exec_service_on_target zebra start
+    then
+        echo " -> start of zebra succeeded."
+    else
+        echo " -> start of zebra failed."
+        echo " -> $test: TEST-FAIL"
+        restore_target
+        exit
+    fi
+else
+    /etc/init.d/quagga start zebra
+fi
+
+sleep 5
+
+if ps aux | grep "[/]usr/sbin/zebra"
+then
+    echo " -> get the process of zebra."
+else
+    echo " -> can't get the process of zebra."
+    echo " -> $test: TEST-FAIL"
+    exec_service_on_target zebra stop
+    restore_target
+    exit
+fi
+
+if [ "$init_manager" = "systemd" ]
+then
+    exec_service_on_target zebra stop
+else
+    /etc/init.d/quagga stop zebra
+fi
+
+if ps aux | grep "[/]usr/sbin/zebra"
+then
+    echo " -> $test: TEST-FAIL"
+else
+    echo " -> $test: TEST-PASS"
+fi
+restore_target
-- 
1.8.3.1





More information about the Fuego mailing list