Add CI tests using the standard test interface
Adds tests according to the CI wiki [0] specifically the standard test interface in the spec [1]. [0] https://fedoraproject.org/wiki/CI [1] https://fedoraproject.org/wiki/Changes/InvokingTests
This commit is contained in:
parent
5dfacd58d8
commit
41ca4b77ae
64
tests/initscript/Makefile
Normal file
64
tests/initscript/Makefile
Normal file
@ -0,0 +1,64 @@
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Makefile of /CoreOS/at/Sanity/initscript
|
||||
# Description: Initscript sanity
|
||||
# Author: Radek Biba <rbiba@redhat.com>
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2009 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/at/Sanity/initscript
|
||||
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: Radek Biba <rbiba@redhat.com>" > $(METADATA)
|
||||
@echo "Name: $(TEST)" >> $(METADATA)
|
||||
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
|
||||
@echo "Path: $(TEST_DIR)" >> $(METADATA)
|
||||
@echo "Description: Initscript sanity" >> $(METADATA)
|
||||
@echo "Type: Sanity" >> $(METADATA)
|
||||
@echo "TestTime: 5m" >> $(METADATA)
|
||||
@echo "Releases: -RHEL3 -RHEL4 -RHELServer5 -RHELClient5 -RedHatEnterpriseLinux3 -RedHatEnterpriseLinux4 -RedHatEnterpriseLinuxClient5 -RedHatEnterpriseLinuxServer5" >> $(METADATA)
|
||||
@echo "RunFor: at" >> $(METADATA)
|
||||
@echo "Requires: at" >> $(METADATA)
|
||||
@echo "Priority: Normal" >> $(METADATA)
|
||||
@echo "License: GPLv2" >> $(METADATA)
|
||||
@echo "Confidential: no" >> $(METADATA)
|
||||
@echo "Destructive: no" >> $(METADATA)
|
||||
|
||||
rhts-lint $(METADATA)
|
3
tests/initscript/PURPOSE
Normal file
3
tests/initscript/PURPOSE
Normal file
@ -0,0 +1,3 @@
|
||||
PURPOSE of /CoreOS/at/Sanity/initscript
|
||||
Description: Initscript sanity
|
||||
Author: Radek Biba <rbiba@redhat.com>
|
88
tests/initscript/runtest.sh
Executable file
88
tests/initscript/runtest.sh
Executable file
@ -0,0 +1,88 @@
|
||||
#!/bin/bash
|
||||
# vim: dict=/usr/share/rhts-library/dictionary.vim cpt=.,w,b,u,t,i,k
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# runtest.sh of /CoreOS/at/Sanity/initscript
|
||||
# Description: Initscript sanity
|
||||
# Author: Radek Biba <rbiba@redhat.com>
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2009 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/rhts-library/rhtslib.sh
|
||||
|
||||
PACKAGE="at"
|
||||
SERVICE="atd"
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup "Prepare"
|
||||
rlServiceStop $SERVICE
|
||||
rlPhaseEnd
|
||||
if rlIsRHEL "<7"; then
|
||||
rlPhaseStartTest "Mandatory actions"
|
||||
for ACTION in "start" "stop" "restart" "force-reload" "status" ; do
|
||||
rlRun "grep -i \"usage.*$ACTION\" /etc/init.d/$SERVICE"
|
||||
done
|
||||
rlPhaseEnd
|
||||
fi
|
||||
rlPhaseStartTest "Start"
|
||||
rlRun "service $SERVICE start" 0
|
||||
rlRun "service $SERVICE status" 0
|
||||
rlRun "service $SERVICE start" 0
|
||||
rlRun "service $SERVICE status" 0
|
||||
rlRun "service $SERVICE restart" 0
|
||||
rlRun "service $SERVICE status" 0
|
||||
rlRun "service $SERVICE force-reload" 0
|
||||
rlRun "service $SERVICE status" 0
|
||||
rlRun "service $SERVICE try-restart" 0
|
||||
rlRun "service $SERVICE status" 0
|
||||
rlPhaseEnd
|
||||
rlPhaseStartTest "Stop"
|
||||
rlRun "service $SERVICE stop" 0
|
||||
rlRun "service $SERVICE status" 3
|
||||
rlRun "service $SERVICE stop" 0
|
||||
rlRun "service $SERVICE status" 3
|
||||
rlRun "service $SERVICE try-restart" 0
|
||||
rlRun "service $SERVICE status" 3
|
||||
rlPhaseEnd
|
||||
rlPhaseStartTest "Dead service"
|
||||
rlRun "touch /var/lock/subsys/$SERVICE"
|
||||
rlRun "service $SERVICE status" $(
|
||||
if rlIsRHEL "<7"; then
|
||||
echo 2;
|
||||
else
|
||||
echo 3;
|
||||
fi
|
||||
)
|
||||
rlRun "service $SERVICE start" 0
|
||||
rlRun "service $SERVICE status" 0
|
||||
rlPhaseEnd
|
||||
rlPhaseStartTest "Invalid arguments"
|
||||
rlRun "service $SERVICE" 2
|
||||
rlRun "service $SERVICE fubar" 2
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartCleanup "Restore"
|
||||
rlServiceRestore $SERVICE
|
||||
rlPhaseEnd
|
||||
rlJournalPrintText
|
||||
rlJournalEnd
|
11
tests/tests.yml
Normal file
11
tests/tests.yml
Normal file
@ -0,0 +1,11 @@
|
||||
---
|
||||
# This first play always runs on the local staging system
|
||||
- hosts: localhost
|
||||
roles:
|
||||
- role: standard-test-beakerlib
|
||||
tags:
|
||||
- classic
|
||||
tests:
|
||||
- initscript
|
||||
required_packages:
|
||||
- at # Required to run initscript
|
Loading…
Reference in New Issue
Block a user