- Add CI gating tests

Resolves: RHEL-25954
This commit is contained in:
Oyvind Albrigtsen 2024-04-12 10:23:43 +02:00
parent 2c78567a32
commit b98937464e
3 changed files with 70 additions and 0 deletions

6
gating.yaml Normal file
View File

@ -0,0 +1,6 @@
--- !Policy
product_versions:
- rhel-9
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}

45
tests/run_tests.sh Executable file
View File

@ -0,0 +1,45 @@
#!/bin/sh
PYTHON_VERSION=$(python3 --version | awk '{print $NF}')
err=0
if [ "$(pcs stonith list 2> /dev/null | wc -l)" -eq 0 ]; then
echo "ERROR: pcs: no agents available..."
err=$((err+1))
fi
echo "INFO: pcs: agents available..."
# test bundled libraries
declare -A libs=(
# aliyun
["aliyunsdkcore"]="sys.path.insert(0, '/usr/lib/fence-agents/support/aliyun/lib/python$PYTHON_VERSION/site-packages');"
["aliyunsdkecs"]="sys.path.insert(0, '/usr/lib/fence-agents/support/aliyun/lib/python$PYTHON_VERSION/site-packages');"
# aws
["boto3"]="sys.path.insert(0, '/usr/lib/fence-agents/support/aws/lib/python$PYTHON_VERSION/site-packages');"
# azure
["azure"]="sys.path.insert(0, '/usr/lib/fence-agents/support/azure/lib/python$PYTHON_VERSION/site-packages');"
["msrestazure"]="sys.path.insert(0, '/usr/lib/fence-agents/support/azure/lib/python$PYTHON_VERSION/site-packages');"
# common
["pexpect"]="sys.path.insert(0, '/usr/lib/fence-agents/support/common/lib/python$PYTHON_VERSION/site-packages');"
["suds"]="sys.path.insert(0, '/usr/lib/fence-agents/support/common/lib/python$PYTHON_VERSION/site-packages');"
# google
["googleapiclient"]="sys.path.insert(0, '/usr/lib/fence-agents/support/google/lib/python$PYTHON_VERSION/site-packages');"
["pyroute2"]="sys.path.insert(0, '/usr/lib/fence-agents/support/google/lib/python$PYTHON_VERSION/site-packages');"
)
for lib in "${!libs[@]}"; do
output=$(python3 -c "import sys; sys.path.append('/usr/share/fence'); \
${libs[$lib]} \
import $lib" 2>&1)
if [ $? -ne 0 ]; then
echo -e "ERROR: Failed to import $lib:\n$output"
err=$((err+1))
else
echo "INFO: importing $lib works..."
fi
done
if [ $err -ge 1 ]; then
echo -e "\nERROR: $err tests FAILED..."
exit 1
fi

19
tests/tests.yml Normal file
View File

@ -0,0 +1,19 @@
- hosts: localhost
roles:
- role: standard-test-basic
tags:
- classic
- container
required_packages:
- fence-agents-all
- fence-agents-aliyun
- fence-agents-aws
- fence-agents-azure-arm
- fence-agents-gce
- fence-agents-virsh
- pcs
tests:
- subpackage_tests:
dir: .
run: ./run_tests.sh