Add gating tests

Related: #1968596
This commit is contained in:
Ryan O'Hara 2021-08-16 14:39:49 -05:00
parent f5673662e9
commit eac1256b57
5 changed files with 129 additions and 1 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}

View File

@ -10,7 +10,7 @@
Name: keepalived
Summary: High Availability monitor built upon LVS, VRRP and service pollers
Version: 2.2.3
Release: 1%{?dist}
Release: 2%{?dist}
License: GPLv2+
URL: http://www.keepalived.org/
@ -105,6 +105,9 @@ mkdir -p %{buildroot}%{_libexecdir}/keepalived
%{_mandir}/man8/keepalived.8*
%changelog
* Mon Aug 16 2021 Ryan O'Hara <rohara@redhat.com> - 2.2.3-2
- Add gating tests (#1968596)
* Mon Aug 16 2021 Ryan O'Hara <rohara@redhat.com> - 2.2.3-1
- Update to 2.2.3 (#1968596)

17
tests/keepalived.conf.in Normal file
View File

@ -0,0 +1,17 @@
global_defs {
router_id TEST
}
vrrp_instance VRRP {
state MASTER
priority 100
advert_int 1
interface eth0
virtual_router_id 100
virtual_ipaddress {
$VIP_INCLUDE
}
virtual_ipaddress_excluded {
$VIP_EXCLUDE
}
}

91
tests/run_tests.sh Executable file
View File

@ -0,0 +1,91 @@
#!/bin/sh
export VIP_INCLUDE="192.168.1.101"
export VIP_EXCLUDE="192.168.1.102"
echo -ne "[debug]: setting up config file ... "
envsubst '${VIP_INCLUDE},${VIP_EXCLUDE}' < ./keepalived.conf.in > /etc/keepalived/keepalived.conf
if [ $? -ne 0 ] ; then
echo "FAIL"
exit 1
else
echo "OK"
fi
echo -ne "[debug]: starting service ... "
systemctl start keepalived
if [ $? -ne 0 ] ; then
echo "FAIL"
exit 1
else
echo "OK"
fi
echo -ne "[debug]: checking service active ... "
systemctl -q is-active keepalived
if [ $? -ne 0 ] ; then
echo "FAIL"
exit 1
else
echo "OK"
fi
sleep 5
echo -ne "[debug]: checking included VIP ... "
ip addr show eth0 | grep -q ${VIP_INCLUDE}
if [ $? -ne 0 ] ; then
echo "FAIL"
exit 1
else
echo "OK"
fi
echo -ne "[debug]: checking excluded VIP ... "
ip addr show eth0 | grep -q ${VIP_EXCLUDE}
if [ $? -ne 0 ] ; then
echo "FAIL"
exit 1
else
echo "OK"
fi
echo -ne "[debug]: stopping service ... "
systemctl stop keepalived
if [ $? -ne 0 ] ; then
echo "FAIL"
exit 1
else
echo "OK"
fi
echo -ne "[debug]: checking service inactive ... "
systemctl -q is-active keepalived
if [ $? -ne 3 ] ; then
echo "FAIL"
exit 1
else
echo "OK"
fi
sleep 5
echo -ne "[debug]: checking include VIP ... "
ip addr show eth0 | grep -q ${VIP_INCLUDE}
if [ $? -ne 1 ] ; then
echo "FAIL"
exit 1
else
echo "OK"
fi
echo -ne "[debug]: checking exclude VIP ... "
ip addr show eth0 | grep -q ${VIP_EXCLUDE}
if [ $? -ne 1 ] ; then
echo "FAIL"
exit 1
else
echo "OK"
fi
exit 0

11
tests/tests.yml Normal file
View File

@ -0,0 +1,11 @@
- hosts: localhost
roles:
- role: standard-test-basic
tags:
- classic
tests:
- simple:
dir: .
run: ./run_tests.sh
required_packages:
- gettext