Adding test

This commit is contained in:
Petr Sklenar 2022-01-04 20:01:53 +01:00
commit 3bf810abc7
23 changed files with 860 additions and 0 deletions

View file

@ -0,0 +1,64 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/bind/Sanity/delv-smoke-test
# Description: Test for BZ#1578128 ([RFE] Provide delv functionality)
# Author: Petr Sklenar <psklenar@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2019 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/bind/Sanity/delv-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)
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 Sklenar <psklenar@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Test for BZ#1578128 ([RFE] Provide delv functionality)" >> $(METADATA)
@echo "Type: Sanity" >> $(METADATA)
@echo "TestTime: 15m" >> $(METADATA)
@echo "RunFor: bind" >> $(METADATA)
@echo "Requires: bind bind-utils" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2+" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Bug: 1578128" >> $(METADATA)
@echo "Releases: -RHEL4 -RHELClient5 -RHELServer5" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -0,0 +1,5 @@
PURPOSE of /CoreOS/bind/Sanity/delv-smoke-test
Description: Test for BZ#1578128 ([RFE] Provide delv functionality)
Author: Petr Sklenar <psklenar@redhat.com>
Bug summary: [RFE] Provide delv functionality
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1578128

View file

@ -0,0 +1,28 @@
summary: Test for BZ#1578128 ([RFE] Provide delv functionality)
description: |
Bug summary: [RFE] Provide delv functionality
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1578128
contact: Petr Sklenar <psklenar@redhat.com>
component:
- bind
test: ./runtest.sh
framework: beakerlib
recommend:
- bind
- bind-utils
duration: 15m
enabled: true
tag:
- NoRHEL4
- NoRHEL5
- TIPfail_infra
- TIPpass
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1578128
adjust:
- enabled: false
when: distro == rhel-4, rhel-5
continue: false
extra-nitrate: TC#0600760
extra-summary: /CoreOS/bind/Sanity/delv-smoke-test
extra-task: /CoreOS/bind/Sanity/delv-smoke-test

View file

@ -0,0 +1,54 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/bind/Sanity/delv-smoke-test
# Description: Test for BZ#1578128 ([RFE] Provide delv functionality)
# Author: Petr Sklenar <psklenar@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2019 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/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="bind"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlAssertRpm bind-utils
cat /etc/resolv.conf
rlPhaseEnd
rlPhaseStartTest
if delv redhat.com | grep IN;then
rlRun "delv redhat.com | grep IN"
rlRun "delv redhat.com soa +multi | grep serial"
LINES=$(delv +multi +vtrace|wc -l)
rlAssertGreater "delv +vtrace should show few lines" "$LINES" "10"
rlRun "delv +vtrace | grep 'fully validated'"
fi
rlLog "`delv redhat.com`"
cat /etc/resolv.conf
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,63 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/bind/Sanity/geoip-support
# Description: it tries more ip address from more locations
# Author: Petr Sklenar <psklenar@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2019 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/bind/Sanity/geoip-support
export TESTVERSION=1.1
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE a b c named.conf
.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 Sklenar <psklenar@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: it tries more ip address from more locations" >> $(METADATA)
@echo "Type: Sanity" >> $(METADATA)
@echo "TestTime: 66m" >> $(METADATA)
@echo "RunFor: bind" >> $(METADATA)
@echo "Requires: bind libmaxminddb libmaxminddb-devel geolite2-country geolite2-city bind-utils" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2+" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Releases: -RHEL4 -RHELClient5 -RHELServer5" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -0,0 +1,3 @@
PURPOSE of /CoreOS/bind/Sanity/geoip-support
Description: it tries more ip address from more locations
Author: Petr Sklenar <psklenar@redhat.com>

18
Sanity/geoip-support/a Normal file
View file

@ -0,0 +1,18 @@
$ORIGIN petr.god.
$TTL 86400
@ IN SOA dns.petr.god. hostmaster.petr.god. (
100 ; serial
21600 ;
3600 ;
604800 ;
86400 ) ;
IN NS dns.petr.god.
dns IN A 127.0.0.1
mail IN CNAME dns
petr.god. IN TXT "zone-a"
test1 IN A 1.1.1.1
test2 IN A 1.1.1.2
test3 IN A 1.1.1.3
geo IN TXT "geo A"

18
Sanity/geoip-support/b Normal file
View file

@ -0,0 +1,18 @@
$ORIGIN petr.god.
$TTL 86400
@ IN SOA dns.petr.god. hostmaster.petr.god. (
100 ; serial
21600 ;
3600 ;
604800 ;
86400 ) ;
IN NS dns.petr.god.
dns IN A 127.0.0.1
mail IN CNAME dns
petr.god. IN TXT "zone-b"
test1 IN A 2.2.2.1
test2 IN A 2.2.2.2
test3 IN A 2.2.2.3
geo IN TXT "geo B"

