[Fuego] [PATCH] demo: Add test cases of service openct, openhpid, openldap and opensafd.

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


Signed-off-by: Wang Mingyu <wangmy at cn.fujitsu.com>
---
 engine/tests/Functional.demo/tests/demo_openct.sh  | 39 ++++++++++++
 .../tests/Functional.demo/tests/demo_openhpid.sh   | 22 +++++++
 .../tests/Functional.demo/tests/demo_openldap.sh   | 44 +++++++++++++
 .../tests/Functional.demo/tests/demo_opensafd.sh   | 72 ++++++++++++++++++++++
 4 files changed, 177 insertions(+)
 create mode 100644 engine/tests/Functional.demo/tests/demo_openct.sh
 create mode 100644 engine/tests/Functional.demo/tests/demo_openhpid.sh
 create mode 100644 engine/tests/Functional.demo/tests/demo_openldap.sh
 create mode 100644 engine/tests/Functional.demo/tests/demo_opensafd.sh

diff --git a/engine/tests/Functional.demo/tests/demo_openct.sh b/engine/tests/Functional.demo/tests/demo_openct.sh
new file mode 100644
index 0000000..29c5175
--- /dev/null
+++ b/engine/tests/Functional.demo/tests/demo_openct.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+#  In the target start openct, and confirm the process condition by command ps.
+
+test="openct"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+exec_service_on_target openct stop
+
+if exec_service_on_target openct start
+then
+    echo " -> start of openct succeeded."
+else
+    echo " -> start of openct failed."
+    echo " -> $test: TEST-FAIL"
+    exit
+fi
+
+if [ "$init_manager" = "systemd" ]
+then
+    if exec_service_on_target openct is-active
+    then
+        echo " -> $test: TEST-PASS"
+    else
+        echo " -> $test: TEST-FAIL"
+    fi
+else
+    if /etc/init.d/openct status | grep "Waiting for reader attach/detach events"
+    then
+        echo " -> $test: TEST-PASS"
+    else
+        echo " -> $test: TEST-FAIL"
+    fi
+fi
+
+exec_service_on_target openct stop
diff --git a/engine/tests/Functional.demo/tests/demo_openhpid.sh b/engine/tests/Functional.demo/tests/demo_openhpid.sh
new file mode 100644
index 0000000..e0c9419
--- /dev/null
+++ b/engine/tests/Functional.demo/tests/demo_openhpid.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+#  In the target start openhpid, and confirm the process condition by command ps.
+
+test="openhpid"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+exec_service_on_target openhpid stop
+
+if exec_service_on_target openhpid start
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> start of openhpid failed."
+    echo " -> $test: TEST-FAIL"
+    exit
+fi
+
+exec_service_on_target openhpid stop
diff --git a/engine/tests/Functional.demo/tests/demo_openldap.sh b/engine/tests/Functional.demo/tests/demo_openldap.sh
new file mode 100644
index 0000000..3b92e3a
--- /dev/null
+++ b/engine/tests/Functional.demo/tests/demo_openldap.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+#  In the target start openldap, and confirm the process condition by command ps.
+
+test="openldap"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+exec_service_on_target slapd stop
+
+mv /etc/openldap/slapd.conf /etc/openldap/slapd.conf_bak
+cp data/slapd.conf /etc/openldap/slapd.conf
+
+if exec_service_on_target slapd start
+then
+    echo " -> start of slapd succeeded."
+else
+    echo " -> start of slapd failed."
+    echo " -> $test: TEST-FAIL"
+    exit
+fi
+
+sleep 5
+
+if ps aux | grep "[/]usr/sbin/slapd"
+then
+    echo " -> get the process of slapd."
+else
+    echo " -> can't get the process of slapd."
+    echo " -> $test: TEST-FAIL"
+    exec_service_on_target slapd stop
+    exit
+fi
+
+exec_service_on_target slapd stop
+
+if ps aux | grep "[/]usr/sbin/slapd"
+then
+    echo " -> $test: TEST-FAIL"
+else
+    echo " -> $test: TEST-PASS"
+fi
diff --git a/engine/tests/Functional.demo/tests/demo_opensafd.sh b/engine/tests/Functional.demo/tests/demo_opensafd.sh
new file mode 100644
index 0000000..af47e2a
--- /dev/null
+++ b/engine/tests/Functional.demo/tests/demo_opensafd.sh
@@ -0,0 +1,72 @@
+#!/bin/sh
+
+#  In the target start opensafd, and confirm the process condition by command ps.
+
+test="opensafd"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+exec_service_on_target opensafd stop
+
+cp /etc/opensaf/nid.conf /etc/opensaf/nid.conf_bak
+cp /etc/opensaf/dtmd.conf /etc/opensaf/dtmd.conf_bak
+cp /etc/opensaf/node_name /etc/opensaf/node_name_bak
+cp /etc/plmcd.conf /etc/plmcd.conf_bak
+
+sed -i 's/REBOOT_TIMEOUT=60/REBOOT_TIMEOUT=0/g' /etc/opensaf/nid.conf
+sed -i 's/GROUP=opensaf/GROUP=root/g' /etc/opensaf/nid.conf
+sed -i 's/USER=opensaf/USER=root/g' /etc/opensaf/nid.conf
+
+sed -i 's/10.130.100.114/$test_target/g' /etc/opensaf/dtmd.conf
+
+echo $hostname > /etc/opensaf/node_name
+
+cd /usr/share/opensaf/immxml/; ./immxml-clustersize -s 1
+sed -i 's/1 SC-1/1 $test_host_name/g' nodes.cfg
+rm imm.xml.*
+./immxml-configure; cp imm.xml.* /etc/opensaf/imm.xml
+
+sed -i 's/0020f/safEE=SC-1,safDomain=domain_1/g' /etc/plmcd.conf
+sed -i 's/10.105.1.3/$test_target/g' /etc/plmcd.conf
+sed -i 's/10.105.1.6/$test_target/g' /etc/plmcd.conf
+sed -i 's/1;os;Fedora;2.6.31/1;os;SUSE;2.6/g' /etc/plmcd.conf
+
+restore_target() {
+    mv /etc/opensaf/nid.conf_bak /etc/opensaf/nid.conf
+    mv /etc/opensaf/dtmd.conf_bak /etc/opensaf/dtmd.conf
+    mv /etc/opensaf/node_name_bak /etc/opensaf/node_name
+    mv /etc/plmcd.conf_bak /etc/plmcd.conf
+    rm -rf /usr/share/opensaf/immxml/imm.xml.* /etc/opensaf/imm.xml /usr/share/opensaf/immxml/nodes.cfg
+ }
+
+if exec_service_on_target opensafd start
+then
+    echo " -> start of opensafd succeeded."
+else
+    echo " -> start of opensafd failed."
+    echo " -> $test: TEST-FAIL"
+    exit
+fi
+
+sleep 5
+
+if ps aux | grep -v grep | grep "opensaf"
+then
+    echo " -> get the process of opensafd."
+else
+    echo " -> can't get the process of opensafd."
+    echo " -> $test: TEST-FAIL"
+    exec_service_on_target opensafd stop
+    exit
+fi
+
+exec_service_on_target opensafd stop
+
+if ps aux | grep -v grep | grep "opensaf"
+then
+    echo " -> $test: TEST-FAIL"
+else
+    echo " -> $test: TEST-PASS"
+fi
-- 
1.8.3.1





More information about the Fuego mailing list