[tests] Add CI tests using the standard test interface

- runs upstream test cases
This commit is contained in:
Matúš Honěk 2018-01-03 13:37:25 +01:00
commit 60ece3dfc8
4 changed files with 248 additions and 0 deletions

85
tests/smoke-test/Makefile Normal file
View File

@ -0,0 +1,85 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/openldap/Sanity/smoke-test
# Description: Test calls upstream test suite.
# Author: Ondrej Moris <omoris@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2010 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/CoreOS/openldap/Sanity/smoke-test
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Ondrej Moris <omoris@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Test calls upstream test suite." >> $(METADATA)
@echo "Type: Sanity" >> $(METADATA)
@echo "TestTime: 3h" >> $(METADATA)
@echo "RunFor: openldap" >> $(METADATA)
@echo "Requires: openldap" >> $(METADATA)
@echo "Requires: openldap-clients" >> $(METADATA)
@echo "Requires: openldap-servers" >> $(METADATA)
@echo "Requires: cyrus-sasl-devel" >> $(METADATA)
@echo "Requires: gdbm-devel" >> $(METADATA)
@echo "Requires: libtool" >> $(METADATA)
@echo "Requires: krb5-devel" >> $(METADATA)
@echo "Requires: openssl-devel" >> $(METADATA)
@echo "Requires: pam-devel" >> $(METADATA)
@echo "Requires: perl" >> $(METADATA)
@echo "Requires: pkgconfig" >> $(METADATA)
@echo "Requires: tcp_wrappers-devel" >> $(METADATA)
@echo "Requires: bind-libbind-devel" >> $(METADATA)
@echo "Requires: unixODBC-devel" >> $(METADATA)
@echo "Requires: libtool-ltdl-devel" >> $(METADATA)
@echo "Requires: nfs-utils" >> $(METADATA)
@echo "Requires: rpm-build" >> $(METADATA)
@echo "Requires: nss-devel" >> $(METADATA)
@echo "Requires: libdb-devel" >> $(METADATA)
@echo "Requires: groff" >> $(METADATA)
@echo "Requires: cracklib-devel" >> $(METADATA)
@echo "Requires: perl-ExtUtils-Embed" >> $(METADATA)
@echo "Requires: yum-utils" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
rhts-lint $(METADATA)

3
tests/smoke-test/PURPOSE Normal file
View File

@ -0,0 +1,3 @@
PURPOSE of /CoreOS/openldap/Sanity/smoke-test
Description: Test calls upstream test suite.
Author: Ondrej Moris <omoris@redhat.com>

126
tests/smoke-test/runtest.sh Executable file
View File

@ -0,0 +1,126 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/openldap/Sanity/smoke-test
# Description: Test calls upstream test suite.
# Author: Ondrej Moris <omoris@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2010 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include rhts environment
. /usr/bin/rhts-environment.sh
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="openldap"
PACKAGES=("openldap" \
"openldap-clients" \
"openldap-servers" \
"cyrus-sasl-devel" \
"gdbm-devel" \
"libtool" \
"krb5-devel" \
"openssl-devel" \
"pam-devel" \
"perl" \
"unixODBC-devel" \
"libtool-ltdl-devel" \
"nfs-utils" \
"rpm-build" )
if rlIsRHEL 5; then
PACKAGES=( ${PACKAGES[@]} "bind-libbind-devel" )
elif rlIsRHEL 6; then
PACKAGES=( ${PACKAGES[@]} "tcp_wrappers-devel" )
else
PACKAGES=( ${PACKAGES[@]} "tcp_wrappers-devel" "nss-devel" "libdb-devel" "groff" "cracklib-devel" "perl-ExtUtils-Embed" )
fi
if rlIsFedora; then
PACKAGES=( ${PACKAGES[@]} "pkgconf-pkg-config" )
else
PACKAGES=( ${PACKAGES[@]} "pkgconfig" )
fi
if rlIsRHEL 5; then
LDAP_SERVICE='ldap'
else
LDAP_SERVICE='slapd'
fi
rlJournalStart
rlPhaseStartSetup "General Setup"
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
for P in "${PACKAGES[@]}"; do rlCheckRpm $P || rlDie; done
rlFetchSrcForInstalled $PACKAGE
rlRun "yum-builddep -y openldap*src.rpm" 0
rlRun "rpm -ihv *.rpm" 0
rlServiceStop $LDAP_SERVICE
rlPhaseEnd
rlPhaseStartTest
TOPDIR=`rpm --eval %_topdir`
rlRun "pushd $TOPDIR" 0
rlRun "rpmbuild -vv -bc SPECS/openldap.spec >build.log 2>&1" 0
[[ $? -ne 0 ]] && cat build.log
VERSION=`rpm -q --qf "%{VERSION}\n" openldap | tail -1`
rlRun "pushd BUILD/openldap-${VERSION}/openldap-${VERSION}" 0
# workaround for failing test, it tests unsupported configuration
# see http://www.openldap.org/lists/openldap-technical/201204/msg00080.html for upstream reply
# change of check after test is not enough because run of all tests with hdb is skipped if test058 fails with bdb
rm -f tests/scripts/test058-syncrepl-asymmetric
rlIsRHEL 5 6 && rlRun "pushd build-servers" 0
rlRun "make check > make_check.out 2>&1" 0
grep ">>>>" make_check.out > make_check.results
cat make_check.out
echo -e "\n\nResults:\n\n"
cat make_check.results
rlAssertNotGrep "failed" make_check.results
rlIsRHEL 5 6 && rlRun "popd" 0
rlRun "popd" 0
rlRun "popd" 0
rlPhaseEnd
rlPhaseStartCleanup
rlServiceRestore $LDAP_SERVICE
rlRun "rm -rf BUILD/opendap-`rpm -q --qf "%{VERSION}" openldap`" 0
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

34
tests/tests.yml Normal file
View File

@ -0,0 +1,34 @@
---
# Tests that run in all contexts
- hosts: localhost
roles:
- role: standard-test-beakerlib
tags:
- classic
tests:
- smoke-test
required_packages:
- openldap # Required for smoke-test
- openldap-clients # Required for smoke-test
- openldap-servers # Required for smoke-test
- cyrus-sasl-devel # Required for smoke-test
- gdbm-devel # Required for smoke-test
- libtool # Required for smoke-test
- krb5-devel # Required for smoke-test
- openssl-devel # Required for smoke-test
- pam-devel # Required for smoke-test
- perl # Required for smoke-test
- pkgconfig # Required for smoke-test
- tcp_wrappers-devel # Required for smoke-test
- bind-libbind-devel # Required for smoke-test
- unixODBC-devel # Required for smoke-test
- nfs-utils # Required for smoke-test
- rpm-build # Required for smoke-test
- nss-devel # Required for smoke-test
- libdb-devel # Required for smoke-test
- groff # Required for smoke-test
- cracklib-devel # Required for smoke-test
- perl-ExtUtils-Embed # Required for smoke-test
- yum-utils # Required for smoke-test
- libtool-ltdl-devel # Required for smoke-test
- wget # Required for smoke-test