18
Sanity/geoip-support/c Normal file
View file

@ -0,0 +1,18 @@
$ORIGIN petr.god.
$TTL 86400
@ IN SOA dns.petr.god. hostmaster.petr.god. (
100 ; serial
21600 ;
3600 ;
604800 ;
86400 ) ;
IN NS dns.petr.god.
dns IN A 127.0.0.1
mail IN CNAME dns
petr.god. IN TXT "zone-c"
test1 IN A 3.3.3.1
test2 IN A 3.3.3.2
test3 IN A 3.3.3.3
geo IN TXT "geo C"

View file

@ -0,0 +1,31 @@
summary: it tries more ip address from more locations
tier: '1'
description: ''
contact: Petr Sklenar <psklenar@redhat.com>
component:
- bind
test: ./runtest.sh
framework: beakerlib
recommend:
- bind
- libmaxminddb
- libmaxminddb-devel
- geolite2-country
- geolite2-city
- bind-utils
duration: 66m
enabled: true
tag:
- NoRHEL4
- NoRHEL5
- TIPfail_infra
- TIPpass
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1564443
adjust:
- enabled: false
when: distro < rhel-8
continue: false
extra-nitrate: TC#0604089
extra-summary: /CoreOS/bind/Sanity/geoip-support
extra-task: /CoreOS/bind/Sanity/geoip-support

View file

