diff --git a/suite2cases/oedp.json b/suite2cases/oedp.json new file mode 100644 index 0000000000000000000000000000000000000000..22f907f764d0507ef16c60576aea040a950fbd0b --- /dev/null +++ b/suite2cases/oedp.json @@ -0,0 +1,26 @@ +{ + "path": "$OET_PATH/testcases/feature-test/oedp", + "machine num": 2, + "cases": [ + { + "name": "oe_test_oedp_01" + }, + { + "name": "oe_test_oedp_02" + }, + { + "name": "oe_test_oedp_03" + }, + { + "name": "oe_test_oedp_04" + }, + { + "name": "oe_test_oedp_05", + "machine num": 2 + }, + { + "name": "oe_test_oedp_06", + "machine num": 2 + } + ] +} diff --git a/testcases/feature-test/oedp/common.sh b/testcases/feature-test/oedp/common.sh new file mode 100644 index 0000000000000000000000000000000000000000..48aa7c4beb767dae728de631f9a948e95dc15bc5 --- /dev/null +++ b/testcases/feature-test/oedp/common.sh @@ -0,0 +1,36 @@ +#!/usr/bin/bash + +# Copyright (c) 2025. Huawei Technologies Co.,Ltd.ALL rights reserved. +# This program is licensed under Mulan PSL v2. +# You can use it according to the terms and conditions of the Mulan PSL v2. +# http://license.coscl.org.cn/MulanPSL2 +# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +# See the Mulan PSL v2 for more details. +#################################### +#@Author : wenjun +#@Contact : 1009065695@qq.com +#@Date : 2025-03-25 +#@License : Mulan PSL v2 +#@Desc : oeAware test +##################################### +# shellcheck disable=SC2010,SC2143,SC2046 + +source "${OET_PATH}"/libs/locallibs/common_lib.sh + +function pre_oedp() { + LOG_INFO "Start to prepare the test environment." + LANG_OLD="${LANG}" + export LANG=en_US.utf8 + wget https://repo.oepkgs.net/openEuler/rpm/openEuler-24.03-LTS/contrib/oedp/noarch/oedp-1.1.1-0.oe2403sp2.noarch.rpm + yum install -y oedp-1.1.1-0.oe2403sp2.noarch.rpm +} + +function post_oedp() { + LOG_INFO "Start to restore the test environment." + export LANG="${LANG_OLD}" + DNF_REMOVE "$@" + LOG_INFO "End to restore the test environment." +} + diff --git a/testcases/feature-test/oedp/oe_test_oedp_01.sh b/testcases/feature-test/oedp/oe_test_oedp_01.sh new file mode 100644 index 0000000000000000000000000000000000000000..19c0e2890cfbae50f8a74e4dd3b05a7953aa9a31 --- /dev/null +++ b/testcases/feature-test/oedp/oe_test_oedp_01.sh @@ -0,0 +1,52 @@ +#!/usr/bin/bash + +# Copyright (c) 2023. Huawei Technologies Co.,Ltd.ALL rights reserved. +# This program is licensed under Mulan PSL v2. +# You can use it according to the terms and conditions of the Mulan PSL v2. +# http://license.coscl.org.cn/MulanPSL2 +# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +# See the Mulan PSL v2 for more details. + +# ############################################# +# @Author : zhangjinqiang +# @Contact : jinqiang.oerv@isrc.iscas.ac.cn +# @Date : 2025/08/28 +# @License : Mulan PSL v2 +# @Desc : Test oedp version and help +# ############################################# + +source "${OET_PATH}/testcases/feature-test/oedp/common.sh" + +function pre_test() { + LOG_INFO "Start to prepare the test environment." + pre_oedp + LOG_INFO "End to prepare the test environment." +} + + +function run_test() { + LOG_INFO "Start to run test." + + oedp --version | grep -E "[0-9]+\.[0-9]+\.[0-9]+" + CHECK_RESULT $? 0 0 "Failed to get oedp version or version format incorrect" + + oedp -v | grep -E "[0-9]+\.[0-9]+\.[0-9]+" + CHECK_RESULT $? 0 0 "Failed to get oedp version with short option or version format incorrect" + + oedp --help | grep "usage: oedp" + CHECK_RESULT $? 0 0 "Failed to get oedp help" + + oedp -h | grep -E "usage: oedp" + CHECK_RESULT $? 0 0 "Failed to get oedp help" + + LOG_INFO "End to run test." +} + +function post_test() { + LOG_INFO "start environment cleanup." + LOG_INFO "Finish environment cleanup!" +} + +main "$@" diff --git a/testcases/feature-test/oedp/oe_test_oedp_02.sh b/testcases/feature-test/oedp/oe_test_oedp_02.sh new file mode 100644 index 0000000000000000000000000000000000000000..749245bc3c87fcfb7c02970c2a54367802f6b536 --- /dev/null +++ b/testcases/feature-test/oedp/oe_test_oedp_02.sh @@ -0,0 +1,52 @@ +#!/usr/bin/bash + +# Copyright (c) 2023. Huawei Technologies Co.,Ltd.ALL rights reserved. +# This program is licensed under Mulan PSL v2. +# You can use it according to the terms and conditions of the Mulan PSL v2. +# http://license.coscl.org.cn/MulanPSL2 +# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +# See the Mulan PSL v2 for more details. + +# ############################################# +# @Author : zhangjinqiang +# @Contact : jinqiang.oerv@isrc.iscas.ac.cn +# @Date : 2025/08/28 +# @License : Mulan PSL v2 +# @Desc : Test oedp repo command +# ############################################# + +source "${OET_PATH}/testcases/feature-test/oedp/common.sh" + +function pre_test() { + LOG_INFO "Start to prepare the test environment." + pre_oedp + LOG_INFO "End to prepare the test environment." +} + +function run_test() { + LOG_INFO "Start to run test." + + oedp repo list 2>&1 | grep -E "openEuler|local" + CHECK_RESULT $? 0 0 "Failed to list repositories" + + oedp repo update + CHECK_RESULT $? 0 0 "Failed to update repository cache" + + oedp repo set b https://repo.oepkgs.net/openEuler/rpm/openEuler-24.03-LTS/contrib/oedp/plugins/ 2>&1 | grep "updated repo: b" + CHECK_RESULT $? 0 0 "Failed to set repo" + + oedp repo enable b 2>&1 | grep "enabled repo: b" + CHECK_RESULT $? 0 0 "Failed to enable repo" + + oedp repo disable b 2>&1 | grep "disabled repo: b" + CHECK_RESULT $? 0 0 "Failed to disable repo" + + oedp repo del b 2>&1 | grep "removed repo: b" + CHECK_RESULT $? 0 0 "Failed to delete repo" + + LOG_INFO "End to run test." +} + +main "$@" diff --git a/testcases/feature-test/oedp/oe_test_oedp_03.sh b/testcases/feature-test/oedp/oe_test_oedp_03.sh new file mode 100644 index 0000000000000000000000000000000000000000..aade3885a1f47ce91359fafe04a19c19c4c01617 --- /dev/null +++ b/testcases/feature-test/oedp/oe_test_oedp_03.sh @@ -0,0 +1,73 @@ +#!/usr/bin/bash + +# Copyright (c) 2023. Huawei Technologies Co.,Ltd.ALL rights reserved. +# This program is licensed under Mulan PSL v2. +# You can use it according to the terms and conditions of the Mulan PSL v2. +# http://license.coscl.org.cn/MulanPSL2 +# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +# See the Mulan PSL v2 for more details. + +# ############################################# +# @Author : zhangjinqiang +# @Contact : jinqiang.oerv@isrc.iscas.ac.cn +# @Date : 2025/08/28 +# @License : Mulan PSL v2 +# @Desc : Test oedp init command +# ############################################# + +source "${OET_PATH}/testcases/feature-test/oedp/common.sh" + +function pre_test() { + LOG_INFO "Start to prepare the test environment." + pre_oedp + LOG_INFO "End to prepare the test environment." +} + +function run_test() { + LOG_INFO "Start to run test." + + oedp list 2>&1 | grep -E "kubernetes-1.31.1" + CHECK_RESULT $? 0 0 "Failed to list kubernetes-1.31.1" + + cd ~ && oedp init kubernetes-1.31.1 > output.log 2>&1 + grep "process success" output.log + CHECK_RESULT $? 0 0 "Failed to oedp init kubernetes to /root" + + ls -a | grep kubernetes-1.31.1 + CHECK_RESULT $? 0 0 "Failed to check kubernetes in /root" + + rm -rf kubernetes-1.31.1 + oedp init https://repo.oepkgs.net/openEuler/rpm/openEuler-24.03-LTS/contrib/oedp/plugins/kubernetes-1.31.1.tar.gz > output1.log 2>&1 + grep "process success" output1.log + CHECK_RESULT $? 0 0 "Failed to oedp init kubernetes to /root by url" + + ls -a | grep kubernetes-1.31.1 + CHECK_RESULT $? 0 0 "Failed to check kubernetes in /root" + + rm -rf kubernetes-1.31.1 + oedp init kubernetes-1.31.1 -p ~/kubernetes-1.31.1 > output2.log 2>&1 + grep "process success" output2.log + CHECK_RESULT $? 0 0 "Failed to oedp init kubernetes to /root" + + ls -a | grep kubernetes-1.31.1 + CHECK_RESULT $? 0 0 "Failed to check kubernetes in /root" + + oedp init kubernetes-1.31.1 -d ~ --force > output3.log 2>&1 + grep "process success" output3.log + CHECK_RESULT $? 0 0 "Forcefully initializing Kubernetes to/root directory failed " + + ls -a | grep kubernetes-1.31.1 + CHECK_RESULT $? 0 0 "Failed to check kubernetes in /root" + + LOG_INFO "End to run test." +} + +function post_test() { + LOG_INFO "Start to restore the test environment." + rm -rf ~/kubernetes-1.31.1 + LOG_INFO "End to restore the test environment." +} + +main "$@" diff --git a/testcases/feature-test/oedp/oe_test_oedp_04.sh b/testcases/feature-test/oedp/oe_test_oedp_04.sh new file mode 100644 index 0000000000000000000000000000000000000000..125a0ff2a95863a2e741bd05aea444d2abdca270 --- /dev/null +++ b/testcases/feature-test/oedp/oe_test_oedp_04.sh @@ -0,0 +1,43 @@ +#!/usr/bin/bash + +# Copyright (c) 2023. Huawei Technologies Co.,Ltd.ALL rights reserved. +# This program is licensed under Mulan PSL v2. +# You can use it according to the terms and conditions of the Mulan PSL v2. +# http://license.coscl.org.cn/MulanPSL2 +# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +# See the Mulan PSL v2 for more details. + +# ############################################# +# @Author : zhangjinqiang +# @Contact : jinqiang.oerv@isrc.iscas.ac.cn +# @Date : 2025/08/28 +# @License : Mulan PSL v2 +# @Desc : Check for dependencies in software systems +# ############################################# + +source "${OET_PATH}/testcases/feature-test/oedp/common.sh" + +function pre_test() { + LOG_INFO "Start to prepare the test environment." + pre_oedp + LOG_INFO "End to prepare the test environment." +} + +function run_test() { + LOG_INFO "Start to run test." + + dnf list --installed python3 + CHECK_RESULT $? 0 0 "Failed to check Python3 in the system" + + dnf list --installed ansible + CHECK_RESULT $? 0 0 "Failed to check ansible in the system" + + dnf list --installed python3-prettytable + CHECK_RESULT $? 0 0 "Failed to check python3-prettytable in the system" + + LOG_INFO "End to run test." +} + +main "$@" diff --git a/testcases/feature-test/oedp/oe_test_oedp_05.sh b/testcases/feature-test/oedp/oe_test_oedp_05.sh new file mode 100644 index 0000000000000000000000000000000000000000..bdd03656e4b2b6f674c80cfa6081eb9c8e9dc276 --- /dev/null +++ b/testcases/feature-test/oedp/oe_test_oedp_05.sh @@ -0,0 +1,46 @@ +#!/usr/bin/bash + +# Copyright (c) 2023. Huawei Technologies Co.,Ltd.ALL rights reserved. +# This program is licensed under Mulan PSL v2. +# You can use it according to the terms and conditions of the Mulan PSL v2. +# http://license.coscl.org.cn/MulanPSL2 +# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +# See the Mulan PSL v2 for more details. + +# ############################################# +# @Author : zhangjinqiang +# @Contact : jinqiang.oerv@isrc.iscas.ac.cn +# @Date : 2025/08/28 +# @License : Mulan PSL v2 +# @Desc : Deployment of AnythingLLM +# ############################################# + +source "${OET_PATH}/testcases/feature-test/oedp/common.sh" + +function pre_test() { + LOG_INFO "Start to prepare the test environment." + pre_oedp + SSH_CMD "dnf install -y python3-libselinux" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + oedp init anythingLLM + ssh-keyscan -H "${NODE2_IPV4}" >> ~/.ssh/known_hosts + sed -i 's#ansible_host: IP#ansible_host: "${NODE2_IPV4}"#g' ./anythingLLM/config.yaml + sed -i 's#ansible_password: ''#ansible_password: "${NODE2_PASSWORD}"#g' ./anythingLLM/config.yaml + + LOG_INFO "End to prepare the test environment." +} + +function run_test() { + LOG_INFO "Start to run test." + + oedp run install -p anythingLLM 2>&1 | grep "Execute succeeded: install anythingLLM" + CHECK_RESULT $? 0 0 "Failed to install anythingLLM" + + oedp run uninstall -p anythingLLM 2>&1 | grep "Execute succeeded: uninstall anythingLLM" + CHECK_RESULT $? 0 0 "Failed to uninstall anythingLLM" + + LOG_INFO "End to run test." +} + +main "$@" diff --git a/testcases/feature-test/oedp/oe_test_oedp_06.sh b/testcases/feature-test/oedp/oe_test_oedp_06.sh new file mode 100644 index 0000000000000000000000000000000000000000..86e816347bb5dd4fb259325d08dfe04f8b272b7a --- /dev/null +++ b/testcases/feature-test/oedp/oe_test_oedp_06.sh @@ -0,0 +1,50 @@ +#!/usr/bin/bash + +# Copyright (c) 2023. Huawei Technologies Co.,Ltd.ALL rights reserved. +# This program is licensed under Mulan PSL v2. +# You can use it according to the terms and conditions of the Mulan PSL v2. +# http://license.coscl.org.cn/MulanPSL2 +# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +# See the Mulan PSL v2 for more details. + +# ############################################# +# @Author : zhangjinqiang +# @Contact : jinqiang.oerv@isrc.iscas.ac.cn +# @Date : 2025/08/28 +# @License : Mulan PSL v2 +# @Desc : Deployment of AnythingLLM +# ############################################# + +source "${OET_PATH}/testcases/feature-test/oedp/common.sh" + + +function pre_test() { + LOG_INFO "Start to prepare the test environment." + pre_oedp + DNF_INSTALL python3-libselinux + ssh-keyscan -H "${NODE1_IPV4}" >> ~/.ssh/known_hosts + oedp init ragflow + sed -i 's#ansible_host: NODE_IP#ansible_host: "${NODE1_IPV4}"#g' ./ragflow/config.yaml + sed -i 's#ansible_port: NODE_PORT#ansible_port: 22#g' ./ragflow/config.yaml + sed -i 's#ansible_user: NODE_USER#ansible_user: "${NODE1_USER}"g' ./ragflow/config.yaml + sed -i 's#ansible_password: NODE_PASSWORD#ansible_password: "${NODE1_PASSWORD}"#g' ./ragflow/config.yaml + + LOG_INFO "End to prepare the test environment." +} + +function run_test() { + LOG_INFO "Start to run test." + + oedp run install -p ragflow ragflow 2>&1 | grep "Execute succeeded: Install RAGFlow" + CHECK_RESULT $? 0 0 "Failed to init RAGFlow" + + oedp run uninstall -p ragflow 2>&1 | grep "Execute succeeded: Uninstall RAGFlow" + CHECK_RESULT $? 0 0 "Failed to uninstall RAGFlow" + + + LOG_INFO "End to run test." +} + +main "$@"