adding new test

This commit is contained in:
Ondrej Mejzlik 2023-01-17 08:09:19 +01:00
commit 197ee73657
5 changed files with 223 additions and 0 deletions

View file

@ -0,0 +1,18 @@
tag:
- HttpdSclTodo
- TIP_fedora_fail
- TIPfail_infra
- TIPfail_samba
- TIPfail_systemd
- TIPpass
- TIPpass_Apps
- TIPpass_Security
- Tier2security
- TierSecurity
- notier_apps
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=540818
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=684144
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1623997
extra-nitrate: TC#0008580
extra-summary: /CoreOS/wget/Sanity/https

View file

@ -0,0 +1,24 @@
environment:
MODSTREAMS: httpd:2.4
tag:
- HttpdSclTodo
- TIP_fedora_fail
- TIPfail_Security
- TIPfail_infra
- TIPfail_samba
- TIPfail_systemd
- TIPpass
- TIPpass_Apps
- TestCaseCopy
- Tier1security
- TierSecurity
- notier_apps
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=540818
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1623997
adjust:
- enabled: false
when: distro < rhel-8
continue: false
extra-nitrate: TC#0587556
extra-summary: /CoreOS/wget/Sanity/https [httpd:2.4]

37
Sanity/https/main.fmf Normal file
View file

@ -0,0 +1,37 @@
summary: Sanity test for https options
description: |
This sanity test covers the following wget features:
[ ] get file
[ ] secure-protocol
[ ] no-check-certificate
[ ] certificate
[ ] certificate-type
[ ] private-key
[ ] private-key-type
[ ] ca-certificate
[ ] ca-directory
[ ] random-file
[ ] egd-file
Marked as [ ] are features still to be covered.
component:
- wget
- httpd
- gnutls
test: ./runtest.sh
path: /Sanity/https
framework: beakerlib
recommend:
- httpd
- mod_ssl
- wget
- tree
- openssl
- net-tools
duration: 15m
enabled: true
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=540818
extra-summary: /CoreOS/wget/Sanity/https
extra-task: /CoreOS/wget/Sanity/https

136
Sanity/https/runtest.sh Executable file
View file

@ -0,0 +1,136 @@
#!/bin/bash
# vim: dict=/usr/share/rhts-library/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/wget/Sanity/https
# Description: Sanity test for https options
# Author: Petr Splichal <psplicha@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/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="wget"
WwwUrl="https://localhost/wget/"
WwwDir="/var/www/html/wget"
srv_key=/etc/pki/tls/private/localhost.key
srv_cert=/etc/pki/tls/certs/localhost.crt
rlJournalStart
# set up
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun "TmpDir=\`mktemp -d\`" 0 "Creating tmp directory"
# create test www content
rlRun "mkdir $WwwDir" 0 "Creating www directory"
rlRun "echo 'TestContent' > $WwwDir/index.html"
# start the server ang go!
if [ -e $srv_key ]; then
rlRun "rlFileBackup $srv_key"
else
rlLog "$srv_key does not exist, not backing up"
fi
if [ -e $srv_cert ]; then
rlRun "rlFileBackup $srv_cert"
else
rlLog "$srv_cert does not exist, not backing up"
fi
if rlIsRHEL '5'; then
sig_hash="-sha1"
else
sig_hash="-sha256"
fi
rlRun "openssl req -x509 -newkey rsa:2048 -keyout $srv_key -out $srv_cert -subj '/CN=$(hostname)' -nodes -batch $sig_hash"
netstat -tulpn
rlRun "rlServiceStart httpd"
rlRun "pushd $TmpDir"
rlPhaseEnd
# get redhat page
rlPhaseStartTest "Test redhat.com page"
rlRun "mkdir redhat"
rlRun "pushd redhat"
rlRun "wget -O index.html https://www.redhat.com/"
rlAssertExists "index.html"
rlAssertGrep '</html>' 'index.html' -i
rlRun "popd"
rlPhaseEnd
# bad certificate
rlPhaseStartTest "Bad certificate"
rlRun "mkdir bad-certificate"
rlRun "pushd bad-certificate"
rlRun "wget $WwwUrl" 1,5
rlAssertNotExists "index.html"
rlRun "popd"
rlPhaseEnd
# --no-check--certificate
rlPhaseStartTest "Test --no-check--certificate"
rlRun "mkdir test--no-check-certificate"
rlRun "pushd test--no-check-certificate"
rlRun "wget --no-check-certificate $WwwUrl" 0
rlAssertExists "index.html"
rlAssertGrep "TestContent" "index.html"
rlRun "popd"
rlPhaseEnd
rlPhaseStartTest "Test --ca-certificate"
rlRun "wget --ca-certificate=/etc/pki/tls/certs/localhost.crt https://$(hostname)/wget/" 0
rlAssertExists "index.html"
rlAssertGrep "TestContent" "index.html"
rlRun "rm index.html"
rlPhaseEnd
# wget on RHEL <7.4 doesn't understand the TLSv1_2 name
if ! rlIsRHEL '<7.4'; then
rlPhaseStartTest "Test TLS 1.2"
rlRun "wget --ca-certificate=/etc/pki/tls/certs/localhost.crt --secure-protocol=TLSv1_2 https://$(hostname)/wget/" 0
rlAssertExists "index.html"
rlAssertGrep "TestContent" "index.html"
rlRun "rm index.html"
rlPhaseEnd
fi
# TLS 1.3 was added in RHEL-8
if ! rlIsRHEL '<8'; then
rlPhaseStartTest "Test TLS 1.3"
rlRun "wget --ca-certificate=/etc/pki/tls/certs/localhost.crt --secure-protocol=TLSv1_3 https://$(hostname)/wget/" 0
rlAssertExists "index.html"
rlAssertGrep "TestContent" "index.html"
rlRun "rm index.html"
rlPhaseEnd
fi
# clean up
rlPhaseStartCleanup
rlRun "tree || find"
rlRun "popd"
rlFileRestore
rlRun "rlServiceRestore httpd"
rlRun "rm -r $TmpDir $WwwDir" 0 "Removing test directories"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

8
Sanity/https/test.md Normal file
View file

@ -0,0 +1,8 @@
# Test
## Step
1.
## Expect
1.