gwx5323712-new

This commit is contained in:
guojuanjuan
2022-03-31 16:26:48 +08:00
parent b9bb2eaa22
commit d3b43e9d92
12 changed files with 635 additions and 1 deletions

View File

@@ -3,6 +3,21 @@
"cases": [
{
"name": "oe_test_service_etcd"
},
{
"name": "oe_test_etcd_01"
},
{
"name": "oe_test_etcd_02"
},
{
"name": "oe_test_etcd_03"
},
{
"name": "oe_test_etcd_04"
},
{
"name": "oe_test_etcd_05"
}
]
}
}

17
suite2cases/gradle.json Normal file
View File

@@ -0,0 +1,17 @@
{
"path": "$OET_PATH/testcases/cli-test/gradle",
"cases": [
{
"name": "oe_test_gradle_01"
},
{
"name": "oe_test_gradle_02"
},
{
"name": "oe_test_gradle_03"
},
{
"name": "oe_test_gradle_04"
}
]
}

View File

@@ -0,0 +1,58 @@
#!/usr/bin/bash
# Copyright (c) 2022. 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 : guochenyang
#@Contact : 377012421@qq.com
#@Date : 2022-3-29 09:30:43
#@License : Mulan PSL v2
#@Desc : verification etcds command
#####################################
source ${OET_PATH}/libs/locallibs/common_lib.sh
function pre_test() {
LOG_INFO "Start to prepare the test environment."
DNF_INSTALL etcd
systemctl start etcd
version=$(rpm -qa etcd | awk -F "-" '{print$2}')
LOG_INFO "End to prepare the test environment."
}
function run_test() {
LOG_INFO "Start to run test."
systemctl status etcd | grep "active (running)"
CHECK_RESULT $? 0 0 "Check etcd.service start failed"
etcd --help 2>&1 | grep -i "Usage:"
CHECK_RESULT $? 0 0 "Check etcd --help failed."
test "$(etcd --version | awk '{print $3}' | head -1)" == $version
CHECK_RESULT $? 0 0 "Check etcd --version failed."
test "$(etcdctl version | awk '{print $3}' | head -1)" == $version
CHECK_RESULT $? 0 0 "Check etcdctl version failed."
etcdctl help | grep -i "USAGE:"
CHECK_RESULT $? 0 0 "Check etcdctl help failed."
etcdctl --endpoints=http://127.0.0.1:2379 put a "123" | grep -i "OK"
CHECK_RESULT $? 0 0 "Check etcdctl --endpoints put command failed."
etcdctl --endpoints=http://127.0.0.1:2379 get a | grep "123"
CHECK_RESULT $? 0 0 "Check etcdctl --endpoints get command failed."
etcdctl --endpoints=http://127.0.0.1:2379 get a -w=json | grep "version"
CHECK_RESULT $? 0 0 "Check etcdctl --endpoints get -w=json command failed."
etcdctl --endpoints=http://127.0.0.1:2379 del a | grep "1"
CHECK_RESULT $? 0 0 "Check etcdctl --endpoints del command failed."
etcdctl --endpoints=http://127.0.0.1:2379 del a | grep "0"
CHECK_RESULT $? 0 0 "Check etcdctl --endpoints del command failed."
LOG_INFO "End to run test."
}
function post_test() {
LOG_INFO "Start to restore the test environment."
systemctl stop etcd
DNF_REMOVE
LOG_INFO "End to restore the test environment."
}
main "$@"

View File

