Add test for bind-chroot

Test each build with simple request. Ensure it can start as normal
service with default configuration and also in chroot.
This commit is contained in:
Petr Menšík 2018-10-03 14:24:53 +02:00
parent 5efb1da1ac
commit cda9d12b65
4 changed files with 138 additions and 0 deletions

View File

@ -0,0 +1,63 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/tests/Sanity/Master-server-chrooted
# Description: Run basic empty named service and try to resolve localhost on it
# Author: Petr Mensik <pemensik@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2018 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# 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, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/CoreOS/tests/Sanity/Master-server-chrooted
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)
test -x runtest.sh || chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Petr Mensik <pemensik@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Run basic empty named-chroot service and try to resolve localhost on it" >> $(METADATA)
@echo "Type: Sanity" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: bind" >> $(METADATA)
@echo "Requires: bind bind-utils bind-chroot bind-sdb-chroot" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2+" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Releases: -RHEL4 -RHELClient5 -RHELServer5 -RHEL6" >> $(METADATA)
rhts-lint $(METADATA)

View File

@ -0,0 +1,3 @@
PURPOSE of /CoreOS/tests/Sanity/Master-server-chrooted
Description: Run basic empty named-chroot service and try to resolve localhost on it
Author: Petr Mensik <pemensik@redhat.com>

View File

@ -0,0 +1,70 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/tests/Sanity/Master-server-chrooted
# Description: Run basic empty named-chroot service and try to resolve localhost on it
# Author: Petr Mensik <pemensik@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2018 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# 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, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/bin/rhts-environment.sh || exit 1
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="bind"
test_service()
{
local SERVICE="$1"
rlRun "rlServiceStart $SERVICE"
rlRun "dig @localhost localhost | grep '^localhost'"
rlRun "dig @localhost -x 127.0.0.1 | grep 'PTR[[:space:]]\+localhost.$'" 0 "Reverse address works"
rlRun "rlServiceRestore $SERVICE"
}
rlJournalStart
rlPhaseStartSetup
rlAssertRpm bind
rlAssertRpm bind-utils
rlAssertRpm bind-chroot
rlPhaseEnd
rlPhaseStartTest "Testing named"
test_service named
rlPhaseEnd
rlPhaseStartTest "Testing named-chroot"
test_service named-chroot
rlPhaseEnd
rlPhaseStartTest "Testing named-sdb-chroot"
if rpm -q bind-sdb-chroot; then
test_service named-sdb-chroot
else
rlLog "bind-sdb-chroot not installed, skipping it"
fi
rlPhaseEnd
rlPhaseStartCleanup
# noop
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View File

@ -6,9 +6,11 @@
tags:
- classic
tests:
- Master-server-chrooted
- Master-server-not-chrooted
required_packages:
- bind
- bind-chroot
- bind-sdb-chroot
- redhat-lsb
- bind-utils