@ -0,0 +1,95 @@
//
// named.conf
//
// Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
// server as a caching only nameserver (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
// See the BIND Administrator's Reference Manual (ARM) for details about the
// configuration located in /usr/share/doc/bind-{version}/Bv9ARM.html
options {
listen-on port 53 { 127.0.0.1; };
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
recursing-file "/var/named/data/named.recursing";
secroots-file "/var/named/data/named.secroots";
allow-query { any; };
/*
- If you are building an AUTHORITATIVE DNS server, do NOT enable recursion.
- If you are building a RECURSIVE (caching) DNS server, you need to enable
recursion.
- If your recursive DNS server has a public IP address, you MUST enable access
control to limit queries to your legitimate users. Failing to do so will
cause your server to become part of large scale DNS amplification
attacks. Implementing BCP38 within your network would greatly
reduce such attack surface
*/
recursion yes;
dnssec-enable yes;
dnssec-validation yes;
/* Path to ISC DLV key */
bindkeys-file "/etc/named.root.key";
managed-keys-directory "/var/named/dynamic";
pid-file "/run/named/named.pid";
session-keyfile "/run/named/session.key";
geoip-directory "/usr/share/GeoIP";
};
acl "geoname" {
geoip country US;
// geoip region CA;
// geoip city "Redwood City"; /* names, etc., must be quoted if they contain spaces */
};
acl "tibet" {
geoip country CN;
};
view "geoname" {
match-clients { geoname;};
zone "petr.god." {
file "a";
type master;
};
};
view "tibet" {
match-clients { tibet;};
zone "petr.god." {
file "c";
type master;
};
};
view "default" {
zone "petr.god." {
file "b";
type master;
};
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
// include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";

View file

@ -0,0 +1,42 @@
bind-9.11.10-1.fc30.x86_64
geolite2-country-20190806-1.fc30.noarch
libmaxminddb-devel
### tool mmdblookup ^
libmaxminddb
4 yum install libmax\*
75 yum install geolite2-city a geolite2-country
76 yum install geolite2-city geolite2-country
my NS with 4.3.2.1
XY ip netns add blue
12 ip link add cosi0 type veth peer name cosi1
15 ip link set cosi0 netns blue
16 ip a
17 ip addr add 192.168.88.1 dev cosi1@if6
18 ip addr add 192.168.88.1 dev cosi1
#############
mmdblookup --file /usr/share/GeoIP/GeoLite2-City.mmdb --ip 4.3.2.1
....
"country":
{
"geoname_id":
6252001 <uint32>
"iso_code":
"US" <utf8_string>
"names":
.....blabla
[root@host-10-0-136-254 smoke-high-load]# dig -b 10.0.136.254 @127.0.0.1 test1.petr.god +short
192.168.122.222
[root@host-10-0-136-254 smoke-high-load]# dig -b 4.3.2.1 @127.0.0.1 test1.petr.god +short
192.168.122.2

83
Sanity/geoip-support/runtest.sh Executable file
View file

@ -0,0 +1,83 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/bind/Sanity/geoip-support
# Description: it tries more ip address from more locations
# Author: Petr Sklenar <psklenar@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2019 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/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="bind"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlFileBackup /etc/named.conf /var/named/a /var/named/b
rlPhaseEnd
rlPhaseStartSetup 'files'
rlRun "cp named.conf /etc/named.conf"
rlRun "cp a /var/named/a"
rlRun "cp b /var/named/b"
rlRun "cp c /var/named/c"
chown root.named /var/named/a
chown root.named /var/named/b
chown root.named /var/named/c
rlRun "rlServiceStart named"
rlPhaseEnd
rlPhaseStartSetup 'net'
ip netns add blue
ip link add cosi0 type veth peer name cosi1
ip link set cosi0 netns blue
ip addr add 4.3.2.1 dev cosi1
ip addr add 222.19.68.0 dev cosi1
rlRun 'ip a|grep 222.19.68.0'
rlRun 'ip a|grep 4.3.2.1'
rlPhaseEnd
rlPhaseStartTest 'dig'
rlRun "dig -b 4.3.2.1 @127.0.0.1 test1.petr.god +short | grep '1.1.1.1'"
rlRun "dig -b 127.0.0.1 @127.0.0.1 test1.petr.god +short | grep '2.2.2.1'"
rlRun "dig -b 222.19.68.0 @127.0.0.1 test1.petr.god +short | grep '3.3.3.1'"
rlRun "dig -b 4.3.2.1 +short @127.0.0.1 geo.petr.god TXT | grep 'geo A'"
rlRun "dig -b 222.19.68.0 +short @127.0.0.1 geo.petr.god TXT | grep 'geo C'"
rlRun "dig -b 127.0.0.1 +short @127.0.0.1 geo.petr.god TXT | grep 'geo B'"
rlPhaseEnd
#for i in `seq 1 100000`;do dig -b 4.3.2.1 @127.0.0.1 test1.petr.god +short & dig -b 127.0.0.1 @127.0.0.1 test1.petr.god +short & dig -b 222.19.68.0 @127.0.0.1 test1.petr.god +short & done
rlPhaseStartCleanup
ip netns del blue
rlFileRestore
rlServiceRestore named
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,64 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/bind/Sanity/json-support
# Description: Test for BZ#1899257 ([RFE] Request for libjson support to be added to)
# Author: Petr Mensik <pemensik@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2021 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/bind/Sanity/json-support
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE readstats.py
.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 $(realpath /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: Test for BZ#1899257 ([RFE] Request for libjson support to be added to)" >> $(METADATA)
@echo "Type: Sanity" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: bind" >> $(METADATA)
@echo "Requires: bind bind-utils python3" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2+" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Bug: 1899257" >> $(METADATA)
@echo "Releases: -RHEL4 -RHEL6 -RHEL7 -RHELClient5 -RHELServer5" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -0,0 +1,5 @@
PURPOSE of /CoreOS/bind/Sanity/json-support
Description: Test for BZ#1899257 ([RFE] Request for libjson support to be added to)
Author: Petr Mensik <pemensik@redhat.com>
Bug summary: [RFE] Request for libjson support to be added to bind compile options for statistics-channel
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1899257

View file

@ -0,0 +1,17 @@
summary: Test for BZ#1899257 ([RFE] Request for libjson support to be added to)
description: |
Bug summary: [RFE] Request for libjson support to be added to bind compile options for statistics-channel
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1899257
contact:
- Petr Mensik <pemensik@redhat.com>
component:
- bind
test: ./runtest.sh
framework: beakerlib
recommend:
- bind
- bind-utils
- python3
duration: 5m
extra-summary: /CoreOS/bind/Sanity/json-support
extra-task: /CoreOS/bind/Sanity/json-support

View file

@ -0,0 +1,21 @@
#!/usr/bin/python3
#
# Script verifying BIND3 statistics interface work with json
import urllib.request
import json
import sys
url = 'http://localhost:80/json' # use first parameter to override
timeout = 10 # connection timeout in seconds
if len(sys.argv)>1:
url = sys.argv[1]
print("# Reading statistics from URL: {0}".format(url))
with urllib.request.urlopen(url, timeout=timeout) as req:
js = json.load(req)
#print(json.dumps(js, indent=4))
print('BIND version: ', js['version'])
print('Socket stats, IPV4 UDP requests: ', js['sockstats']['UDP4Open'])
print('Name server stats, UDP queries: ', js['nsstats']['QryUDP'])

65
Sanity/json-support/runtest.sh Executable file
View file

@ -0,0 +1,65 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/bind/Sanity/json-support
# Description: Test for BZ#1899257 ([RFE] Request for libjson support to be added to)
# Author: Petr Mensik <pemensik@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2021 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/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="bind"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
TESTDIR="`pwd`"
rlRun "pushd $TmpDir"
rlFileBackup /etc/named.conf
STATSURL='http://localhost:853/json'
cat >> /etc/named.conf <<NAMEDCONF
# Enable statistics channel
statistics-channels {
inet 127.0.0.1 port 853 allow { localhost; };
};
NAMEDCONF
rlRun "named-checkconf" 0 "Check configuration is valid"
rlRun "rlServiceStart named"
rlPhaseEnd
rlPhaseStartTest
rlRun "rndc reconfig"
rlRun "dig @localhost" 0-255 "Run query, may fail"
rlRun "python3 \"$TESTDIR/readstats.py\" $STATSURL" 0 "Check JSON statistics"
[ "$DEBUG" = y ] && PS1="test-debug $PS1" bash -i
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rlFileRestore"
rlRun "rlServiceRestore"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,63 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/bind/Sanity/named-checkzone
# Description: Sanity/named-checkzone
# Author: Petr Sklenar <psklenar@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2015 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/bind/Sanity/named-checkzone
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE cptest2.tld.db
.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 Sklenar <psklenar@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Sanity/named-checkzone" >> $(METADATA)
@echo "Type: Sanity" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: bind" >> $(METADATA)
@echo "Requires: bind bind-utils" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2+" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Releases: -RHEL4 -RHELClient5 -RHELServer5" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -0,0 +1,3 @@
PURPOSE of /CoreOS/bind/Sanity/named-checkzone
Description: Sanity/named-checkzone
Author: Petr Sklenar <psklenar@redhat.com>

View file

@ -0,0 +1,30 @@
; cPanel first:11.49.9999.115 (update_time):1429809767 11.49.9999.115: Cpanel::ZoneFile::VERSION:1.3 hostname:i-00002f3f.cpanel.nova latest:11.49.9999.115
; Zone file for cptest2.tld
$TTL 14400
@ 86400 IN SOA ns1.cpanel.nova. julian.brown.cpanel.net. (
2015042303 ; serial, todays date+todays
86400 ; refresh, seconds
7200 ; retry, seconds
3600000 ; expire, seconds
86400 ) ; minimum, seconds
cptest2.tld. 86400 IN NS ns1.cpanel.nova.
cptest2.tld. 86400 IN NS ns2.cpanel.nova.
cptest2.tld. IN A 10.6.27.120
cptest2.tld. IN MX 0 cptest2.tld.
mail IN CNAME cptest2.tld.
www IN CNAME cptest2.tld.
ftp IN A 10.6.27.120
cptest2.tld. IN TXT "v=spf1 +a +mx +ip4:10.6.27.120 ~all"
cpanel IN A 10.6.27.120
webdisk IN A 10.6.27.120
cpcalendars IN A 10.6.27.120
cpcontacts IN A 10.6.27.120
whm IN A 10.6.27.120
webmail IN A 10.6.27.120
default._domainkey IN TXT "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAna8Du0cGijhRQWLN1Eb0jqJZbggaSqmyyM2EEua3U8J9YWJ9nNMS08lSHGyQSpVPh8g/uJaHa1cMkXla5ZGGra5GhY+WbAd9m6W45ztcMnXMTBbmMtMu24LgdXWNj0Lkotl4ewCEn9UioQFxpIbNnn6qrhKMajsfygb5/Zzq1rF2NT+FjZRbXtkKGd6tgB03I" bnMlMrmuccNX8U3oVbAk0+hI+Y5eOErYK54iUPvysF9MJJWMV40H7woumNvx73jswA2iK+ZKPOGH9CNXbToqgTbJmRRoMpY0nwjCVsIhaCN9bZxrpF/LaoE/3qeccUAT1tIwEZJIj6ruC8Rx3ydwQIDAQAB\;

View file

@ -0,0 +1,25 @@
summary: Sanity/named-checkzone
description: ''
contact: Petr Sklenar <psklenar@redhat.com>
component:
- bind
test: ./runtest.sh
framework: beakerlib
recommend:
- bind
- bind-utils
duration: 5m
enabled: true
tag:
- NoRHEL4
- NoRHEL5
- TIP_fedora_pass
- TIPfail_infra
- TIPpass
adjust:
- enabled: false
when: distro == rhel-4, rhel-5
continue: false
extra-nitrate: TC#0500008
extra-summary: /CoreOS/bind/Sanity/named-checkzone
extra-task: /CoreOS/bind/Sanity/named-checkzone

View file

@ -0,0 +1,45 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/bind/Sanity/named-checkzone
# Description: Sanity/named-checkzone
# Author: Petr Sklenar <psklenar@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2015 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/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="bind"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun "ls cptest2.tld.db"
rlPhaseEnd
rlPhaseStartTest "check zone file from bug 1215164"
rlRun "named-checkzone cptest2.tld cptest2.tld.db"
rlRun "named-checkzone cptest2.tld cptest2.tld.db | grep 'add matching type SPF record'" 1
rlPhaseEnd
rlJournalPrintText
rlJournalEnd