@@ -0,0 +1,60 @@
#!/usr/bin/bash
# Copyright (c) 2022. 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 : guochenyang
#@Contact : 377012421@qq.com
#@Date : 2022-3-29 14:30:43
#@License : Mulan PSL v2
#@Desc : verification etcds command
#####################################
source ${OET_PATH}/libs/locallibs/common_lib.sh
function pre_test() {
LOG_INFO "Start to prepare the test environment."
DNF_INSTALL etcd
systemctl start etcd
LOG_INFO "End to prepare the test environment."
}
function run_test() {
LOG_INFO "Start to run test."
systemctl status etcd | grep "active (running)"
CHECK_RESULT $? 0 0 "Check etcd.service start failed"
etcdctl --endpoints=http://127.0.0.1:2379 member list | grep "started"
CHECK_RESULT $? 0 0 "Check etcdctl --endpoints member command failed."
etcdctl --write-out=table --endpoints=127.0.0.1:2379 endpoint status | grep -i "ENDPOINT"
CHECK_RESULT $? 0 0 "Check etcdctl --endpoints --write-out=table failed."
etcdctl --write-out=table --endpoints=127.0.0.1:2379 endpoint health | grep "HEALTH"
CHECK_RESULT $? 0 0 "Check etcdctl --endpoints --write-out=table health failed."
etcdctl --endpoints=127.0.0.1:2379 endpoint health
CHECK_RESULT $? 0 0 "Check etcdctl --endpoints health failed"
etcdctl --endpoints=127.0.0.1:2379 endpoint status | grep "true"
CHECK_RESULT $? 0 0 "Check etcdctl --endpoints status failed."
etcdctl snapshot save snapshot.db | grep "Snapshot saved at snapshot.db"
CHECK_RESULT $? 0 0 "Check etcdctl snapshot save command failed."
etcdctl snapshot status snapshot.db
CHECK_RESULT $? 0 0 "Check etcdctl snapshot status command failed."
etcdctl snapshot status snapshot.db -w table | grep "HASH"
CHECK_RESULT $? 0 0 "Check etcdctl snapshot status -w table command failed."
etcdctl endpoint --cluster=true status -w table | grep "ENDPOINT"
CHECK_RESULT $? 0 0 "Check etcdctl endpoint --cluster=true status command failed."
etcdctl --endpoints 127.0.0.1:2379 move-leader 8e9e05c52164694d | grep "Leadership transferred"
CHECK_RESULT $? 0 0 "Check etcdctl --endpoints endpoint move-leader command failed."
LOG_INFO "End to run test."
}
function post_test() {
LOG_INFO "Start to restore the test environment."
systemctl stop etcd
rm -rf snapshot.db
DNF_REMOVE
LOG_INFO "End to restore the test environment."
}
main "$@"

View File

@@ -0,0 +1,84 @@
#!/usr/bin/bash
# Copyright (c) 2022. 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 : guochenyang
#@Contact : 377012421@qq.com
#@Date : 2022-3-29 15:30:43
#@License : Mulan PSL v2
#@Desc : verification etcds command
#####################################
source ${OET_PATH}/libs/locallibs/common_lib.sh
function pre_test() {
LOG_INFO "Start to prepare the test environment."
DNF_INSTALL etcd
systemctl start etcd
LOG_INFO "End to prepare the test environment."
}
function run_test() {
LOG_INFO "Start to run test."
systemctl status etcd | grep "active (running)"
CHECK_RESULT $? 0 0 "Check etcd.service start failed"
expect <<-END
log_file etcd_log1
spawn etcdctl user add root
expect "Password of root:"
send "123456\n"
expect "Type password of root again for confirmation:"
send "123456\n"
expect eof
END
grep "User root created" etcd_log1
CHECK_RESULT $? 0 0 "Check etcdctl user add failed."
expect <<-END
log_file etcd_log2
spawn etcdctl user add test
expect "Password of test:"
send "123\n"
expect "Type password of test again for confirmation:"
send "123\n"
expect eof
END
grep "User test created" etcd_log2
CHECK_RESULT $? 0 0 "Check etcdctl user add failed."
etcdctl role add role1 | grep "Role role1 created"
CHECK_RESULT $? 0 0 "Check etcdctl role add failed."
etcdctl user grant-role test role1 | grep "Role role1 is granted to user test"
CHECK_RESULT $? 0 0 "Check etcdctl user grant-role failed."
etcdctl role grant-permission role1 read a | grep "Role role1 updated"
CHECK_RESULT $? 0 0 "Check etcdctl role grant-permission failed."
etcdctl --endpoints=http://127.0.0.1:2379 put a "123"
CHECK_RESULT $? 0 0 "Check etcdctl put failed."
etcdctl --endpoints=http://127.0.0.1:2379 auth enable | grep -i "Authentication Enabled"
CHECK_RESULT $? 0 0 "Check etcdctl auth enable failed."
etcdctl get a --user="test:123"
CHECK_RESULT $? 0 0 "Check etcdctl get --user failed."
etcdctl user list --user="root" --password="123456" | grep "root\|test"
CHECK_RESULT $? 0 0 "Check etcdctl user list failed."
etcdctl user delete test --user="root" --password="123456"
CHECK_RESULT $? 0 0 "Check etcdctl user deletel failed."
etcdctl user list --user="root" --password="123456" | grep "test"
CHECK_RESULT $? 1 0 "Check etcdctl user deletel failed."
etcdctl role delete role1 --user="root" --password="123456" | grep "Role role1 deleted"
CHECK_RESULT $? 0 0 "Check etcdctl role deletel failed."
etcdctl --endpoints=http://127.0.0.1:2379 --user="root:123456" auth disable | grep "Authentication Disabled"
CHECK_RESULT $? 0 0 "Check etcdctl auth disable failed."
LOG_INFO "End to run test."
}
function post_test() {
LOG_INFO "Start to restore the test environment."
systemctl stop etcd
rm -rf etcd_log*
DNF_REMOVE
LOG_INFO "End to restore the test environment."
}
main "$@"

