forked from redrsoe2100/os-autotest
chore(ci): add exception test
This commit is contained in:
@@ -0,0 +1,162 @@
|
||||
{
|
||||
"path": "$OET_PATH/testcases/function_test/exception_test/exception_mugen/os-reboot",
|
||||
"machine type": "physical",
|
||||
"machine num": 2,
|
||||
"cases": [
|
||||
{
|
||||
"name": "oe_test_cold_halt_poweroff",
|
||||
"machine type": "physical",
|
||||
"machine num": 2
|
||||
},
|
||||
{
|
||||
"name": "oe_test_cold_init0",
|
||||
"machine type": "physical",
|
||||
"machine num": 2
|
||||
},
|
||||
{
|
||||
"name": "oe_test_cold_ipmi_off",
|
||||
"machine type": "physical",
|
||||
"machine num": 2
|
||||
},
|
||||
{
|
||||
"name": "oe_test_cold_ipmi_poweroff",
|
||||
"machine type": "physical",
|
||||
"machine num": 2
|
||||
},
|
||||
{
|
||||
"name": "oe_test_cold_poweroff_force",
|
||||
"machine type": "physical",
|
||||
"machine num": 2
|
||||
},
|
||||
{
|
||||
"name": "oe_test_cold_poweroff_nowtmp",
|
||||
"machine type": "physical",
|
||||
"machine num": 2
|
||||
},
|
||||
{
|
||||
"name": "oe_test_cold_reboot_poweroff",
|
||||
"machine type": "physical",
|
||||
"machine num": 2
|
||||
},
|
||||
{
|
||||
"name": "oe_test_cold_shutdown_force",
|
||||
"machine type": "physical",
|
||||
"machine num": 2
|
||||
},
|
||||
{
|
||||
"name": "oe_test_cold_shutdown_h",
|
||||
"machine type": "physical",
|
||||
"machine num": 2
|
||||
},
|
||||
{
|
||||
"name": "oe_test_cold_shutdown_poweroff",
|
||||
"machine type": "physical",
|
||||
"machine num": 2
|
||||
},
|
||||
{
|
||||
"name": "oe_test_cold_systemctl_poweroff",
|
||||
"machine type": "physical",
|
||||
"machine num": 2
|
||||
},
|
||||
{
|
||||
"name": "oe_test_hot_halt_force",
|
||||
"machine type": "physical",
|
||||
"machine num": 2
|
||||
},
|
||||
{
|
||||
"name": "oe_test_hot_halt_nowtmp",
|
||||
"machine type": "physical",
|
||||
"machine num": 2
|
||||
},
|
||||
{
|
||||
"name": "oe_test_hot_halt_reboot",
|
||||
"machine type": "physical",
|
||||
"machine num": 2
|
||||
},
|
||||
{
|
||||
"name": "oe_test_hot_init6",
|
||||
"machine type": "physical",
|
||||
"machine num": 2
|
||||
},
|
||||
{
|
||||
"name": "oe_test_hot_ipmi_halt",
|
||||
"machine type": "physical",
|
||||
"machine num": 2
|
||||
},
|
||||
{
|
||||
"name": "oe_test_hot_ipmi_reset",
|
||||
"machine type": "physical",
|
||||
"machine num": 2
|
||||
},
|
||||
{
|
||||
"name": "oe_test_hot_poweroff_halt",
|
||||
"machine type": "physical",
|
||||
"machine num": 2
|
||||
},
|
||||
{
|
||||
"name": "oe_test_hot_poweroff_reboot",
|
||||
"machine type": "physical",
|
||||
"machine num": 2
|
||||
},
|
||||
{
|
||||
"name": "oe_test_hot_reboot_force",
|
||||
"machine type": "physical",
|
||||
"machine num": 2
|
||||
},
|
||||
{
|
||||
"name": "oe_test_hot_reboot_halt",
|
||||
"machine type": "physical",
|
||||
"machine num": 2
|
||||
},
|
||||
{
|
||||
"name": "oe_test_hot_reboot_nowtmp",
|
||||
"machine type": "physical",
|
||||
"machine num": 2
|
||||
},
|
||||
{
|
||||
"name": "oe_test_hot_shutdown_halt",
|
||||
"machine type": "physical",
|
||||
"machine num": 2
|
||||
},
|
||||
{
|
||||
"name": "oe_test_hot_shutdown_reboot",
|
||||
"machine type": "physical",
|
||||
"machine num": 2
|
||||
},
|
||||
{
|
||||
"name": "oe_test_hot_systemctl_halt",
|
||||
"machine type": "physical",
|
||||
"machine num": 2
|
||||
},
|
||||
{
|
||||
"name": "oe_test_hot_systemctl_reboot",
|
||||
"machine type": "physical",
|
||||
"machine num": 2
|
||||
},
|
||||
{
|
||||
"name": "oe_test_reboot_50_times",
|
||||
"machine type": "physical",
|
||||
"machine num": 2
|
||||
},
|
||||
{
|
||||
"name": "oe_test_reboot_delayed",
|
||||
"machine type": "physical",
|
||||
"machine num": 2
|
||||
},
|
||||
{
|
||||
"name": "oe_test_reboot_press",
|
||||
"machine type": "physical",
|
||||
"machine num": 2
|
||||
},
|
||||
{
|
||||
"name": "oe_test_reboot_task_trigger",
|
||||
"machine type": "physical",
|
||||
"machine num": 2
|
||||
},
|
||||
{
|
||||
"name": "oe_test_reboot_timed",
|
||||
"machine type": "physical",
|
||||
"machine num": 2
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
#!/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 : liujingjing
|
||||
# @Contact : liujingjing25812@163.com
|
||||
# @Date : 2025/06/27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Reboot common file
|
||||
# #############################################
|
||||
# shellcheck disable=SC2001
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function build_env() {
|
||||
OLD_LANG=$LANG
|
||||
export LANG=en_US.UTF-8
|
||||
if [ -z "$NODE2_BMC_IP" ]; then
|
||||
exit 1
|
||||
fi
|
||||
DNF_INSTALL "ipmitool OpenIPMI net-tools"
|
||||
test_ip=$(echo "$NODE2_BMC_IP" | sed 's/\.[^.]*$//')
|
||||
ifconfig "${NODE1_NIC}":1 "${test_ip}".200/24 broadcast 255.255.255.0 up
|
||||
modprobe ipmi_watchdog
|
||||
modprobe ipmi_poweroff
|
||||
modprobe ipmi_devintf
|
||||
modprobe ipmi_msghandler
|
||||
modprobe ipmi_si
|
||||
systemctl restart ipmievd.service
|
||||
}
|
||||
|
||||
function clean_env() {
|
||||
export LANG=${OLD_LANG}
|
||||
ifconfig "${NODE1_NIC}":1 "${test_ip}".200/24 broadcast 255.255.255.0 down
|
||||
DNF_REMOVE "$@"
|
||||
modprobe -r ipmi_watchdog
|
||||
modprobe -r ipmi_poweroff
|
||||
modprobe -r ipmi_devintf
|
||||
modprobe -r ipmi_ssif
|
||||
modprobe -r ipmi_si
|
||||
modprobe -r ipmi_msghandler
|
||||
}
|
||||
main "$@"
|
||||
@@ -0,0 +1,48 @@
|
||||
#!/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 : liujingjing
|
||||
# @Contact : liujingjing25812@163.com
|
||||
# @Date : 2025/06/27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Halt calls poweroff
|
||||
# #############################################
|
||||
# shellcheck disable=SC1091
|
||||
source "./common_reboot.sh"
|
||||
|
||||
function pre_test() {
|
||||
LOG_INFO "Start to prepare the test environment."
|
||||
build_env
|
||||
LOG_INFO "End to prepare the test environment."
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "Start to run test."
|
||||
P_SSH_CMD --node 2 --cmd "sudo halt -p --poweroff &"
|
||||
SLEEP_WAIT 60
|
||||
ping -c 3 "${NODE2_IPV4}" >/dev/null
|
||||
CHECK_RESULT $? 0 1 "The execution of the 'halt -p --poweroff' command failed."
|
||||
ipmitool -H "${NODE2_BMC_IP}" -I lanplus -U "${NODE2_BMC_USER}" -P "${NODE2_BMC_PASSWORD}" power on
|
||||
CHECK_RESULT $? 0 0 "The execution of the 'power on' command failed."
|
||||
REMOTE_REBOOT_WAIT 2 120
|
||||
CHECK_RESULT $? 0 0 "The attempt to wait for the startup execution failed."
|
||||
ipmitool -H "${NODE2_BMC_IP}" -I lanplus -U "${NODE2_BMC_USER}" -P "${NODE2_BMC_PASSWORD}" power status | grep "Chassis Power is on"
|
||||
CHECK_RESULT $? 0 0 "The startup execution failed."
|
||||
LOG_INFO "End to run test."
|
||||
}
|
||||
|
||||
function post_test() {
|
||||
LOG_INFO "Start to restore the test environment."
|
||||
clean_env "$@"
|
||||
LOG_INFO "End to restore the test environment."
|
||||
}
|
||||
main "$@"
|
||||
@@ -0,0 +1,49 @@
|
||||
#!/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 : liujingjing
|
||||
# @Contact : liujingjing25812@163.com
|
||||
# @Date : 2025/06/27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : init 0
|
||||
# #############################################
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "./common_reboot.sh"
|
||||
|
||||
function pre_test() {
|
||||
LOG_INFO "Start to prepare the test environment."
|
||||
build_env
|
||||
LOG_INFO "End to prepare the test environment."
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "Start to run test."
|
||||
P_SSH_CMD --node 2 --cmd "sudo init 0 &"
|
||||
SLEEP_WAIT 60
|
||||
ping -c 3 "${NODE2_IPV4}" >/dev/null
|
||||
CHECK_RESULT $? 0 1 "The execution of the 'init 0' command failed."
|
||||
ipmitool -H "${NODE2_BMC_IP}" -I lanplus -U "${NODE2_BMC_USER}" -P "${NODE2_BMC_PASSWORD}" power on
|
||||
CHECK_RESULT $? 0 0 "The execution of the 'power on' command failed."
|
||||
REMOTE_REBOOT_WAIT 2 120
|
||||
CHECK_RESULT $? 0 0 "The attempt to wait for the startup execution failed."
|
||||
ipmitool -H "${NODE2_BMC_IP}" -I lanplus -U "${NODE2_BMC_USER}" -P "${NODE2_BMC_PASSWORD}" power status | grep "Chassis Power is on"
|
||||
CHECK_RESULT $? 0 0 "The startup execution failed."
|
||||
LOG_INFO "End to run test."
|
||||
}
|
||||
|
||||
function post_test() {
|
||||
LOG_INFO "Start to restore the test environment."
|
||||
clean_env "$@"
|
||||
LOG_INFO "End to restore the test environment."
|
||||
}
|
||||
main "$@"
|
||||
@@ -0,0 +1,49 @@
|
||||
#!/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 : liujingjing
|
||||
# @Contact : liujingjing25812@163.com
|
||||
# @Date : 2025/06/27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Ipmitool remote control server restart
|
||||
# #############################################
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "./common_reboot.sh"
|
||||
|
||||
function pre_test() {
|
||||
LOG_INFO "Start to prepare the test environment."
|
||||
build_env
|
||||
LOG_INFO "End to prepare the test environment."
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "Start to run test."
|
||||
ipmitool -H "${NODE2_BMC_IP}" -I lanplus -U "${NODE2_BMC_USER}" -P "${NODE2_BMC_PASSWORD}" power off
|
||||
SLEEP_WAIT 60
|
||||
ipmitool -H "${NODE2_BMC_IP}" -I lanplus -U "${NODE2_BMC_USER}" -P "${NODE2_BMC_PASSWORD}" power status | grep "Chassis Power is off"
|
||||
ping -c 3 "${NODE2_IPV4}" >/dev/null
|
||||
CHECK_RESULT $? 0 1 "The execution of the 'power off' command failed."
|
||||
ipmitool -H "${NODE2_BMC_IP}" -I lanplus -U "${NODE2_BMC_USER}" -P "${NODE2_BMC_PASSWORD}" power on
|
||||
REMOTE_REBOOT_WAIT 2 120
|
||||
CHECK_RESULT $? 0 0 "The attempt to wait for the startup execution failed."
|
||||
ipmitool -H "${NODE2_BMC_IP}" -I lanplus -U "${NODE2_BMC_USER}" -P "${NODE2_BMC_PASSWORD}" power status | grep "Chassis Power is on"
|
||||
CHECK_RESULT $? 0 0 "The startup execution failed."
|
||||
LOG_INFO "End to run test."
|
||||
}
|
||||
|
||||
function post_test() {
|
||||
LOG_INFO "Start to restore the test environment."
|
||||
clean_env "$@"
|
||||
LOG_INFO "End to restore the test environment."
|
||||
}
|
||||
main "$@"
|
||||
@@ -0,0 +1,49 @@
|
||||
#!/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 : liujingjing
|
||||
# @Contact : liujingjing25812@163.com
|
||||
# @Date : 2025/06/27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Ipmitool remote control server restart
|
||||
# #############################################
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "./common_reboot.sh"
|
||||
|
||||
function pre_test() {
|
||||
LOG_INFO "Start to prepare the test environment."
|
||||
build_env
|
||||
LOG_INFO "End to prepare the test environment."
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "Start to run test."
|
||||
P_SSH_CMD --node 2 --cmd "sudo poweroff &"
|
||||
SLEEP_WAIT 60
|
||||
ping -c 3 "${NODE2_IPV4}" >/dev/null
|
||||
CHECK_RESULT $? 0 1 "The execution of the 'poweroff' command failed."
|
||||
ipmitool -H "${NODE2_BMC_IP}" -I lanplus -U "${NODE2_BMC_USER}" -P "${NODE2_BMC_PASSWORD}" power on
|
||||
CHECK_RESULT $? 0 0 "The execution of the 'power on' command failed."
|
||||
REMOTE_REBOOT_WAIT 2 120
|
||||
CHECK_RESULT $? 0 0 "The attempt to wait for the startup execution failed."
|
||||
ipmitool -H "${NODE2_BMC_IP}" -I lanplus -U "${NODE2_BMC_USER}" -P "${NODE2_BMC_PASSWORD}" power status | grep "Chassis Power is on"
|
||||
CHECK_RESULT $? 0 0 "The startup execution failed."
|
||||
LOG_INFO "End to run test."
|
||||
}
|
||||
|
||||
function post_test() {
|
||||
LOG_INFO "Start to restore the test environment."
|
||||
clean_env "$@"
|
||||
LOG_INFO "End to restore the test environment."
|
||||
}
|
||||
main "$@"
|
||||
@@ -0,0 +1,49 @@
|
||||
#!/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 : liujingjing
|
||||
# @Contact : liujingjing25812@163.com
|
||||
# @Date : 2025/06/27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Forced poweroff
|
||||
# #############################################
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "./common_reboot.sh"
|
||||
|
||||
function pre_test() {
|
||||
LOG_INFO "Start to prepare the test environment."
|
||||
build_env
|
||||
LOG_INFO "End to prepare the test environment."
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "Start to run test."
|
||||
P_SSH_CMD --node 2 --cmd "sudo poweroff -f &>/dev/null &"
|
||||
SLEEP_WAIT 60
|
||||
ping -c 3 "${NODE2_IPV4}" >/dev/null
|
||||
CHECK_RESULT $? 0 1 "The execution of the 'poweroff -f' command failed."
|
||||
ipmitool -H "${NODE2_BMC_IP}" -I lanplus -U "${NODE2_BMC_USER}" -P "${NODE2_BMC_PASSWORD}" power on
|
||||
CHECK_RESULT $? 0 0 "The execution of the 'power on' command failed."
|
||||
REMOTE_REBOOT_WAIT 2 120
|
||||
CHECK_RESULT $? 0 0 "The attempt to wait for the startup execution failed."
|
||||
ipmitool -H "${NODE2_BMC_IP}" -I lanplus -U "${NODE2_BMC_USER}" -P "${NODE2_BMC_PASSWORD}" power status | grep "Chassis Power is on"
|
||||
CHECK_RESULT $? 0 0 "The startup execution failed."
|
||||
LOG_INFO "End to run test."
|
||||
}
|
||||
|
||||
function post_test() {
|
||||
LOG_INFO "Start to restore the test environment."
|
||||
clean_env "$@"
|
||||
LOG_INFO "End to restore the test environment."
|
||||
}
|
||||
main "$@"
|
||||
@@ -0,0 +1,57 @@
|
||||
#!/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 : liujingjing
|
||||
# @Contact : liujingjing25812@163.com
|
||||
# @Date : 2025/06/27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Don't write wtmp record
|
||||
# #############################################
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "./common_reboot.sh"
|
||||
|
||||
function pre_test() {
|
||||
LOG_INFO "Start to prepare the test environment."
|
||||
build_env
|
||||
LOG_INFO "End to prepare the test environment."
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "Start to run test."
|
||||
if P_SSH_CMD --node 2 --cmd "systemctl status systemd-update-utmp.service | grep 'active'"; then
|
||||
LOG_INFO "systemd-update-utmp.service exist"
|
||||
else
|
||||
LOG_INFO "systemd-update-utmp.service dose not exist"
|
||||
P_SSH_CMD --node 2 --cmd "echo >/var/log/wtmp;date -s 2020-10-10;poweroff -d --no-wtmp & env LANG=en_US.UTF-8 date +'%a %h %d %H:%M' >/home/time.txt;"
|
||||
SLEEP_WAIT 90
|
||||
ping -c 3 "${NODE2_IPV4}" >/dev/null
|
||||
CHECK_RESULT $? 0 1 "The execution of the 'poweroff -d' command failed."
|
||||
ipmitool -H "${NODE2_BMC_IP}" -I lanplus -U "${NODE2_BMC_USER}" -P "${NODE2_BMC_PASSWORD}" power on
|
||||
CHECK_RESULT $? 0 0 "The execution of the 'power on' command failed."
|
||||
REMOTE_REBOOT_WAIT 2 120
|
||||
CHECK_RESULT $? 0 0 "The attempt to wait for the startup execution failed."
|
||||
ipmitool -H "${NODE2_BMC_IP}" -I lanplus -U "${NODE2_BMC_USER}" -P "${NODE2_BMC_PASSWORD}" power status | grep "Chassis Power is on"
|
||||
CHECK_RESULT $? 0 0 "The startup execution failed."
|
||||
P_SSH_CMD --node 2 --cmd "last -f /var/log/wtmp >/home/wtmp.txt;grep -wf /home/time.txt /home/wtmp.txt"
|
||||
CHECK_RESULT $? 0 1 "The execution of the wtmp failed."
|
||||
fi
|
||||
LOG_INFO "End to run test."
|
||||
}
|
||||
|
||||
function post_test() {
|
||||
LOG_INFO "Start to restore the test environment."
|
||||
P_SSH_CMD --node 2 --cmd "echo > /var/log/wtmp;rm -rf /home/time.txt /home/wtmp.txt"
|
||||
clean_env "$@"
|
||||
LOG_INFO "End to restore the test environment."
|
||||
}
|
||||
main "$@"
|
||||
@@ -0,0 +1,49 @@
|
||||
#!/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 : liujingjing
|
||||
# @Contact : liujingjing25812@163.com
|
||||
# @Date : 2025/06/27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Reboot calls poweroff
|
||||
# #############################################
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "./common_reboot.sh"
|
||||
|
||||
function pre_test() {
|
||||
LOG_INFO "Start to prepare the test environment."
|
||||
build_env
|
||||
LOG_INFO "End to prepare the test environment."
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "Start to run test."
|
||||
P_SSH_CMD --node 2 --cmd "sudo reboot -p --poweroff &"
|
||||
SLEEP_WAIT 60
|
||||
ping -c 3 "${NODE2_IPV4}" >/dev/null
|
||||
CHECK_RESULT $? 0 1 "The execution of the 'reboot -p --poweroff' command failed."
|
||||
ipmitool -H "${NODE2_BMC_IP}" -I lanplus -U "${NODE2_BMC_USER}" -P "${NODE2_BMC_PASSWORD}" power on
|
||||
CHECK_RESULT $? 0 0 "The execution of the 'power on' command failed."
|
||||
REMOTE_REBOOT_WAIT 2 120
|
||||
CHECK_RESULT $? 0 0 "The attempt to wait for the startup execution failed."
|
||||
ipmitool -H "${NODE2_BMC_IP}" -I lanplus -U "${NODE2_BMC_USER}" -P "${NODE2_BMC_PASSWORD}" power status | grep "Chassis Power is on"
|
||||
CHECK_RESULT $? 0 0 "The startup execution failed."
|
||||
LOG_INFO "End to run test."
|
||||
}
|
||||
|
||||
function post_test() {
|
||||
LOG_INFO "Start to restore the test environment."
|
||||
clean_env "$@"
|
||||
LOG_INFO "End to restore the test environment."
|
||||
}
|
||||
main "$@"
|
||||
@@ -0,0 +1,49 @@
|
||||
#!/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 : liujingjing
|
||||
# @Contact : liujingjing25812@163.com
|
||||
# @Date : 2025/06/27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Forced shutdown
|
||||
# #############################################
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "./common_reboot.sh"
|
||||
|
||||
function pre_test() {
|
||||
LOG_INFO "Start to prepare the test environment."
|
||||
build_env
|
||||
LOG_INFO "End to prepare the test environment."
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "Start to run test."
|
||||
P_SSH_CMD --node 2 --cmd "sudo shutdown -f &"
|
||||
SLEEP_WAIT 120
|
||||
ping -c 3 "${NODE2_IPV4}" >/dev/null
|
||||
CHECK_RESULT $? 0 1 "The execution of the 'shutdown -f' command failed."
|
||||
ipmitool -H "${NODE2_BMC_IP}" -I lanplus -U "${NODE2_BMC_USER}" -P "${NODE2_BMC_PASSWORD}" power on
|
||||
CHECK_RESULT $? 0 0 "The execution of the 'power on' command failed."
|
||||
REMOTE_REBOOT_WAIT 2 120
|
||||
CHECK_RESULT $? 0 0 "The attempt to wait for the startup execution failed."
|
||||
ipmitool -H "${NODE2_BMC_IP}" -I lanplus -U "${NODE2_BMC_USER}" -P "${NODE2_BMC_PASSWORD}" power status | grep "Chassis Power is on"
|
||||
CHECK_RESULT $? 0 0 "The startup execution failed."
|
||||
LOG_INFO "End to run test."
|
||||
}
|
||||
|
||||
function post_test() {
|
||||
LOG_INFO "Start to restore the test environment."
|
||||
clean_env "$@"
|
||||
LOG_INFO "End to restore the test environment."
|
||||
}
|
||||
main "$@"
|
||||
@@ -0,0 +1,49 @@
|
||||
#!/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 : liujingjing
|
||||
# @Contact : liujingjing25812@163.com
|
||||
# @Date : 2025/06/27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Equivalent to --poweroff, overridden by --halt
|
||||
# #############################################
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "./common_reboot.sh"
|
||||
|
||||
function pre_test() {
|
||||
LOG_INFO "Start to prepare the test environment."
|
||||
build_env
|
||||
LOG_INFO "End to prepare the test environment."
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "Start to run test."
|
||||
P_SSH_CMD --node 2 --cmd "sudo shutdown -h now &"
|
||||
SLEEP_WAIT 60
|
||||
ping -c 3 "${NODE2_IPV4}" >/dev/null
|
||||
CHECK_RESULT $? 0 1 "The execution of the 'shutdown -h' command failed."
|
||||
ipmitool -H "${NODE2_BMC_IP}" -I lanplus -U "${NODE2_BMC_USER}" -P "${NODE2_BMC_PASSWORD}" power on
|
||||
CHECK_RESULT $? 0 0 "The execution of the 'power on' command failed."
|
||||
REMOTE_REBOOT_WAIT 2 120
|
||||
CHECK_RESULT $? 0 0 "The attempt to wait for the startup execution failed."
|
||||
ipmitool -H "${NODE2_BMC_IP}" -I lanplus -U "${NODE2_BMC_USER}" -P "${NODE2_BMC_PASSWORD}" power status | grep "Chassis Power is on"
|
||||
CHECK_RESULT $? 0 0 "The startup execution failed."
|
||||
LOG_INFO "End to run test."
|
||||
}
|
||||
|
||||
function post_test() {
|
||||
LOG_INFO "Start to restore the test environment."
|
||||
clean_env "$@"
|
||||
LOG_INFO "End to restore the test environment."
|
||||
}
|
||||
main "$@"
|
||||
@@ -0,0 +1,49 @@
|
||||
#!/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 : liujingjing
|
||||
# @Contact : liujingjing25812@163.com
|
||||
# @Date : 2025/06/27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Shutdown calls poweroff
|
||||
# #############################################
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "./common_reboot.sh"
|
||||
|
||||
function pre_test() {
|
||||
LOG_INFO "Start to prepare the test environment."
|
||||
build_env
|
||||
LOG_INFO "End to prepare the test environment."
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "Start to run test."
|
||||
P_SSH_CMD --node 2 --cmd "sudo shutdown -P --poweroff &"
|
||||
SLEEP_WAIT 120
|
||||
ping -c 3 "${NODE2_IPV4}" >/dev/null
|
||||
CHECK_RESULT $? 0 1 "The execution of the 'shutdown -P --poweroff' command failed."
|
||||
ipmitool -H "${NODE2_BMC_IP}" -I lanplus -U "${NODE2_BMC_USER}" -P "${NODE2_BMC_PASSWORD}" power on
|
||||
CHECK_RESULT $? 0 0 "The execution of the 'power on' command failed."
|
||||
REMOTE_REBOOT_WAIT 2 120
|
||||
CHECK_RESULT $? 0 0 "The attempt to wait for the startup execution failed."
|
||||
ipmitool -H "${NODE2_BMC_IP}" -I lanplus -U "${NODE2_BMC_USER}" -P "${NODE2_BMC_PASSWORD}" power status | grep "Chassis Power is on"
|
||||
CHECK_RESULT $? 0 0 "The startup execution failed."
|
||||
LOG_INFO "End to run test."
|
||||
}
|
||||
|
||||
function post_test() {
|
||||
LOG_INFO "Start to restore the test environment."
|
||||
clean_env "$@"
|
||||
LOG_INFO "End to restore the test environment."
|
||||
}
|
||||
main "$@"
|
||||
@@ -0,0 +1,49 @@
|
||||
#!/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 : liujingjing
|
||||
# @Contact : liujingjing25812@163.com
|
||||
# @Date : 2025/06/27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Systemctl calls poweroff
|
||||
# #############################################
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "./common_reboot.sh"
|
||||
|
||||
function pre_test() {
|
||||
LOG_INFO "Start to prepare the test environment."
|
||||
build_env
|
||||
LOG_INFO "End to prepare the test environment."
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "Start to run test."
|
||||
P_SSH_CMD --node 2 --cmd "sudo systemctl poweroff &"
|
||||
SLEEP_WAIT 60
|
||||
ping -c 3 "${NODE2_IPV4}" >/dev/null
|
||||
CHECK_RESULT $? 0 1 "The execution of the 'systemctl poweroff' command failed."
|
||||
ipmitool -H "${NODE2_BMC_IP}" -I lanplus -U "${NODE2_BMC_USER}" -P "${NODE2_BMC_PASSWORD}" power on
|
||||
CHECK_RESULT $? 0 0 "The execution of the 'power on' command failed."
|
||||
REMOTE_REBOOT_WAIT 2 120
|
||||
CHECK_RESULT $? 0 0 "The attempt to wait for the startup execution failed."
|
||||
ipmitool -H "${NODE2_BMC_IP}" -I lanplus -U "${NODE2_BMC_USER}" -P "${NODE2_BMC_PASSWORD}" power status | grep "Chassis Power is on"
|
||||
CHECK_RESULT $? 0 0 "The startup execution failed."
|
||||
LOG_INFO "End to run test."
|
||||
}
|
||||
|
||||
function post_test() {
|
||||
LOG_INFO "Start to restore the test environment."
|
||||
clean_env "$@"
|
||||
LOG_INFO "End to restore the test environment."
|
||||
}
|
||||
main "$@"
|
||||
@@ -0,0 +1,49 @@
|
||||
#!/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 : liujingjing
|
||||
# @Contact : liujingjing25812@163.com
|
||||
# @Date : 2025/06/27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Forced halt
|
||||
# #############################################
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "./common_reboot.sh"
|
||||
|
||||
function pre_test() {
|
||||
LOG_INFO "Start to prepare the test environment."
|
||||
build_env
|
||||
LOG_INFO "End to prepare the test environment."
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "Start to run test."
|
||||
P_SSH_CMD --node 2 --cmd "sudo halt -f &>/dev/null &"
|
||||
SLEEP_WAIT 120
|
||||
ping -c 3 "${NODE2_IPV4}" >/dev/null
|
||||
CHECK_RESULT $? 0 1 "The execution of the 'halt -f' command failed."
|
||||
ipmitool -H "${NODE2_BMC_IP}" -I lanplus -U "${NODE2_BMC_USER}" -P "${NODE2_BMC_PASSWORD}" power reset
|
||||
CHECK_RESULT $? 0 0 "The execution of the 'power reset' command failed."
|
||||
REMOTE_REBOOT_WAIT 2 120
|
||||
CHECK_RESULT $? 0 0 "The attempt to wait for the startup execution failed."
|
||||
ipmitool -H "${NODE2_BMC_IP}" -I lanplus -U "${NODE2_BMC_USER}" -P "${NODE2_BMC_PASSWORD}" power status | grep "Chassis Power is on"
|
||||
CHECK_RESULT $? 0 0 "The startup execution failed."
|
||||
LOG_INFO "End to run test."
|
||||
}
|
||||
|
||||
function post_test() {
|
||||
LOG_INFO "Start to restore the test environment."
|
||||
clean_env "$@"
|
||||
LOG_INFO "End to restore the test environment."
|
||||
}
|
||||
main "$@"
|
||||
@@ -0,0 +1,57 @@
|
||||
#!/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 : liujingjing
|
||||
# @Contact : liujingjing25812@163.com
|
||||
# @Date : 2025/06/27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Don't write wtmp record
|
||||
# #############################################
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "./common_reboot.sh"
|
||||
|
||||
function pre_test() {
|
||||
LOG_INFO "Start to prepare the test environment."
|
||||
build_env
|
||||
LOG_INFO "End to prepare the test environment."
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "Start to run test."
|
||||
if P_SSH_CMD --node 2 --cmd "systemctl status systemd-update-utmp.service | grep 'active'"; then
|
||||
LOG_INFO "systemd-update-utmp.service exist"
|
||||
else
|
||||
LOG_INFO "systemd-update-utmp.service dose not exist"
|
||||
P_SSH_CMD --node 2 --cmd "echo >/var/log/wtmp;date -s 2020/10/10;sudo halt -d --no-wtmp & env LANG=en_US.UTF-8 date +'%a %h %d %H:%M' >/home/time.txt;"
|
||||
SLEEP_WAIT 90
|
||||
ping -c 3 "${NODE2_IPV4}" >/dev/null
|
||||
CHECK_RESULT $? 0 1 "The execution of the 'halt -d' command failed."
|
||||
ipmitool -H "${NODE2_BMC_IP}" -I lanplus -U "${NODE2_BMC_USER}" -P "${NODE2_BMC_PASSWORD}" power on
|
||||
CHECK_RESULT $? 0 0 "The execution of the 'power on' command failed."
|
||||
REMOTE_REBOOT_WAIT 2 120
|
||||
CHECK_RESULT $? 0 0 "The attempt to wait for the startup execution failed."
|
||||
ipmitool -H "${NODE2_BMC_IP}" -I lanplus -U "${NODE2_BMC_USER}" -P "${NODE2_BMC_PASSWORD}" power status | grep "Chassis Power is on"
|
||||
CHECK_RESULT $? 0 0 "The startup execution failed."
|
||||
P_SSH_CMD --node 2 --cmd "cat /home/time.txt;last -f /var/log/wtmp >/home/wtmp.txt;grep -wf /home/time.txt /home/wtmp.txt;"
|
||||
CHECK_RESULT $? 0 1 "The execution of the wtmp failed."
|
||||
fi
|
||||
LOG_INFO "End to run test."
|
||||
}
|
||||
|
||||
function post_test() {
|
||||
LOG_INFO "Start to restore the test environment."
|
||||
P_SSH_CMD --node 2 --cmd "echo > /var/log/wtmp;rm -rf /home/time.txt /home/wtmp.txt"
|
||||
clean_env "$@"
|
||||
LOG_INFO "End to restore the test environment."
|
||||
}
|
||||
main "$@"
|
||||
@@ -0,0 +1,34 @@
|
||||
#!/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 : liujingjing
|
||||
# @Contact : liujingjing25812@163.com
|
||||
# @Date : 2025/06/27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Halt calls reboot
|
||||
# #############################################
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "./common_reboot.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "Start to run test."
|
||||
P_SSH_CMD --node 2 --cmd "sudo halt -p --reboot &"
|
||||
SLEEP_WAIT 8
|
||||
ping -c 3 "${NODE2_IPV4}" >/dev/null
|
||||
CHECK_RESULT $? 0 1 "The execution of the 'halt -p --reboot' command failed."
|
||||
REMOTE_REBOOT_WAIT 2 120
|
||||
CHECK_RESULT $? 0 0 "The attempt to wait for the startup execution failed."
|
||||
LOG_INFO "End to run test."
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2020. 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 : liujingjing
|
||||
# @Contact : liujingjing25812@163.com
|
||||
# @Date : 2025/06/27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : init 6
|
||||
# #############################################
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "./common_reboot.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "Start to run test."
|
||||
P_SSH_CMD --node 2 --cmd "sudo init 6 &"
|
||||
SLEEP_WAIT 8
|
||||
ping -c 3 "${NODE2_IPV4}" >/dev/null
|
||||
CHECK_RESULT $? 0 1 "The execution of the 'init 6' command failed."
|
||||
REMOTE_REBOOT_WAIT 2 120
|
||||
CHECK_RESULT $? 0 0 "The attempt to wait for the startup execution failed."
|
||||
LOG_INFO "End to run test."
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -0,0 +1,49 @@
|
||||
#!/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 : liujingjing
|
||||
# @Contact : liujingjing25812@163.com
|
||||
# @Date : 2025/06/27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Ipmitool remote control server restart
|
||||
# #############################################
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "./common_reboot.sh"
|
||||
|
||||
function pre_test() {
|
||||
LOG_INFO "Start to prepare the test environment."
|
||||
build_env
|
||||
LOG_INFO "End to prepare the test environment."
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "Start to run test."
|
||||
P_SSH_CMD --node 2 --cmd "sudo halt &"
|
||||
SLEEP_WAIT 60
|
||||
ping -c 3 "${NODE2_IPV4}" >/dev/null
|
||||
CHECK_RESULT $? 0 1 "The execution of the 'halt' command failed."
|
||||
ipmitool -H "${NODE2_BMC_IP}" -I lanplus -U "${NODE2_BMC_USER}" -P "${NODE2_BMC_PASSWORD}" power reset
|
||||
CHECK_RESULT $? 0 0 "The execution of the 'power reset' command failed."
|
||||
REMOTE_REBOOT_WAIT 2 120
|
||||
CHECK_RESULT $? 0 0 "The attempt to wait for the startup execution failed."
|
||||
ipmitool -H "${NODE2_BMC_IP}" -I lanplus -U "${NODE2_BMC_USER}" -P "${NODE2_BMC_PASSWORD}" power status | grep "Chassis Power is on"
|
||||
CHECK_RESULT $? 0 0 "The startup execution failed."
|
||||
LOG_INFO "End to run test."
|
||||
}
|
||||
|
||||
function post_test() {
|
||||
LOG_INFO "Start to restore the test environment."
|
||||
clean_env "$@"
|
||||
LOG_INFO "End to restore the test environment."
|
||||
}
|
||||
main "$@"
|
||||
@@ -0,0 +1,48 @@
|
||||
#!/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 : liujingjing
|
||||
# @Contact : liujingjing25812@163.com
|
||||
# @Date : 2025/06/27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Ipmitool remote control server restart
|
||||
# #############################################
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "./common_reboot.sh"
|
||||
|
||||
function pre_test() {
|
||||
LOG_INFO "Start to prepare the test environment."
|
||||
build_env
|
||||
LOG_INFO "End to prepare the test environment."
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "Start to run test."
|
||||
ipmitool -H "${NODE2_BMC_IP}" -I lanplus -U "${NODE2_BMC_USER}" -P "${NODE2_BMC_PASSWORD}" power reset
|
||||
CHECK_RESULT $?
|
||||
SLEEP_WAIT 10
|
||||
ping -c 3 "${NODE2_IPV4}" >/dev/null
|
||||
CHECK_RESULT $? 0 1 "The execution of the 'power reset' command failed."
|
||||
REMOTE_REBOOT_WAIT 2 120
|
||||
CHECK_RESULT $? 0 0 "The attempt to wait for the startup execution failed."
|
||||
ipmitool -H "${NODE2_BMC_IP}" -I lanplus -U "${NODE2_BMC_USER}" -P "${NODE2_BMC_PASSWORD}" power status | grep "Chassis Power is on"
|
||||
CHECK_RESULT $? 0 0 "The startup execution failed."
|
||||
LOG_INFO "End to run test."
|
||||
}
|
||||
|
||||
function post_test() {
|
||||
LOG_INFO "Start to restore the test environment."
|
||||
clean_env "$@"
|
||||
LOG_INFO "End to restore the test environment."
|
||||
}
|
||||
main "$@"
|
||||
@@ -0,0 +1,48 @@
|
||||
#!/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 : liujingjing
|
||||
# @Contact : liujingjing25812@163.com
|
||||
# @Date : 2025/06/27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Poweroff calls halt
|
||||
# #############################################
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "./common_reboot.sh"
|
||||
|
||||
function pre_test() {
|
||||
LOG_INFO "Start to prepare the test environment."
|
||||
build_env
|
||||
LOG_INFO "End to prepare the test environment."
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "Start to run test."
|
||||
P_SSH_CMD --node 2 --cmd "sudo poweroff --halt &"
|
||||
SLEEP_WAIT 60
|
||||
ping -c 3 "${NODE2_IPV4}" >/dev/null
|
||||
CHECK_RESULT $? 0 1 "The execution of the 'poweroff --halt' command failed."
|
||||
ipmitool -H "${NODE2_BMC_IP}" -I lanplus -U "${NODE2_BMC_USER}" -P "${NODE2_BMC_PASSWORD}" power reset
|
||||
REMOTE_REBOOT_WAIT 2 120
|
||||
CHECK_RESULT $? 0 0 "The attempt to wait for the startup execution failed."
|
||||
ipmitool -H "${NODE2_BMC_IP}" -I lanplus -U "${NODE2_BMC_USER}" -P "${NODE2_BMC_PASSWORD}" power status | grep "Chassis Power is on"
|
||||
CHECK_RESULT $? 0 0 "The startup execution failed."
|
||||
LOG_INFO "End to run test."
|
||||
}
|
||||
|
||||
function post_test() {
|
||||
LOG_INFO "Start to restore the test environment."
|
||||
clean_env "$@"
|
||||
LOG_INFO "End to restore the test environment."
|
||||
}
|
||||
main "$@"
|
||||
@@ -0,0 +1,34 @@
|
||||
#!/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 : liujingjing
|
||||
# @Contact : liujingjing25812@163.com
|
||||
# @Date : 2025/06/27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Poweroff calls reboot
|
||||
# #############################################
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "./common_reboot.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "Start to run test."
|
||||
P_SSH_CMD --node 2 --cmd "sudo poweroff -p --reboot &"
|
||||
SLEEP_WAIT 10
|
||||
ping -c 3 "${NODE2_IPV4}" >/dev/null
|
||||
CHECK_RESULT $? 0 1 "The execution of the 'poweroff -p --reboot' command failed."
|
||||
REMOTE_REBOOT_WAIT 2 120
|
||||
CHECK_RESULT $? 0 0 "The attempt to wait for the startup execution failed."
|
||||
LOG_INFO "End to run test."
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -0,0 +1,34 @@
|
||||
#!/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 : liujingjing
|
||||
# @Contact : liujingjing25812@163.com
|
||||
# @Date : 2025/06/27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Forced reboot
|
||||
# #############################################
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "./common_reboot.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "Start to run test."
|
||||
P_SSH_CMD --node 2 --cmd "sudo reboot -f &>/dev/null &"
|
||||
SLEEP_WAIT 5
|
||||
ping -c 3 "${NODE2_IPV4}" >/dev/null
|
||||
CHECK_RESULT $? 0 1 "The execution of the 'reboot -f' command failed."
|
||||
REMOTE_REBOOT_WAIT 2 120
|
||||
CHECK_RESULT $? 0 0 "The attempt to wait for the startup execution failed."
|
||||
LOG_INFO "End to run test."
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -0,0 +1,48 @@
|
||||
#!/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 : liujingjing
|
||||
# @Contact : liujingjing25812@163.com
|
||||
# @Date : 2025/06/27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Reboot calls halt
|
||||
# #############################################
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "./common_reboot.sh"
|
||||
|
||||
function pre_test() {
|
||||
LOG_INFO "Start to prepare the test environment."
|
||||
build_env
|
||||
LOG_INFO "End to prepare the test environment."
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "Start to run test."
|
||||
P_SSH_CMD --node 2 --cmd "sudo reboot --halt &"
|
||||
SLEEP_WAIT 8
|
||||
ping -c 3 "${NODE2_IPV4}" >/dev/null
|
||||
CHECK_RESULT $? 0 1 "The execution of the 'reboot --halt' command failed."
|
||||
ipmitool -H "${NODE2_BMC_IP}" -I lanplus -U "${NODE2_BMC_USER}" -P "${NODE2_BMC_PASSWORD}" power reset
|
||||
REMOTE_REBOOT_WAIT 2 120
|
||||
CHECK_RESULT $? 0 0 "The attempt to wait for the startup execution failed."
|
||||
ipmitool -H "${NODE2_BMC_IP}" -I lanplus -U "${NODE2_BMC_USER}" -P "${NODE2_BMC_PASSWORD}" power status | grep "Chassis Power is on"
|
||||
CHECK_RESULT $? 0 0 "The startup execution failed."
|
||||
LOG_INFO "End to run test."
|
||||
}
|
||||
|
||||
function post_test() {
|
||||
LOG_INFO "Start to restore the test environment."
|
||||
clean_env "$@"
|
||||
LOG_INFO "End to restore the test environment."
|
||||
}
|
||||
main "$@"
|
||||
@@ -0,0 +1,43 @@
|
||||
#!/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 : liujingjing
|
||||
# @Contact : liujingjing25812@163.com
|
||||
# @Date : 2025/06/27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Don't write wtmp record
|
||||
# #############################################
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "./common_reboot.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "Start to run test."
|
||||
if P_SSH_CMD --node 2 --cmd "systemctl status systemd-update-utmp.service | grep 'active'"; then
|
||||
LOG_INFO "systemd-update-utmp.service exist"
|
||||
else
|
||||
LOG_INFO "systemd-update-utmp.service dose not exist"
|
||||
P_SSH_CMD --node 2 --cmd "echo >/var/log/wtmp;date -s 2020-10-10;sudo reboot -d --no-wtmp & env LANG=en_US.UTF-8 date +'%a %h %d %H:%M' >>/home/time.txt"
|
||||
REMOTE_REBOOT_WAIT 2 120
|
||||
CHECK_RESULT $? 0 0 "The attempt to wait for the startup execution failed."
|
||||
P_SSH_CMD --node 2 --cmd "cat /home/time.txt;last -f /var/log/wtmp >/home/wtmp.txt;grep -wf /home/time.txt /home/wtmp.txt"
|
||||
CHECK_RESULT $? 0 1 "The execution of the wtmp failed."
|
||||
fi
|
||||
LOG_INFO "End to run test."
|
||||
}
|
||||
|
||||
function post_test() {
|
||||
LOG_INFO "Start to restore the test environment."
|
||||
P_SSH_CMD --node 2 --cmd "echo > /var/log/wtmp;rm -rf /home/time.txt /home/wtmp.txt"
|
||||
LOG_INFO "End to restore the test environment."
|
||||
}
|
||||
main "$@"
|
||||
@@ -0,0 +1,48 @@
|
||||
#!/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 : liujingjing
|
||||
# @Contact : liujingjing25812@163.com
|
||||
# @Date : 2025/06/27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Shutdown calls halt
|
||||
# #############################################
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "./common_reboot.sh"
|
||||
|
||||
function pre_test() {
|
||||
LOG_INFO "Start to prepare the test environment."
|
||||
build_env
|
||||
LOG_INFO "End to prepare the test environment."
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "Start to run test."
|
||||
P_SSH_CMD --node 2 --cmd "sudo shutdown -H --halt &"
|
||||
SLEEP_WAIT 120
|
||||
ping -c 3 "${NODE2_IPV4}" >/dev/null
|
||||
CHECK_RESULT $? 0 1 "The execution of the 'shutdown -H --halt' command failed."
|
||||
ipmitool -H "${NODE2_BMC_IP}" -I lanplus -U "${NODE2_BMC_USER}" -P "${NODE2_BMC_PASSWORD}" power reset
|
||||
REMOTE_REBOOT_WAIT 2 120
|
||||
CHECK_RESULT $? 0 0 "The attempt to wait for the startup execution failed."
|
||||
ipmitool -H "${NODE2_BMC_IP}" -I lanplus -U "${NODE2_BMC_USER}" -P "${NODE2_BMC_PASSWORD}" power status | grep "Chassis Power is on"
|
||||
CHECK_RESULT $? 0 0 "The startup execution failed."
|
||||
LOG_INFO "End to run test."
|
||||
}
|
||||
|
||||
function post_test() {
|
||||
LOG_INFO "Start to restore the test environment."
|
||||
clean_env "$@"
|
||||
LOG_INFO "End to restore the test environment."
|
||||
}
|
||||
main "$@"
|
||||
@@ -0,0 +1,34 @@
|
||||
#!/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 : liujingjing
|
||||
# @Contact : liujingjing25812@163.com
|
||||
# @Date : 2025/06/27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Shutdown calls reboot
|
||||
# #############################################
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "./common_reboot.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "Start to run test."
|
||||
P_SSH_CMD --node 2 --cmd "sudo shutdown -r now &"
|
||||
SLEEP_WAIT 10
|
||||
ping -c 3 "${NODE2_IPV4}" >/dev/null
|
||||
CHECK_RESULT $? 0 1 "The execution of the 'shutdown -r now' command failed."
|
||||
REMOTE_REBOOT_WAIT 2 120
|
||||
CHECK_RESULT $? 0 0 "The attempt to wait for the startup execution failed."
|
||||
LOG_INFO "End to run test."
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -0,0 +1,48 @@
|
||||
#!/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 : liujingjing
|
||||
# @Contact : liujingjing25812@163.com
|
||||
# @Date : 2025/06/27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Systemctl calls halt
|
||||
# #############################################
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "./common_reboot.sh"
|
||||
|
||||
function pre_test() {
|
||||
LOG_INFO "Start to prepare the test environment."
|
||||
build_env
|
||||
LOG_INFO "End to prepare the test environment."
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "Start to run test."
|
||||
P_SSH_CMD --node 2 --cmd "sudo systemctl halt &"
|
||||
SLEEP_WAIT 120
|
||||
ping -c 3 "${NODE2_IPV4}" >/dev/null
|
||||
CHECK_RESULT $? 0 1 "The execution of the 'systemctl halt' command failed."
|
||||
ipmitool -H "${NODE2_BMC_IP}" -I lanplus -U "${NODE2_BMC_USER}" -P "${NODE2_BMC_PASSWORD}" power reset
|
||||
REMOTE_REBOOT_WAIT 2 120
|
||||
CHECK_RESULT $? 0 0 "The attempt to wait for the startup execution failed."
|
||||
ipmitool -H "${NODE2_BMC_IP}" -I lanplus -U "${NODE2_BMC_USER}" -P "${NODE2_BMC_PASSWORD}" power status | grep "Chassis Power is on"
|
||||
CHECK_RESULT $? 0 0 "The startup execution failed."
|
||||
LOG_INFO "End to run test."
|
||||
}
|
||||
|
||||
function post_test() {
|
||||
LOG_INFO "Start to restore the test environment."
|
||||
clean_env "$@"
|
||||
LOG_INFO "End to restore the test environment."
|
||||
}
|
||||
main "$@"
|
||||
@@ -0,0 +1,34 @@
|
||||
#!/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 : liujingjing
|
||||
# @Contact : liujingjing25812@163.com
|
||||
# @Date : 2025/06/27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Systemctl calls reboot
|
||||
# #############################################
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "./common_reboot.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "Start to run test."
|
||||
P_SSH_CMD --node 2 --cmd "sudo systemctl reboot &"
|
||||
SLEEP_WAIT 8
|
||||
ping -c 3 "${NODE2_IPV4}" >/dev/null
|
||||
CHECK_RESULT $? 0 1 "The execution of the 'systemctl reboot' command failed."
|
||||
REMOTE_REBOOT_WAIT 2 120
|
||||
CHECK_RESULT $? 0 0 "The attempt to wait for the startup execution failed."
|
||||
LOG_INFO "End to run test."
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -0,0 +1,38 @@
|
||||
#!/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 : liujingjing
|
||||
# @Contact : liujingjing25812@163.com
|
||||
# @Date : 2025/06/27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Reboot 50 times
|
||||
# #############################################
|
||||
|
||||
# shellcheck disable=SC1091,SC2034
|
||||
source "./common_reboot.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "Start to run test."
|
||||
EXECUTE_T="200m"
|
||||
flag=0
|
||||
while ((flag < 50)); do
|
||||
P_SSH_CMD --node 2 --cmd "sudo reboot &"
|
||||
CHECK_RESULT $? 0 0 "The execution of the 'reboot' command failed."
|
||||
SLEEP_WAIT 10
|
||||
REMOTE_REBOOT_WAIT 2 60
|
||||
CHECK_RESULT $? 0 0 "The attempt to wait for the startup execution failed."
|
||||
((flag++)) || true
|
||||
done
|
||||
LOG_INFO "End to run test."
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -0,0 +1,35 @@
|
||||
#!/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 : liujingjing
|
||||
# @Contact : liujingjing25812@163.com
|
||||
# @Date : 2025/06/27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Timed restart
|
||||
# #############################################
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "./common_reboot.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "Start to run test."
|
||||
P_SSH_CMD --node 2 --cmd "sudo shutdown -r +1 "
|
||||
CHECK_RESULT $? 0 0 "The execution of the 'shutdown -r +1' command failed."
|
||||
SLEEP_WAIT 70
|
||||
ping -c 3 "${NODE2_IPV4}" >/dev/null
|
||||
CHECK_RESULT $? 0 1 "The execution of the 'ping' command failed."
|
||||
REMOTE_REBOOT_WAIT 2 120
|
||||
CHECK_RESULT $? 0 0 "The attempt to wait for the startup execution failed."
|
||||
LOG_INFO "End to run test."
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -0,0 +1,47 @@
|
||||
#!/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 : liujingjing
|
||||
# @Contact : liujingjing25812@163.com
|
||||
# @Date : 2025/06/27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Pressure restart
|
||||
# #############################################
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "./common_reboot.sh"
|
||||
|
||||
function pre_test() {
|
||||
LOG_INFO "Start to prepare the test environment."
|
||||
P_SSH_CMD --node 2 --cmd "dd if=/dev/zero of=/root/file bs=1024 count=100000000"
|
||||
LOG_INFO "End to prepare the test environment."
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "Start to run test."
|
||||
P_SSH_CMD --node 2 --cmd "df -h | grep '100%'"
|
||||
CHECK_RESULT $? 0 0 "The execution of the 'df -h' command failed."
|
||||
P_SSH_CMD --node 2 --cmd "sudo reboot &"
|
||||
CHECK_RESULT $? 0 0 "The execution of the 'reboot' command failed."
|
||||
SLEEP_WAIT 30
|
||||
REMOTE_REBOOT_WAIT 2 120
|
||||
CHECK_RESULT $? 0 0 "The attempt to wait for the startup execution failed."
|
||||
LOG_INFO "End to run test."
|
||||
}
|
||||
|
||||
function post_test() {
|
||||
LOG_INFO "Start to restore the test environment."
|
||||
P_SSH_CMD --node 2 --cmd "rm -rf /root/file"
|
||||
LOG_INFO "End to restore the test environment."
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -0,0 +1,46 @@
|
||||
#!/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 : liujingjing
|
||||
# @Contact : liujingjing25812@163.com
|
||||
# @Date : 2025/06/27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Scheduled task triggers restart
|
||||
# #############################################
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "./common_reboot.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "Start to run test."
|
||||
P_SSH_CMD --node 2 --cmd "date -s '2020-10-11 03:59:00'"
|
||||
P_SSH_CMD --node 2 --cmd "cat >> /var/spool/cron/root <<EOF
|
||||
00 04 * * * /sbin/shutdown -r now & echo \\\$(env LANG=en_US.UTF-8 date +'\\%a \\%h \\%d \\%H:\\%M') >> time.txt
|
||||
EOF"
|
||||
SLEEP_WAIT 60
|
||||
REMOTE_REBOOT_WAIT 2 120
|
||||
SLEEP_WAIT 10
|
||||
P_SSH_CMD --node 2 --cmd "last -f /var/log/wtmp >/tmp/wtmp.txt;grep -wf time.txt /tmp/wtmp.txt;echo > /var/log/wtmp;rm -rf time.txt /tmp/wtmp.txt;date -s '2020-10-10 03:59:00';"
|
||||
CHECK_RESULT $? 0 0 "The execution of the 'date -s' command failed."
|
||||
SLEEP_WAIT 90
|
||||
REMOTE_REBOOT_WAIT 2 120
|
||||
P_SSH_CMD --node 2 --cmd "last -f /var/log/wtmp >/tmp/wtmp.txt;grep -wf time.txt /tmp/wtmp.txt;"
|
||||
CHECK_RESULT $? 0 0 "The execution of the wtmp failed."
|
||||
LOG_INFO "End to run test."
|
||||
}
|
||||
|
||||
function post_test() {
|
||||
LOG_INFO "Start to restore the test environment."
|
||||
P_SSH_CMD --node 2 --cmd "rm -rf time.txt /tmp/wtmp.txt;crontab -r"
|
||||
LOG_INFO "End to restore the test environment."
|
||||
}
|
||||
main "$@"
|
||||
@@ -0,0 +1,59 @@
|
||||
#!/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 : liujingjing
|
||||
# @Contact : liujingjing25812@163.com
|
||||
# @Date : 2025/06/27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Timed restart
|
||||
# #############################################
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "./common_reboot.sh"
|
||||
|
||||
function pre_test() {
|
||||
LOG_INFO "Start to prepare the test environment."
|
||||
DNF_INSTALL ntp
|
||||
DNF_INSTALL ntp 2
|
||||
cp -f /etc/ntp.conf /etc/ntp.conf.bak
|
||||
echo -e "server ${NODE1_IPV4}\nserver 127.127.1.0\nfudge 127.127.1.0 stratum 8" >>/etc/ntp.conf
|
||||
systemctl restart ntpd
|
||||
systemctl stop firewalld
|
||||
LOG_INFO "End to prepare the test environment."
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "Start to run test."
|
||||
P_SSH_CMD --node 2 --cmd "date -s 01:59:00"
|
||||
CHECK_RESULT $? 0 0 "The execution of the 'date -s' command failed."
|
||||
P_SSH_CMD --node 2 --cmd "sudo shutdown -r 2:00"
|
||||
CHECK_RESULT $? 0 0 "The execution of the 'shutdown -r' command failed."
|
||||
SLEEP_WAIT 70
|
||||
ping -c 3 "${NODE2_IPV4}"
|
||||
CHECK_RESULT $? 0 1 "The execution of the 'ping' command failed."
|
||||
REMOTE_REBOOT_WAIT 2 120
|
||||
CHECK_RESULT $? 0 0 "The attempt to wait for the startup execution failed."
|
||||
LOG_INFO "End to run test."
|
||||
}
|
||||
|
||||
function post_test() {
|
||||
LOG_INFO "Start to restore the test environment."
|
||||
SLEEP_WAIT 10
|
||||
P_SSH_CMD --node 2 --cmd "ntpdate ${NODE1_IPV4}"
|
||||
systemctl start firewalld
|
||||
mv -f /etc/ntp.conf.bak /etc/ntp.conf
|
||||
systemctl stop ntpd
|
||||
DNF_REMOVE "$@"
|
||||
LOG_INFO "End to restore the test environment."
|
||||
}
|
||||
|
||||
main "$@"
|
||||
Reference in New Issue
Block a user