View File

@@ -0,0 +1,66 @@
#!/usr/bin/bash
# Copyright (c) 2022. 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 : guochenyang
#@Contact : 377012421@qq.com
#@Date : 2022-3-29 16:30:43
#@License : Mulan PSL v2
#@Desc : verification etcds command
#####################################
source ${OET_PATH}/libs/locallibs/common_lib.sh
function pre_test() {
LOG_INFO "Start to prepare the test environment."
DNF_INSTALL etcd
systemctl start etcd
LOG_INFO "End to prepare the test environment."
}
function run_test() {
LOG_INFO "Start to run test."
systemctl status etcd | grep "active (running)"
CHECK_RESULT $? 0 0 "Check etcd.service start failed"
expect <<-END
log_file etcd_log
spawn etcdctl user passwd root
expect "Password of root:"
send "123456\n"
expect "Type password of root again for confirmation:"
send "123456\n"
expect eof
END
grep "Password updated" etcd_log
CHECK_RESULT $? 0 0 "Check etcdctl user passwd root failed."
etcdctl lease grant 100 | grep "TTL(100s)"
CHECK_RESULT $? 0 0 "Check etcdctl lease grant failed."
Lease=$(etcdctl lease grant 100 | awk '{print $2}')
nohup etcdctl lease keep-alive $Lease >result 2>&1 &
SLEEP_WAIT 10
grep "keepalived" result
CHECK_RESULT $? 0 0 "Check etcdctl lease keep-alive failed."
etcdctl lease timetolive --keys $Lease | grep "$Lease"
CHECK_RESULT $? 0 0 "Check etcdctl lease timetolive failed."
etcdctl lease list | grep "$Lease"
CHECK_RESULT $? 0 0 "Check etcdctl list failed."
etcdctl lease revoke $Lease | grep "revoked"
CHECK_RESULT $? 0 0 "Check etcdctl revoke failed."
etcdctl lease list | grep "$Lease"
CHECK_RESULT $? 1 0 "Check etcdctl list failed."
LOG_INFO "End to run test."
}
function post_test() {
LOG_INFO "Start to restore the test environment."
systemctl stop etcd
rm -rf result etcd_log
DNF_REMOVE
LOG_INFO "End to restore the test environment."
}
main "$@"

View File

@@ -0,0 +1,51 @@
#!/usr/bin/bash
# Copyright (c) 2022. 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 : guochenyang
#@Contact : 377012421@qq.com
#@Date : 2022-3-29 17:30:43
#@License : Mulan PSL v2
#@Desc : verification etcds command
#####################################
source ${OET_PATH}/libs/locallibs/common_lib.sh
function pre_test() {
LOG_INFO "Start to prepare the test environment."
DNF_INSTALL etcd
systemctl start etcd
LOG_INFO "End to prepare the test environment."
}
function run_test() {
LOG_INFO "Start to run test."
systemctl status etcd | grep "active (running)"
CHECK_RESULT $? 0 0 "Check etcd.service start failed"
etcdctl defrag | grep "defragmenting"
CHECK_RESULT $? 0 0 "Check etcdctl defrag failed."
etcdctl --endpoints=:2379 endpoint status | grep "true"
CHECK_RESULT $? 0 0 "Check etcdctl --endpoints failed."
etcdctl alarm disarm
CHECK_RESULT $? 0 0 "Check etcdctl alarm disarm failed."
etcdctl alarm list
CHECK_RESULT $? 0 0 "Check etcdctl alarm listfailed."
etcdctl check datascale | grep "PASS:"
CHECK_RESULT $? 0 0 "Check etcdctl check datascale failed."
etcdctl check perf | grep "PASS:"
CHECK_RESULT $? 0 0 "Check etcdctl check perf failed."
LOG_INFO "End to run test."
}
function post_test() {
LOG_INFO "Start to restore the test environment."
systemctl stop etcd
DNF_REMOVE
LOG_INFO "End to restore the test environment."
}
main "$@"

View File

@@ -0,0 +1,43 @@
apply plugin: 'java-library'
repositories {
jcenter()
}
dependencies {
api 'org.apache.commons:commons-math3:3.6.1'
implementation 'com.google.guava:guava:23.0'
testImplementation 'junit:junit:4.12'
}
task base {
doLast {
println "i'm base!"
}
}
task extend(dependsOn: base) {
doLast {
println "I'm extend!"
}
}
task dolast <<{
println "show me! dolast"
println ("show me! dolast")
println ("show me! dolast");
}
task extendExpExp() {
doLast {
println "I'm extendExpExp"
}
}
base.doLast {
println "addtion end......"
}
base.doFirst {
println "addtion start......"
}

View File

@@ -0,0 +1,55 @@
#!/usr/bin/bash
# Copyright (c) 2022. 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 : guochenyang
#@Contact : 377012421@qq.com
#@Date : 2022-3-29 09:30:43
#@License : Mulan PSL v2
#@Desc : verification gradles command
#####################################
source ${OET_PATH}/libs/locallibs/common_lib.sh
function pre_test() {
LOG_INFO "Start to prepare the test environment."
DNF_INSTALL gradle
version=$(rpm -qa gradle | awk -F "-" '{print$2}')
LOG_INFO "End to prepare the test environment."
}
function run_test() {
LOG_INFO "Start to run test."
gradle --help | grep -i "USAGE:"
CHECK_RESULT $? 0 0 "Check gradle --help failed"
test "$(gradle --version | grep "Gradle" | awk '{print $2}')" == $version
CHECK_RESULT $? 0 0 "Check gradle --version failed."
gradle | grep "BUILD SUCCESSFUL"
CHECK_RESULT $? 0 0 "Check gradle failed."
gradle buildEnvironment | grep "BUILD SUCCESSFUL"
CHECK_RESULT $? 0 0 "Check gradle buildEnvironment failed."
gradle components | grep "BUILD SUCCESSFUL"
CHECK_RESULT $? 0 0 "Check gradle components failed."
gradle model | grep "model"
CHECK_RESULT $? 0 0 "Check gradle model failed."
gradle properties | grep "BUILD SUCCESSFUL"
CHECK_RESULT $? 0 0 "Check gradle properties failed."
gradle -q projects | grep "project"
CHECK_RESULT $? 0 0 "Check gradle -q projects failed."
gradle dependencies | grep "BUILD SUCCESSFUL"
CHECK_RESULT $? 0 0 "Check gradle dependencies failed."
LOG_INFO "End to run test."
}
function post_test() {
LOG_INFO "Start to restore the test environment."
rm -rf .gradle/
DNF_REMOVE
LOG_INFO "End to restore the test environment."
}
main "$@"

View File

@@ -0,0 +1,66 @@
#!/usr/bin/bash
# Copyright (c) 2022. 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 : guochenyang
#@Contact : 377012421@qq.com
#@Date : 2022-3-29 09:30:43
#@License : Mulan PSL v2
#@Desc : verification gradles command
#####################################
source ${OET_PATH}/libs/locallibs/common_lib.sh
function pre_test() {
LOG_INFO "Start to prepare the test environment."
DNF_INSTALL gradle
mkdir subdir
cat >./subdir/myproject.gradle <<EOF
task hello << {
println "using build file '$buildFile.name' in '$buildFile.parentFile.name'."
}
EOF
cat >./subdir/build.gradle <<EOF
task hello << {
println "using build file '$buildFile.name' in '$buildFile.parentFile.name'."
}
EOF
LOG_INFO "End to prepare the test environment."
}
function run_test() {
LOG_INFO "Start to run test."
gradle tasks init | grep "BUILD SUCCESSFUL"
CHECK_RESULT $? 0 0 "Check gradle tasks init failed"
gradle tasks wrapper | grep "BUILD SUCCESSFUL"
CHECK_RESULT $? 0 0 "Check gradle tasks wrapper failed."
cp -f ../common/build.gradle ./
gradle -m build | grep "BUILD SUCCESSFUL"
CHECK_RESULT $? 0 0 "Check gradle -m build failed."
gradle build --profile | grep "BUILD SUCCESSFUL"
CHECK_RESULT $? 0 0 "Check gradle build --profile failed."
gradle -q -b subdir/myproject.gradle hello | grep "using build file '.name' in '.parentFile.name'."
CHECK_RESULT $? 0 0 "Check gradle -q -b failed."
gradle -q -p subdir hello | grep "using build file '.name' in '.parentFile.name'."
CHECK_RESULT $? 0 0 "Check gradle -q -p failed."
gradle base | grep "Task"
CHECK_RESULT $? 0 0 "Check gradle base failed."
gradle -q base | grep "BUILD SUCCESSFUL"
CHECK_RESULT $? 1 0 "Check gradle -q base failed."
gradle -w base | grep "warning"
CHECK_RESULT $? 0 0 "Check gradle -w base failed."
LOG_INFO "End to run test."
}
function post_test() {
LOG_INFO "Start to restore the test environment."
rm -rf $(ls | grep -vE "\.sh") .gradle/
DNF_REMOVE
LOG_INFO "End to restore the test environment."
}
main "$@"

View File

@@ -0,0 +1,55 @@
#!/usr/bin/bash
# Copyright (c) 2022. 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 : guochenyang
#@Contact : 377012421@qq.com
#@Date : 2022-3-29 09:30:43
#@License : Mulan PSL v2
#@Desc : verification gradles command
#####################################
source ${OET_PATH}/libs/locallibs/common_lib.sh
function pre_test() {
LOG_INFO "Start to prepare the test environment."
DNF_INSTALL gradle
cp ../common/build.gradle ./
LOG_INFO "End to prepare the test environment."
}
function run_test() {
LOG_INFO "Start to run test."
gradle -i base | grep "All projects evaluated."
CHECK_RESULT $? 0 0 "Check gradle -i base failed."
gradle extend | grep "I'm extend!"
CHECK_RESULT $? 0 0 "Check gradle extend failed."
gradle base dolast | grep "dolast"
CHECK_RESULT $? 0 0 "Check gradle base dolast failed."
gradle base dolast -x dolast | grep "dolast"
CHECK_RESULT $? 1 0 "Check gradle base dolast -x dolast failed."
gradle base --rerun-tasks | grep "BUILD SUCCESSFUL"
CHECK_RESULT $? 0 0 "Check gradle base --rerun-tasks failed."
gradle base --continue | grep "BUILD SUCCESSFUL"
CHECK_RESULT $? 0 0 "Check gradle base --continue failed."
gradle base --console plain | grep "BUILD SUCCESSFUL"
CHECK_RESULT $? 0 0 "Check gradle base --console plain failed."
gradle base --console rich | grep "BUILD SUCCESSFUL"
CHECK_RESULT $? 0 0 "Check gradle base --console plain failed."
gradle base --status | grep "STATUS"
CHECK_RESULT $? 0 0 "Check gradle base --status failed."
LOG_INFO "End to run test."
}
function post_test() {
LOG_INFO "Start to restore the test environment."
rm -rf $(ls | grep -vE "\.sh") .gradle/
DNF_REMOVE
LOG_INFO "End to restore the test environment."
}
main "$@"

View File

@@ -0,0 +1,64 @@
#!/usr/bin/bash
# Copyright (c) 2022. 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 : guochenyang
#@Contact : 377012421@qq.com
#@Date : 2022-3-29 09:30:43
#@License : Mulan PSL v2
#@Desc : verification gradles command
#####################################
source ${OET_PATH}/libs/locallibs/common_lib.sh
function pre_test() {
LOG_INFO "Start to prepare the test environment."
DNF_INSTALL gradle
cp ../common/build.gradle ./
LOG_INFO "End to prepare the test environment."
}
function run_test() {
LOG_INFO "Start to run test."
expect <<-END
log_file gradle_log
spawn gradle base --scan
expect " "
send "yes\n"
expect eof
END
grep "BUILD SUCCESSFUL" gradle_log
CHECK_RESULT $? 0 0 "Check gradle base --scan failed"
gradle build | grep "BUILD SUCCESSFUL"
CHECK_RESULT $? 0 0 "Check gradle build failed."
gradle check | grep "BUILD SUCCESSFUL"
CHECK_RESULT $? 0 0 "Check gradle check failed."
gradle clean | grep "BUILD SUCCESSFUL"
CHECK_RESULT $? 0 0 "Check gradle clean failed."
gradle -q help task base
CHECK_RESULT $? 0 0 "Check gradle -q help task base failed."
gradle dependencyInsight --dependency someDep | grep "BUILD SUCCESSFUL"
CHECK_RESULT $? 0 0 "Check gradle dependencyInsight failed."
gradle javadoc | grep "BUILD SUCCESSFUL"
CHECK_RESULT $? 0 0 "Check gradle javadoc failed."
gradle assemble | grep "BUILD SUCCESSFUL"
CHECK_RESULT $? 0 0 "Check gradle assemble failed."
gradle jar | grep "BUILD SUCCESSFUL"
CHECK_RESULT $? 0 0 "Check gradle jar failed."
gradle testClasses | grep "BUILD SUCCESSFUL"
CHECK_RESULT $? 0 0 "Check gradle testClasses failed."
LOG_INFO "End to run test."
}
function post_test() {
LOG_INFO "Start to restore the test environment."
rm -rf $(ls | grep -vE "\.sh") .gradle/
DNF_REMOVE
LOG_INFO "End to restore the test environment."
}
main "$@"